From d61e4538a19d8a335a2d36399409f7414ed0fe43 Mon Sep 17 00:00:00 2001 From: kozbial Date: Tue, 15 Jun 2021 09:38:35 -0700 Subject: [PATCH] Revert #4697 --- blockly_uncompressed.js | 4 +- core/requires.js | 2 + core/theme/dark.js | 33 +++++++ core/theme/modern.js | 108 +++++++++++++++++++++ package-lock.json | 6 -- package.json | 1 - scripts/gulpfiles/appengine_tasks.js | 1 - tests/playgrounds/advanced_playground.html | 1 - 8 files changed, 146 insertions(+), 10 deletions(-) create mode 100644 core/theme/dark.js create mode 100644 core/theme/modern.js diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index 3d4d7c0e6f2..9a52ca26359 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -165,14 +165,16 @@ goog.addDependency('../../core/renderers/zelos/measurables/row_elements.js', ['B goog.addDependency('../../core/renderers/zelos/measurables/rows.js', ['Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.TopRow', 'Blockly.utils.object']); goog.addDependency('../../core/renderers/zelos/path_object.js', ['Blockly.zelos.PathObject'], ['Blockly.blockRendering.PathObject', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider']); goog.addDependency('../../core/renderers/zelos/renderer.js', ['Blockly.zelos.Renderer'], ['Blockly.InsertionMarkerManager', 'Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.connectionTypes', 'Blockly.constants', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.MarkerSvg', 'Blockly.zelos.PathObject', 'Blockly.zelos.RenderInfo']); -goog.addDependency('../../core/requires.js', ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.ContextMenuItems', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldLabelSerializable', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.HorizontalFlyout', 'Blockly.Mutator', 'Blockly.ShortcutItems', 'Blockly.Themes.Classic', 'Blockly.Themes.Deuteranopia', 'Blockly.Themes.HighContrast', 'Blockly.Themes.Tritanopia', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.VerticalFlyout', 'Blockly.Warning', 'Blockly.ZoomControls', 'Blockly.geras.Renderer', 'Blockly.thrasos.Renderer', 'Blockly.zelos.Renderer']); +goog.addDependency('../../core/requires.js', ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.ContextMenuItems', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldLabelSerializable', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.HorizontalFlyout', 'Blockly.Mutator', 'Blockly.ShortcutItems', 'Blockly.Themes.Classic', 'Blockly.Themes.Dark', 'Blockly.Themes.Deuteranopia', 'Blockly.Themes.HighContrast', 'Blockly.Themes.Tritanopia', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.VerticalFlyout', 'Blockly.Warning', 'Blockly.ZoomControls', 'Blockly.geras.Renderer', 'Blockly.thrasos.Renderer', 'Blockly.zelos.Renderer']); goog.addDependency('../../core/scrollbar.js', ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['Blockly.Events', 'Blockly.Touch', 'Blockly.browserEvents', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Metrics', 'Blockly.utils.Svg', 'Blockly.utils.dom']); goog.addDependency('../../core/shortcut_items.js', ['Blockly.ShortcutItems'], ['Blockly.Gesture', 'Blockly.ShortcutRegistry', 'Blockly.utils.KeyCodes']); goog.addDependency('../../core/shortcut_registry.js', ['Blockly.ShortcutRegistry'], ['Blockly.utils.KeyCodes', 'Blockly.utils.object']); goog.addDependency('../../core/theme.js', ['Blockly.Theme'], ['Blockly.registry', 'Blockly.utils', 'Blockly.utils.object']); goog.addDependency('../../core/theme/classic.js', ['Blockly.Themes.Classic'], ['Blockly.Theme']); +goog.addDependency('../../core/theme/dark.js', ['Blockly.Themes.Dark'], ['Blockly.Theme']); goog.addDependency('../../core/theme/deuteranopia.js', ['Blockly.Themes.Deuteranopia'], ['Blockly.Theme']); goog.addDependency('../../core/theme/highcontrast.js', ['Blockly.Themes.HighContrast'], ['Blockly.Theme']); +goog.addDependency('../../core/theme/modern.js', ['Blockly.Themes.Modern'], ['Blockly.Theme']); goog.addDependency('../../core/theme/tritanopia.js', ['Blockly.Themes.Tritanopia'], ['Blockly.Theme']); goog.addDependency('../../core/theme/zelos.js', ['Blockly.Themes.Zelos'], ['Blockly.Theme']); goog.addDependency('../../core/theme_manager.js', ['Blockly.ThemeManager'], ['Blockly.Theme']); diff --git a/core/requires.js b/core/requires.js index 009ab3f9cf7..f08286ec4dd 100644 --- a/core/requires.js +++ b/core/requires.js @@ -82,6 +82,8 @@ goog.require('Blockly.zelos.Renderer'); // Blockly Themes. // Classic is the default theme. goog.require('Blockly.Themes.Classic'); +goog.require('Blockly.Themes.Dark'); goog.require('Blockly.Themes.Deuteranopia'); goog.require('Blockly.Themes.HighContrast'); goog.require('Blockly.Themes.Tritanopia'); +// goog.require('Blockly.Themes.Modern'); diff --git a/core/theme/dark.js b/core/theme/dark.js new file mode 100644 index 00000000000..398497660da --- /dev/null +++ b/core/theme/dark.js @@ -0,0 +1,33 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Dark theme. + * @author samelh@google.com (Sam El-Husseini) + */ +'use strict'; + +goog.provide('Blockly.Themes.Dark'); + +goog.require('Blockly.Theme'); + +Blockly.Themes.Dark = Blockly.Theme.defineTheme('dark', { + 'base': Blockly.Themes.Classic, + 'componentStyles': { + 'workspaceBackgroundColour': '#1e1e1e', + 'toolboxBackgroundColour': 'blackBackground', + 'toolboxForegroundColour': '#fff', + 'flyoutBackgroundColour': '#252526', + 'flyoutForegroundColour': '#ccc', + 'flyoutOpacity': 1, + 'scrollbarColour': '#797979', + 'insertionMarkerColour': '#fff', + 'insertionMarkerOpacity': 0.3, + 'scrollbarOpacity': 0.4, + 'cursorColour': '#d0d0d0', + 'blackBackground': '#333' + } +}); diff --git a/core/theme/modern.js b/core/theme/modern.js new file mode 100644 index 00000000000..2ed8a68456f --- /dev/null +++ b/core/theme/modern.js @@ -0,0 +1,108 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Modern theme. + * Same colours as classic, but single coloured border. + */ +'use strict'; + +goog.provide('Blockly.Themes.Modern'); + +goog.require('Blockly.Theme'); + + +// Temporary holding object. +Blockly.Themes.Modern = {}; + +Blockly.Themes.Modern.defaultBlockStyles = { + "colour_blocks": { + "colourPrimary": "#a5745b", + "colourSecondary": "#dbc7bd", + "colourTertiary": "#845d49" + }, + "list_blocks": { + "colourPrimary": "#745ba5", + "colourSecondary": "#c7bddb", + "colourTertiary": "#5d4984" + }, + "logic_blocks": { + "colourPrimary": "#5b80a5", + "colourSecondary": "#bdccdb", + "colourTertiary": "#496684" + }, + "loop_blocks": { + "colourPrimary": "#5ba55b", + "colourSecondary": "#bddbbd", + "colourTertiary": "#498449" + }, + "math_blocks": { + "colourPrimary": "#5b67a5", + "colourSecondary": "#bdc2db", + "colourTertiary": "#495284" + }, + "procedure_blocks": { + "colourPrimary": "#995ba5", + "colourSecondary": "#d6bddb", + "colourTertiary": "#7a4984" + }, + "text_blocks": { + "colourPrimary": "#5ba58c", + "colourSecondary": "#bddbd1", + "colourTertiary": "#498470" + }, + "variable_blocks": { + "colourPrimary": "#a55b99", + "colourSecondary": "#dbbdd6", + "colourTertiary": "#84497a" + }, + "variable_dynamic_blocks": { + "colourPrimary": "#a55b99", + "colourSecondary": "#dbbdd6", + "colourTertiary": "#84497a" + }, + "hat_blocks": { + "colourPrimary": "#a55b99", + "colourSecondary": "#dbbdd6", + "colourTertiary": "#84497a", + "hat": "cap" + } +}; + +Blockly.Themes.Modern.categoryStyles = { + "colour_category": { + "colour": "#a5745b" + }, + "list_category": { + "colour": "#745ba5" + }, + "logic_category": { + "colour": "#5b80a5" + }, + "loop_category": { + "colour": "#5ba55b" + }, + "math_category": { + "colour": "#5b67a5" + }, + "procedure_category": { + "colour": "#995ba5" + }, + "text_category": { + "colour": "#5ba58c" + }, + "variable_category": { + "colour": "#a55b99" + }, + "variable_dynamic_category": { + "colour": "#a55b99" + } +}; + +// This style is still being fleshed out and may change. +Blockly.Themes.Modern = + new Blockly.Theme('modern', Blockly.Themes.Modern.defaultBlockStyles, + Blockly.Themes.Modern.categoryStyles); diff --git a/package-lock.json b/package-lock.json index 964aa9cdc87..d2f40ff1fc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -241,12 +241,6 @@ } } }, - "@blockly/theme-dark": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@blockly/theme-dark/-/theme-dark-1.0.7.tgz", - "integrity": "sha512-ohZRlrbKnRtzp63mDh/9XRFnTnnpyG110ff2UjGYmEuBcWeazgY1aISufrPbOANnPDfVV5SZI9DQnNvXjdmP9w==", - "dev": true - }, "@blockly/theme-modern": { "version": "2.1.17", "resolved": "https://registry.npmjs.org/@blockly/theme-modern/-/theme-modern-2.1.17.tgz", diff --git a/package.json b/package.json index f0cb527730e..3df16bb0a93 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "devDependencies": { "@blockly/block-test": "^1.0.0", "@blockly/dev-tools": "^2.0.1", - "@blockly/theme-dark": "^1.0.0", "@blockly/theme-modern": "^2.1.1", "@wdio/selenium-standalone-service": "^6.11.0", "babel-eslint": "^10.1.0", diff --git a/scripts/gulpfiles/appengine_tasks.js b/scripts/gulpfiles/appengine_tasks.js index e07b9f60fd7..08fb3ea85ed 100644 --- a/scripts/gulpfiles/appengine_tasks.js +++ b/scripts/gulpfiles/appengine_tasks.js @@ -59,7 +59,6 @@ function copyAppengineSrc() { function copyPlaygroundDeps() { const playgroundDeps = [ './node_modules/@blockly/dev-tools/dist/index.js', - './node_modules/@blockly/theme-dark/dist/index.js', './node_modules/@blockly/theme-modern/dist/index.js', './node_modules/@blockly/block-test/dist/index.js', ]; diff --git a/tests/playgrounds/advanced_playground.html b/tests/playgrounds/advanced_playground.html index 87e1f37e2f6..b142a6a0090 100644 --- a/tests/playgrounds/advanced_playground.html +++ b/tests/playgrounds/advanced_playground.html @@ -67,7 +67,6 @@ -