Skip to content

Commit

Permalink
Merge branch 'main' of github.com:sass/sass-site into playground-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Sep 20, 2024
2 parents 93a4f1a + ff96bb7 commit e44f732
Show file tree
Hide file tree
Showing 32 changed files with 2,526 additions and 564 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Thumbs.db
/_site/
/source/assets/dist/

# Generated file
/source/assets/js/playground/module-metadata.ts

# NPM/Yarn
node_modules/
yarn-debug.log*
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/_site/
/source/_data/versionCache.json
/source/assets/dist/
/source/assets/js/playground/module-metadata.ts
/source/assets/js/vendor/**
/source/assets/sass/vendor/
/source/documentation/js-api
Expand Down
63 changes: 54 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@
"clean-version-cache": "rm -f source/_data/versionCache.json",
"build:sass": "sass --style=compressed ./source/assets/sass/sass.scss:./source/assets/dist/css/sass.css ./source/assets/sass/noscript.scss:./source/assets/dist/css/noscript.css",
"watch:sass": "sass --watch ./source/assets/sass/sass.scss:./source/assets/dist/css/sass.css ./source/assets/sass/noscript.scss:./source/assets/dist/css/noscript.css",
"build-dev:scripts": "rollup -c",
"build-prod:scripts": "NODE_ENV=production BABEL_ENV=production rollup -c",
"watch:scripts": "npm run build-dev:scripts -- -w",
"build-module-metadata": "ts-node tool/generate-module-metadata.ts",
"build-rollup": "rollup -c",
"watch-rollup": "rollup -c -w",
"build-dev:scripts": "run-s build-module-metadata build-rollup",
"build-prod:scripts": "NODE_ENV=production BABEL_ENV=production npm run build-dev:scripts",
"watch:scripts": "run-s build-module-metadata watch-rollup",
"build:typedoc": "./tool/typedoc-build.sh",
"build:11ty": "NODE_OPTIONS='-r ts-node/register' eleventy",
"watch:11ty": "npm run build:11ty -- --serve --incremental",
"check": "run-s check:gts check:tsc check:stylelint",
"check:gts": "gts check",
"check:stylelint": "stylelint 'source/assets/sass/*.{css,scss}'",
"check:tsc": "tsc --noEmit",
"tsc:no-emit": "tsc --noEmit",
"check:tsc": "run-s build-module-metadata tsc:no-emit",
"fix": "run-s fix:gts fix:stylelint",
"fix:gts": "gts fix",
"fix:stylelint": "stylelint 'source/assets/sass/*.{css,scss}' --fix",
Expand Down Expand Up @@ -98,7 +102,7 @@
"prettier": "^3.3.3",
"prismjs": "^1.29.0",
"rollup": "^4.21.3",
"sass": "^1.78.0",
"sass": "^1.79.2",
"semver": "^7.6.3",
"stylelint": "^15.11.0",
"stylelint-config-standard-scss": "^11.1.0",
Expand Down
2 changes: 2 additions & 0 deletions source/_data/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ toc:
- Functions and Mixins Beginning with <code>--</code>: /documentation/breaking-changes/css-function-mixin/
- Mixed Declarations: /documentation/breaking-changes/mixed-decls/
- <code>meta.feature-exists</code>: /documentation/breaking-changes/feature-exists/
- Color Functions: /documentation/breaking-changes/color-functions/
- Legacy JS API: /documentation/breaking-changes/legacy-js-api/
- Command Line: /documentation/cli/
:children:
- Dart Sass: /documentation/cli/dart-sass/
Expand Down
6 changes: 0 additions & 6 deletions source/_includes/silencing_deprecations.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,3 @@ option] in the JavaScript API.

[`--silence-deprecation` flag]: /documentation/cli/dart-sass/#silence-deprecation
[`silenceDeprecations` option]: /documentation/js-api/interfaces/Options/#silenceDeprecations

{% headsUp %}
This option is only available in the [modern JS API].

[modern JS API]: /documentation/js-api/#md:usage
{% endheadsUp %}
Binary file added source/assets/img/blog/042-blue-yellow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-p3-hsl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-p3-oklch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-p3-srgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-srgb-hsl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-srgb-hwb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/assets/img/blog/042-srgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 25 additions & 5 deletions source/assets/js/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from './playground/editor-setup.js';
import {
ParseResult,
PlaygroundSelection,
PlaygroundState,
customLoader,
deserializeState,
Expand Down Expand Up @@ -111,9 +112,7 @@ function setupPlayground(): void {
* Returns a playground state selection for the current single non-empty
* selection, or `null` otherwise.
*/
function editorSelectionToStateSelection():
| PlaygroundState['selection']
| null {
function editorSelectionToStateSelection(): PlaygroundSelection {
const sel = editor.state.selection;
if (sel.ranges.length !== 1) return null;

Expand All @@ -130,7 +129,7 @@ function setupPlayground(): void {
];
}

/** Updates the editor's selection based on `playgroundState.selection`. */
/** Updates the {@link editor}'s selection based on `{@link playgroundState.selection}`. */
function updateSelection(): void {
if (playgroundState.selection === null) {
const sel = editor.state.selection;
Expand Down Expand Up @@ -162,6 +161,13 @@ function setupPlayground(): void {
}
}

/** Highlights {@link selection} and focuses on the {@link editor}. */
function goToSelection(selection: PlaygroundSelection): void {
playgroundState.selection = selection;
updateSelection();
editor.focus();
}

// Apply initial state to dom
function applyInitialState(): void {
updateButtonState();
Expand Down Expand Up @@ -301,8 +307,22 @@ function setupPlayground(): void {
'.sl-c-playground__console'
) as HTMLDivElement;
console.innerHTML = playgroundState.debugOutput
.map(displayForConsoleLog)
.map(item => displayForConsoleLog(item, playgroundState))
.join('\n');
console.querySelectorAll('a.console-location').forEach(link => {
(link as HTMLAnchorElement).addEventListener('click', event => {
if (!(event.metaKey || event.altKey || event.shiftKey)) {
event.preventDefault();
}
const range = (event.currentTarget as HTMLAnchorElement).dataset.range
?.split(',')
.map(n => parseInt(n));
if (range && range.length === 4) {
const [fromL, fromC, toL, toC] = range;
goToSelection([fromL, fromC, toL, toC]);
}
});
});
}

function updateDiagnostics(): void {
Expand Down
Loading

0 comments on commit e44f732

Please sign in to comment.