diff --git a/packages/playground/src/index.ts b/packages/playground/src/index.ts index d8f1cfa02694..fc01ecec4c66 100644 --- a/packages/playground/src/index.ts +++ b/packages/playground/src/index.ts @@ -191,21 +191,21 @@ export const setupPlayground = ( const lenses = !showFileCodeLens ? [] : [ - { - range: { - startLineNumber: 1, - startColumn: 1, - endLineNumber: 2, - endColumn: 1, - }, - id: "implicit-filename-first", - command: { - id: "noop", - title: `// @filename: ${sandbox.filepath}`, - }, + { + range: { + startLineNumber: 1, + startColumn: 1, + endLineNumber: 2, + endColumn: 1, }, - ] - return { lenses, dispose: () => {} } + id: "implicit-filename-first", + command: { + id: "noop", + title: `// @filename: ${sandbox.filepath}`, + }, + }, + ] + return { lenses, dispose: () => { } } }, }) @@ -338,7 +338,7 @@ export const setupPlayground = ( a.parentElement!.classList.toggle("open") a.setAttribute("aria-expanded", "true") - const exampleContainer = a.closest("li")!.getElementsByTagName("ul").item(0) + const exampleContainer = a.closest("li")!.getElementsByClassName("dropdown-dialog").item(0) as HTMLElement if (!exampleContainer) return const firstLabel = exampleContainer.querySelector("label") as HTMLElement @@ -359,7 +359,7 @@ export const setupPlayground = ( if (lastButton) { redirectTabPressTo(lastButton, exampleContainer, ".examples-close") } else { - const sections = document.querySelectorAll("ul.examples-dropdown .section-content") + const sections = document.querySelectorAll(".dropdown-dialog .section-content") sections.forEach(s => { const buttons = s.querySelectorAll("a.example-link") const lastButton = buttons.item(buttons.length - 1) as HTMLElement diff --git a/packages/typescriptlang-org/src/components/ShowExamples.scss b/packages/typescriptlang-org/src/components/ShowExamples.scss index 30116819454b..5127a2485e88 100644 --- a/packages/typescriptlang-org/src/components/ShowExamples.scss +++ b/packages/typescriptlang-org/src/components/ShowExamples.scss @@ -14,8 +14,28 @@ color: var(--link-color); } + button.section-name { + font-size: 2rem; + font-weight: 600; + + height: 2.8rem; + text-decoration: none; + border-bottom: none; + padding-bottom: 0.05rem; + margin-top: 0; + padding-top: 0; + margin-right: 1rem; + border: none; + background-color: transparent; + color: var(--text-color); + } + + button.section-name.selected { + border-bottom: $ts-main-blue-color 2px solid; + } + // The titles of the sections - > ol { + >ol { padding-left: 0; li { @@ -28,26 +48,6 @@ background-color: transparent; } } - - button.section-name { - font-size: 2rem; - font-weight: 600; - - height: 2.8rem; - text-decoration: none; - border-bottom: none; - padding-bottom: 0.05rem; - margin-top: 0; - padding-top: 0; - margin-right: 1rem; - border: none; - background-color: transparent; - color: var(--text-color); - } - - button.section-name.selected { - border-bottom: $ts-main-blue-color 2px solid; - } } ol { @@ -56,11 +56,11 @@ padding-left: 0; } - > div.section-content { + >div.section-content { flex-wrap: wrap; display: flex; - > p > a { + >p>a { display: inline-block; color: $ts-main-blue-color; padding: 0; @@ -118,6 +118,7 @@ &.done { background-color: $ts-main-blue-darker-color; } + &.changed { border: $ts-main-blue-darker-color 1px solid; } @@ -126,4 +127,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/components/ShowExamples.tsx b/packages/typescriptlang-org/src/components/ShowExamples.tsx index 8630312eb2b3..92443572919d 100644 --- a/packages/typescriptlang-org/src/components/ShowExamples.tsx +++ b/packages/typescriptlang-org/src/components/ShowExamples.tsx @@ -108,18 +108,16 @@ export const RenderExamples = (props: Props) => { const sections = props.sections.map(sectionID => locale.sections.find(localeSection => sectionID === localeSection.id) || english.sections.find(localeSection => sectionID === localeSection.id)) return (
-
    +
    {sections.map(section => { const startOpen = section.id === props.defaultSection const selectedClass = startOpen ? " selected" : "" return ( -
  1. - -
  2. + ) } )} -
+
{sections.map(section => { const sectionDict = sortedSectionsDictionary(locale, section) diff --git a/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx b/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx index e3561e306dd3..e8dd3572c7f9 100644 --- a/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx +++ b/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx @@ -50,7 +50,7 @@ export const PlaygroundSamples = (props: Props) => { }, []); return ( - diff --git a/packages/typescriptlang-org/src/copy/en/community.ts b/packages/typescriptlang-org/src/copy/en/community.ts index 2d9cc242c6d1..fc5c0b67df10 100644 --- a/packages/typescriptlang-org/src/copy/en/community.ts +++ b/packages/typescriptlang-org/src/copy/en/community.ts @@ -1,8 +1,8 @@ export const comCopy = { - com_layout_title: "How to set up TypeScript", // FIXME: Is this the right title for the community page? + com_layout_title: "TypeScript Community Resources", com_layout_description: "Connect with other TypeScripters online and offline.", - com_headline: "Connect with us", // FIXME: I think this is not used anywhere + com_headline: "Connect with us", com_connect_online: "Online", com_connect_online_description: " Tell us what’s working well, what you want to see added or improved, and find out about new updates.", diff --git a/packages/typescriptlang-org/src/templates/documentation.scss b/packages/typescriptlang-org/src/templates/documentation.scss index c18b4a48b4f1..636764604b1f 100644 --- a/packages/typescriptlang-org/src/templates/documentation.scss +++ b/packages/typescriptlang-org/src/templates/documentation.scss @@ -1,13 +1,11 @@ @import "../style/globals.scss"; #beta { - background: repeating-linear-gradient( - 45deg, - #9b9a4e, - #9b9a4e 10px, - #6e6a33 10px, - #6e6a33 20px - ); + background: repeating-linear-gradient(45deg, + #9b9a4e, + #9b9a4e 10px, + #6e6a33 10px, + #6e6a33 20px); background-color: "#c63131"; text-align: center; color: white; @@ -32,7 +30,7 @@ } // Page title - & > h2 { + &>h1 { font-size: 3.5rem; line-height: 3.5rem; font-weight: 400; @@ -76,9 +74,11 @@ nav { position: sticky; top: 30px; + &.deprecated { top: 7rem; } + margin-bottom: 1rem; } @@ -120,6 +120,7 @@ } .like-dislike-subnav { + #like-button, #dislike-button { cursor: pointer; @@ -130,6 +131,7 @@ .preamble a { color: var(--text-color); } + .justify-between { justify-content: space-between; } @@ -269,6 +271,7 @@ margin: 0 0 0 0; padding: 1rem; flex-direction: column; + h3 { font-size: 0.8rem; } @@ -276,6 +279,7 @@ #deprecated-icon { margin-right: 1rem; } + #deprecated-action { margin-top: 1rem; } @@ -325,24 +329,30 @@ tr { width: 100%; + p { margin: 0; padding: 0; } + code { word-wrap: normal; } } + // Override the default stripes tr.odd { background-color: var(--background-color) !important; } + tr.even { background-color: var(--background-minor-highlight-color) !important; } + ul { margin: 0; padding: 0; + li { list-style: none; margin: 0; @@ -446,4 +456,4 @@ -webkit-animation: 0.1s ease forwards; animation: 0.1s ease forwards; } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/templates/documentation.tsx b/packages/typescriptlang-org/src/templates/documentation.tsx index 0cae8d84ece4..7b698c2e1fd7 100644 --- a/packages/typescriptlang-org/src/templates/documentation.tsx +++ b/packages/typescriptlang-org/src/templates/documentation.tsx @@ -96,7 +96,7 @@ const HandbookTemplate: React.FC = (props) => {
-
+

Was this page helpful?

@@ -138,21 +138,21 @@ const HandbookTemplate: React.FC = (props) => { } - {showExperimental && -
-
-
- -
-
-

{i("handb_experimental_title")}

-

{i("handb_experimental_subtitle")}

-
+ {showExperimental && +
+
+
+
+
+

{i("handb_experimental_title")}

+

{i("handb_experimental_subtitle")}

+
+
} -

{post.frontmatter.title}

+

{post.frontmatter.title}

{post.frontmatter.preamble &&
}
@@ -190,7 +190,7 @@ const HandbookTemplate: React.FC = (props) => {
- + ) } diff --git a/packages/typescriptlang-org/src/templates/markdown-twoslash.scss b/packages/typescriptlang-org/src/templates/markdown-twoslash.scss index 62ced3218a70..dc10d9cd644a 100644 --- a/packages/typescriptlang-org/src/templates/markdown-twoslash.scss +++ b/packages/typescriptlang-org/src/templates/markdown-twoslash.scss @@ -30,24 +30,30 @@ pre { overflow-x: auto; position: relative; } + pre.shiki { overflow-x: auto; } + pre.shiki:hover .dim { opacity: 1; } + pre.shiki div.dim { - opacity: 0.5; + opacity: 0.9; } + pre.shiki div.dim, pre.shiki div.highlight { margin: 0; padding: 0; } + pre.shiki div.highlight { opacity: 1; background-color: #f1f8ff; } + pre.shiki div.line { min-height: 1rem; } @@ -87,8 +93,9 @@ pre.twoslash data-lsp:hover::before { pre .code-container { overflow: auto; } + /* The try button */ -pre .code-container > a { +pre .code-container>a { position: absolute; right: 8px; bottom: 8px; @@ -101,16 +108,19 @@ pre .code-container > a { transition-timing-function: ease; transition: opacity 0.3s; } + /* Respect no animations */ @media (prefers-reduced-motion: reduce) { - pre .code-container > a { + pre .code-container>a { transition: none; } } -pre .code-container > a:hover { + +pre .code-container>a:hover { color: white; background-color: #719af4; } + pre .code-container:hover a { opacity: 1; } @@ -121,6 +131,7 @@ pre code { white-space: pre; -webkit-overflow-scrolling: touch; } + pre code a { text-decoration: none; } @@ -148,6 +159,7 @@ pre .error-behind { white-space: pre-wrap; display: block; } + pre .error { position: absolute; background-color: #fee; @@ -158,14 +170,17 @@ pre .error { align-items: center; color: black; } + pre .error .code { display: none; } + pre .error-behind { user-select: none; visibility: transparent; color: #fee; } + /* Queries */ pre .arrow { /* Transparent background */ @@ -181,6 +196,7 @@ pre .arrow { height: 8px; width: 8px; } + pre .popover { margin-bottom: 10px; background-color: #eee; @@ -189,13 +205,14 @@ pre .popover { margin-top: 10px; border-radius: 3px; } + /* Completion */ pre .inline-completions ul.dropdown { display: inline-block; position: absolute; width: 240px; - background-color: gainsboro; - color: grey; + background-color: #E7E7E7; + color: #333; padding-top: 4px; font-family: var(--code-font); font-size: 0.8rem; @@ -203,6 +220,7 @@ pre .inline-completions ul.dropdown { padding: 0; border-left: 4px solid #4b9edd; } + pre .inline-completions ul.dropdown::before { background-color: #4b9edd; width: 2px; @@ -211,27 +229,33 @@ pre .inline-completions ul.dropdown::before { left: -3px; content: " "; } + pre .inline-completions ul.dropdown li { overflow-x: hidden; padding-left: 4px; margin-bottom: 4px; } + pre .inline-completions ul.dropdown li.deprecated { text-decoration: line-through; } + pre .inline-completions ul.dropdown li span.result-found { - color: #4b9edd; + color: #2265a5; } + pre .inline-completions ul.dropdown li span.result { width: 100px; color: black; display: inline-block; } + .dark-theme .markdown pre { background-color: #d8d8d8; border-color: #ddd; filter: invert(98%) hue-rotate(180deg); } + data-lsp { /* Ensures there's no 1px jump when the hover happens */ border-bottom: 1px dotted transparent; @@ -239,6 +263,7 @@ data-lsp { transition-timing-function: ease; transition: border-color 0.3s; } + /* Respect people's wishes to not have animations */ @media (prefers-reduced-motion: reduce) { data-lsp { @@ -273,4 +298,4 @@ data-lsp { } } } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/templates/pages/community.tsx b/packages/typescriptlang-org/src/templates/pages/community.tsx index ee025f0b4191..715ee9bc819b 100644 --- a/packages/typescriptlang-org/src/templates/pages/community.tsx +++ b/packages/typescriptlang-org/src/templates/pages/community.tsx @@ -40,6 +40,9 @@ export const Comm: React.FC = props => { return ( +
+

{i("com_headline")}

+
diff --git a/packages/typescriptlang-org/src/templates/pages/css/documentation.scss b/packages/typescriptlang-org/src/templates/pages/css/documentation.scss index 8127e03ae90f..4e8f3d765e63 100644 --- a/packages/typescriptlang-org/src/templates/pages/css/documentation.scss +++ b/packages/typescriptlang-org/src/templates/pages/css/documentation.scss @@ -28,6 +28,7 @@ &:hover { background-color: $ts-light-bg-grey; } + &:active { background-color: $ts-light-bg-grey-highlight-color; margin-bottom: 19px; @@ -36,6 +37,10 @@ @media screen and (-ms-high-contrast: active) { border: 1px solid grey; + + svg path { + fill: white; + } } &.headline { @@ -99,6 +104,7 @@ &.wide { justify-content: space-between; + .item { min-width: 240px; } @@ -154,4 +160,4 @@ div#like-dislike-subnav { } } } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/templates/play.scss b/packages/typescriptlang-org/src/templates/play.scss index 6c35a1af949c..995a00729d52 100644 --- a/packages/typescriptlang-org/src/templates/play.scss +++ b/packages/typescriptlang-org/src/templates/play.scss @@ -8,7 +8,7 @@ height: 3rem; position: relative; - > ul { + >ul { display: flex; padding: 0; margin: 0; @@ -50,18 +50,27 @@ color: var(--text-color); } - &.dropdown.open ul { - display: block; + &.dropdown.open { + + ul, + .dropdown-dialog { + display: block; + } } - &.dropdown ul { - display: none; + &.dropdown { - position: absolute; - top: 100%; - left: 0; - z-index: 1; - float: left; + ul, + .dropdown-dialog { + + display: none; + + position: absolute; + top: 100%; + left: 0; + z-index: 1; + float: left; + } } // Menu items @@ -120,7 +129,7 @@ } // Examples dropdown - &.dropdown ul.examples-dropdown { + &.dropdown .dropdown-dialog { width: 800px; overflow-y: scroll; padding: 2rem; @@ -148,7 +157,7 @@ display: flex; flex-wrap: wrap; - > div { + >div { min-width: 200px; max-width: 400px; @@ -182,7 +191,7 @@ position: absolute; } - > span { + >span { font-family: $font-code; margin-left: 4px; } @@ -215,23 +224,26 @@ } // The subnav which starts with "Playground" -main > nav { +main>nav { position: relative; - .examples-dropdown { + .dropdown-dialog { padding-left: 0; background-color: var(--playground-dropdown-bg); } - > ul { + >ul { li.disabled { opacity: 0.5; } + li.active { + &:hover, &.open { background-color: var(--playground-dropdown-bg); } + &.open .caret { transform: scaleY(-1); } @@ -256,20 +268,23 @@ button.examples-close { // The toolbar for the editor main #editor-toolbar { + // For the main buttons - > ul > li { + >ul>li { margin-left: 0px; margin-bottom: 0px; - > a { + >a { // Fix their vertical centering padding-top: 0.8rem; + &:hover { @media (prefers-color-scheme: dark) { border-bottom: 1px solid white; } } } + // Ensure menus use this button for // their x position: relative; @@ -298,7 +313,7 @@ main #editor-toolbar { border-left: 4px solid transparent; } -#editor-toolbar > ul > li > a:first-child { +#editor-toolbar>ul>li>a:first-child { padding-left: 1rem; } @@ -319,6 +334,7 @@ main #editor-toolbar { margin-top: 12px; margin-left: 12px; } + ul { padding: 0; @@ -341,6 +357,7 @@ main #editor-toolbar { a { display: block; text-decoration: none; + svg { margin-right: 8px; } @@ -352,10 +369,12 @@ main #editor-toolbar { &.selectable.selected { background-color: var(--blue-tinged-strong); + // font-weight: bold; a { color: var(--text-color); } + path { stroke: var(--text-color); } @@ -548,6 +567,7 @@ main #editor-toolbar { margin-bottom: 10px; position: relative; + ul.right { background-color: var(--playground-dropdown-bg); @@ -629,6 +649,7 @@ main #editor-toolbar { overflow-x: auto; width: 100%; padding: 0 10px; + code { font-family: $font-code; font-size: 14px; @@ -776,19 +797,22 @@ main #editor-toolbar { span.ast-node-number { color: blue; } + span.ast-node-string { color: green; } + span.ast-node-boolean { color: red; } + span.ast-node-undefined { color: brown; } } // When showing a list of children, always do block so that they are newlined - .ast-children > div.ast-tree-start { + .ast-children>div.ast-tree-start { display: block; margin-left: 12px; min-height: 1rem; @@ -806,7 +830,7 @@ main #editor-toolbar { } &.open { - > a.node-name { + >a.node-name { top: 4px; } } @@ -837,16 +861,17 @@ main #editor-toolbar { div.ast-tree-start.open { display: block; - > ul { + + >ul { display: block; } } - div.ast-tree-start > a:not(:last-child):before { + div.ast-tree-start>a:not(:last-child):before { content: "+"; } - div.ast-tree-start.open > a:not(:last-child):before { + div.ast-tree-start.open>a:not(:last-child):before { content: "-"; } } @@ -888,6 +913,7 @@ main #editor-toolbar { li { margin-bottom: 0.2rem; } + span { margin-right: 1rem; } @@ -895,9 +921,11 @@ main #editor-toolbar { li { list-style: none; + span { font-weight: 600; } + margin-bottom: 1rem; } } @@ -911,6 +939,7 @@ main #editor-toolbar { 0% { background-color: yellow; } + 100% { background-color: inherit; } @@ -938,6 +967,7 @@ input.good { #playground-container .playground-plugins { &.featured { border: 1px solid lightgrey; + li { border-bottom: 1px solid lightgrey; } @@ -965,6 +995,7 @@ input.good { label { padding-left: 30px; padding-right: 10px; + span { font-weight: 600; } @@ -980,6 +1011,7 @@ input.good { text-align: center; text-decoration: none; line-height: 1rem; + &:hover { background-color: #fcb7b7; color: red; @@ -1058,13 +1090,11 @@ input.good { &.warning { color: white; - background: repeating-linear-gradient( - 45deg, - #d63131, - #d63131 10px, - #c63131 10px, - #c63131 20px - ); + background: repeating-linear-gradient(45deg, + #d63131, + #d63131 10px, + #c63131 10px, + #c63131 20px); } } } @@ -1086,6 +1116,7 @@ input.good { position: relative; width: 80px; height: 80px; + div { position: absolute; width: 16px; @@ -1099,41 +1130,49 @@ input.good { left: 8px; animation-delay: 0s; } + &:nth-child(2) { top: 8px; left: 32px; animation-delay: -0.4s; } + &:nth-child(3) { top: 8px; left: 56px; animation-delay: -0.8s; } + &:nth-child(4) { top: 32px; left: 8px; animation-delay: -0.4s; } + &:nth-child(5) { top: 32px; left: 32px; animation-delay: -0.8s; } + &:nth-child(6) { top: 32px; left: 56px; animation-delay: -1.2s; } + &:nth-child(7) { top: 56px; left: 8px; animation-delay: -0.8s; } + &:nth-child(8) { top: 56px; left: 32px; animation-delay: -1.2s; } + &:nth-child(9) { top: 56px; left: 56px; @@ -1144,10 +1183,12 @@ input.good { } @keyframes lds-grid { + 0%, 100% { opacity: 1; } + 50% { opacity: 0.5; } @@ -1184,4 +1225,4 @@ input.good { .monaco-list { background-color: var(--background-color); -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/templates/play.tsx b/packages/typescriptlang-org/src/templates/play.tsx index 5e5e3783aea4..0320c3e42fb6 100644 --- a/packages/typescriptlang-org/src/templates/play.tsx +++ b/packages/typescriptlang-org/src/templates/play.tsx @@ -26,7 +26,7 @@ type Props = { lang: string examplesTOC: typeof import("../../static/js/examples/en.json") optionsSummary: any // this is just passed through to the playground JS library at this point - playgroundHandbookTOC: { docs : any[] } + playgroundHandbookTOC: { docs: any[] } } } @@ -112,8 +112,8 @@ const Play: React.FC = (props) => { } // Allow prod/staging builds to set a custom commit prefix to bust caches - const {sandboxRoot, playgroundRoot, playgroundWorker} = getPlaygroundUrls() - + const { sandboxRoot, playgroundRoot, playgroundWorker } = getPlaygroundUrls() + // @ts-ignore const re: any = global.require re.config({ @@ -157,7 +157,7 @@ const Play: React.FC = (props) => { container.style.height = `${height - Math.round(container.getClientRects()[0].top) - 18}px` const extension = (!!params.get("useJavaScript") ? "js" : params.get("filetype") || "ts") as any - const workerPath = params.get("multiFile") ? `${document.location.origin + playgroundWorker}?filetype=${extension}` : undefined + const workerPath = params.get("multiFile") ? `${document.location.origin + playgroundWorker}?filetype=${extension}` : undefined // Create the sandbox const sandboxEnv = await sandbox.createTypeScriptSandbox({ @@ -167,7 +167,7 @@ const Play: React.FC = (props) => { filetype: extension, acquireTypes: !localStorage.getItem("disable-ata"), supportTwoslashCompilerOptions: true, - customTypeScriptWorkerPath: workerPath , + customTypeScriptWorkerPath: workerPath, monacoSettings: { fontFamily: "var(--code-font)", fontLigatures: true @@ -206,7 +206,7 @@ const Play: React.FC = (props) => {
  • -
      +

      {i("play_subnav_config")}

      @@ -224,23 +224,23 @@ const Play: React.FC = (props) => {
      -
    +
  • -
      +
      -
    +
  • -
      +
      -
    +
  • diff --git a/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts b/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts index 027270497f81..d0677590d3f0 100644 --- a/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts +++ b/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts @@ -55,7 +55,7 @@ export const setupLikeDislikeButtons = (slug: string, i: any) => { const popupOpacity = bottomOfWindow ? "1" : "0" if (popup.style.opacity != popupOpacity) { - // popup.style.display = bottomOfWindow ? "block" : "none" + popup.style.display = bottomOfWindow ? "block" : "none" popup.style.opacity = popupOpacity }