Skip to content

Commit

Permalink
[v1.7.10] Merge pull request #285 from bridge-core/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Joelant05 authored Oct 23, 2020
2 parents 5b999ee + bbedeb2 commit 2b683df
Show file tree
Hide file tree
Showing 68 changed files with 10,760 additions and 7,446 deletions.
2 changes: 1 addition & 1 deletion app/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export default new Vue({
vuetify,
store,
template: '<App/>',
}).$mount('#app')
}).$mount('#app')
5 changes: 4 additions & 1 deletion app/renderer/src/TabSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ class TabSystem {
}
}
setCurrentUnsaved() {
if (!this.getSelected().is_unsaved) {
if (
!this.getSelected().is_unsaved &&
!this.getSelected().is_immutable
) {
this.getSelected().is_unsaved = true
EventBus.trigger('updateSelectedTabUI')
}
Expand Down
10 changes: 7 additions & 3 deletions app/renderer/src/UI/ContextMenu/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const FILE_CONTEXT_MENU = async (
icon: 'mdi-arrow-split-vertical',
action: () => {
TabSystem.split_screen_active = true
FileSystem.open(file_path)
FileSystem.open(file_path, isImmutable)
},
}

Expand Down Expand Up @@ -132,8 +132,12 @@ export const FILE_CONTEXT_MENU = async (
* QUICK ACTION TO TOGGLE CLIENT SCRIPTS
*/
if (fileName === 'manifest.json') {
if (Manifest.getPackFolder(file_path) === 'development_behavior_packs') {
let manifest: Manifest = await readJSON(file_path).catch(console.error)
if (
Manifest.getPackFolder(file_path) === 'development_behavior_packs'
) {
let manifest: Manifest = await readJSON(file_path).catch(
console.error
)
if (Manifest.hasClientData(manifest)) {
DEFAULT_MENU.push({
title: 'Remove Client Scripts',
Expand Down
27 changes: 21 additions & 6 deletions app/renderer/src/UI/Editor/JsonEditor/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
<span v-if="render_object.children.length > 0">
<draggable
v-model="render_object.children"
v-bind="{ group: 'key', disabled: disabled_dragging }"
v-bind="{
group: {
name: 'key',
pull: this.is_immutable ? 'clone' : undefined,
put: !this.is_immutable,
},
sort: !this.is_immutable,
disabled: disabled_dragging,
}"
@change="draggedKey"
:clone="cloneDragged"
>
<details
v-for="e in render_object.children"
Expand Down Expand Up @@ -229,10 +238,7 @@ export default {
return this.render_object.data
},
disabled_dragging() {
return (
this.$store.state.Settings.disable_node_dragging ||
this.is_immutable
)
return this.$store.state.Settings.disable_node_dragging
},
},
methods: {
Expand Down Expand Up @@ -321,7 +327,13 @@ export default {
}, 5)
},
draggedKey(data) {
TabSystem.setCurrentUnsaved()
if (!this.is_active)
this.$nextTick(() => {
TabSystem.split_screen_active = !TabSystem.split_screen_active
TabSystem.setCurrentUnsaved()
TabSystem.split_screen_active = !TabSystem.split_screen_active
})
else TabSystem.setCurrentUnsaved()
if ('removed' in data) {
TabSystem.getHistory().add(
Expand All @@ -340,6 +352,9 @@ export default {
)
}
},
cloneDragged(jsontree) {
return jsontree.deepClone()
},
isKnownFileType() {
return FileType.get() !== 'unknown'
Expand Down
1 change: 1 addition & 0 deletions app/renderer/src/UI/Windows/Renderer/WindowContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
hide-no-data
style="max-width: 99%;"
dense
:disabled="content.is_disabled"
:menu-props="{ maxHeight: 162 }"
:label="content.text"
:items="content.options"
Expand Down
5 changes: 4 additions & 1 deletion app/renderer/src/autoCompletions/TextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default class TextProvider {
'TextProvider needs either a filePath or a startState'
)

let path = FileType.transformTextSeparators(line, filePath).split(/\s+/)
let path = FileType.transformTextSeparators(
line.replace(/\//g, ''),
filePath
).split(/\s+/)
path.pop()
let strPath = path.join('/')

Expand Down
46 changes: 37 additions & 9 deletions app/renderer/src/editor/Themes/ThemeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import EventBus from '../../EventBus'
import ProjectConfig from '../../Project/Config'
import Store from '../../../store/index'
import fs from 'fs'
import fs, { readFileSync } from 'fs'
import deepmerge from 'deepmerge'
import { defineMonacoTheme } from './Monaco'
import { createErrorNotification } from '../../AppCycle/Errors'
Expand Down Expand Up @@ -51,6 +51,14 @@ function getDefaultThemes() {
const { id, ...theme } = readJSONSync(
path.join(__static, `themes/${f}`)
)
if (theme?.options?.css) {
ThemeManager.css.set(
theme?.options?.css,
readFileSync(
path.join(__static, `styles/${theme?.options?.css}`)
).toString('utf-8')
)
}
res[id] = theme
})

Expand Down Expand Up @@ -90,10 +98,11 @@ export default class ThemeManager {
static get local_theme_names() {
let theme_names = []
for (let id in this.themes) {
theme_names.push({
text: this.themes[id]?.name ?? 'Unknown',
value: id,
})
if (!this.themes[id].isHidden)
theme_names.push({
text: this.themes[id]?.name ?? 'Unknown',
value: id,
})
}
for (let id in this.plugin_themes) {
theme_names.push({
Expand All @@ -112,10 +121,11 @@ export default class ThemeManager {
static get global_theme_names() {
let theme_names = []
for (let id in this.themes) {
theme_names.push({
text: this.themes[id]?.name ?? 'Unknown',
value: id,
})
if (!this.themes[id].isHidden)
theme_names.push({
text: this.themes[id]?.name ?? 'Unknown',
value: id,
})
}
for (let id in this.plugin_themes_global) {
theme_names.push({
Expand Down Expand Up @@ -155,6 +165,19 @@ export default class ThemeManager {
}
}

private static isHalloween() {
const today = new Date(Date.now())
const halloween = new Date(today.getUTCFullYear(), 9, 31)

return (
halloween.getMonth() === today.getMonth() &&
halloween.getDate() === today.getDate()
)
}
static lockThemeSettings() {
return this.isHalloween()
}

static applyTheme(id = 'bridge.default.theme') {
this.current_theme = id
const theme =
Expand Down Expand Up @@ -205,6 +228,11 @@ export default class ThemeManager {
this.global_theme = this.global_theme
? this.global_theme
: Store.state.Settings.global_theme

//Halloween easter egg
if (this.isHalloween())
return this.applyTheme('bridge.easterEgg.halloween')

try {
// Regardless of what theme is chosen, save what the local theme is for the settings menu to reference
this.local_theme = await ProjectConfig.theme
Expand Down
6 changes: 4 additions & 2 deletions app/renderer/src/plugins/PluginLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ export default class PluginLoader {
disposables
)
),
this.loadThemeCSS(pluginPath, disposables).then(() =>
this.loadThemes(pluginPath, disposables)
),
this.loadSnippets(pluginPath, disposables),
this.loadThemes(pluginPath, disposables),
this.loadComponents(
path.join(pluginPath, 'components'),
disposables
),
this.loadAutoCompletions(pluginPath, disposables),
this.loadFileDefs(pluginPath, disposables),
this.loadThemeCSS(pluginPath, disposables),

loadCustomCommands(
path.join(pluginPath, 'commands'),
disposables
Expand Down
15 changes: 15 additions & 0 deletions app/renderer/src/plugins/scripts/modules/toolbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createAppMenu, IAppMenuElement } from '../../../UI/Toolbar/create'
import { IModuleConfig } from '../types'

export const ToolbarModule = ({ disposables }: IModuleConfig) => ({
createCategory(config: {
displayName: string
displayIcon?: string
onClick?: () => void
elements?: IAppMenuElement[]
}) {
const toolbar = createAppMenu(config)
disposables.push(toolbar)
return toolbar
},
})
2 changes: 2 additions & 0 deletions app/renderer/src/plugins/scripts/require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { PathModule } from './modules/path'
import { FetchDefinitionModule } from './modules/fetchDefinition'
import { WindowModule } from './modules/windows'
import { GlobalsModule } from './modules/globals'
import { ToolbarModule } from './modules/toolbar'

const BuiltInModules = new Map<string, (config: IModuleConfig) => unknown>([
['@bridge/ui', UIModule],
Expand All @@ -25,6 +26,7 @@ const BuiltInModules = new Map<string, (config: IModuleConfig) => unknown>([
['@bridge/file-importer', ImportFileModule],
['@bridge/fetch-definition', FetchDefinitionModule],
['@bridge/windows', WindowModule],
['@bridge/toolbar', ToolbarModule],
])
//For usage inside of custom commands, components etc.
const LimitedModules = new Map<string, (config: IModuleConfig) => unknown>([
Expand Down
10 changes: 5 additions & 5 deletions app/renderer/windows/CreateFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,18 @@ export default class CreateFileWindow extends ContentWindow {
FILE_DATA = FileType.getFileCreators()
.filter(({ is_hidden }) => !is_hidden)
.sort(({ title: t1 }, { title: t2 }) => t1.localeCompare(t2))
FILE_DATA = FILE_DATA.filter(
({ target_version }) =>
target_version === undefined || compileCondition(target_version)
)

super({
display_name: 'New File',
options: {
is_visible: false,
is_persistent: false,
},
sidebar: FILE_DATA.filter(
({ target_version }) =>
target_version === undefined ||
compileCondition(target_version)
).map(({ icon, title, rp_definition }, index) => {
sidebar: FILE_DATA.map(({ icon, title, rp_definition }, index) => {
return {
icon,
title,
Expand Down
2 changes: 2 additions & 0 deletions app/renderer/windows/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export default class SettingsWindow extends TabWindow {
key: uuid(),
type: 'autocomplete',
is_box: true,
is_disabled: ThemeManager.lockThemeSettings(),
color: 'primary',
text: 'None',
input: ThemeManager.local_theme,
Expand All @@ -469,6 +470,7 @@ export default class SettingsWindow extends TabWindow {
key: `settings.editor.tab.appearance.global_theme`,
type: 'autocomplete',
is_box: true,
is_disabled: ThemeManager.lockThemeSettings(),
color: 'primary',
text: 'Choose a global theme...',
input: this.data.global_theme,
Expand Down
2 changes: 1 addition & 1 deletion app/shared/app_version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Current bridge. app version
*/
export default 'v1.7.9'
export default 'v1.7.10'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "1.7.9",
"version": "1.7.10",
"author": "solvedDev <[email protected]>",
"description": "A powerful add-on editor",
"license": "GNU",
Expand Down
2 changes: 1 addition & 1 deletion static/highlighter/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"define": {
"keywords": ["minecraft", "description", "components", "bridge", "permutations", "events"],
"titles": ["format_version"],
"symbols": ["properties"]
"symbols": ["properties", "sequence", "randomize"]
}
}
2 changes: 1 addition & 1 deletion static/highlighter/fog.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"set": {},
"define": {
"keywords": ["minecraft", "description", "distance"],
"keywords": ["minecraft", "description", "distance", "volumetric"],
"titles": ["format_version"],
"symbols": []
}
Expand Down
2 changes: 1 addition & 1 deletion static/highlighter/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"define": {
"keywords": ["minecraft", "description", "components", "bridge", "events"],
"titles": ["format_version"],
"symbols": []
"symbols": ["sequence", "randomize"]
}
}
Empty file removed static/styles/.gitkeep
Empty file.
14 changes: 14 additions & 0 deletions static/styles/halloween.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.v-system-bar > img {
filter: hue-rotate(160deg) saturate(1.6);
}

.file-displayer
.v-icon:not(.mdi-folder):not(.mdi-folder-open):not(.mdi-folder-lock) {
color: var(--v-primary-base);
}

.file-displayer .v-icon.mdi-folder,
.v-icon.mdi-folder-open,
.v-icon.mdi-folder-lock {
color: var(--v-success-lighten1);
}
Loading

0 comments on commit 2b683df

Please sign in to comment.