Skip to content

Commit

Permalink
fix: export ensureMonacoIsLoaded util
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Feb 13, 2024
1 parent c0145ef commit c615a1f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @tokens-studio/token-configurator

## 0.0.9

### Patch Changes

- Export ensureMonacoIsLoaded util for easier use of replaceSource util, which doesn't work very well if Monaco isn't loaded.

## 0.0.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokens-studio/configurator",
"version": "0.0.8",
"version": "0.0.9",
"description": "Online IDE for configuring Style-Dictionary",
"license": "MIT",
"author": "Tokens Studio (https://tokens.studio)",
Expand Down
26 changes: 15 additions & 11 deletions src/configurator-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class ConfiguratorElement extends LitElement {
constructor() {
super();
this.preventInit = false;
this.hasInitialized = false;
}

firstUpdated() {
Expand Down Expand Up @@ -121,18 +122,21 @@ export class ConfiguratorElement extends LitElement {
}

async init() {
await setupEditorChangeHandlers();
await sdState.loadSDFunctions();
await sdState.runStyleDictionary();

await openAllFolders();
const fileTreeEl = await getFileTreeEl();
if (fileTreeEl.outputFiles.length > 0) {
await fileTreeEl.switchToFile(fileTreeEl.outputFiles[0]);
if (!this.hasInitialized) {
await setupEditorChangeHandlers();
await sdState.loadSDFunctions();
await sdState.runStyleDictionary();

await openAllFolders();
const fileTreeEl = await getFileTreeEl();
if (fileTreeEl.outputFiles.length > 0) {
await fileTreeEl.switchToFile(fileTreeEl.outputFiles[0]);
}
await switchToFile(findUsedConfigPath(), editorConfig);

resizeMonacoLayout();
this.hasInitialized = true;
}
await switchToFile(findUsedConfigPath(), editorConfig);

resizeMonacoLayout();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export {
replaceSource,
openAllFolders,
} from "./utils/file-tree.js";
export { resizeMonacoLayout } from "./monaco/monaco.js";
export { resizeMonacoLayout, ensureMonacoIsLoaded } from "./monaco/monaco.js";
export * from "./constants.js";

0 comments on commit c615a1f

Please sign in to comment.