Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use named exports in playground #978

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/form-js-playground/src/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { PlaygroundRoot } from './components/PlaygroundRoot';
/**
* @param {FormPlaygroundOptions} options
*/
export default function Playground(options) {
export function Playground(options) {
vsgoulart marked this conversation as resolved.
Show resolved Hide resolved

const {
container: parent,
Expand Down
5 changes: 2 additions & 3 deletions packages/form-js-playground/src/components/JSONEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { EditorState, Compartment } from '@codemirror/state';
import { lintGutter, linter } from '@codemirror/lint';
import { json, jsonParseLinter } from '@codemirror/lang-json';
import { indentWithTab } from '@codemirror/commands';

import autocompletion from './autocompletion/index';
import { autocompletionExtension } from './autocompletion/index';
import { variablesFacet } from './autocompletion/VariablesFacet';

import {
Expand Down Expand Up @@ -70,7 +69,7 @@ export function JSONEditor(options = {}) {
placeholderLinterExtension,
lintGutter(),
autocompletionConf.of(variablesFacet.of(variables)),
autocompletion(),
autocompletionExtension(),
keymap.of([ indentWithTab ]),
editorPlaceholder ? placeholder(editorPlaceholder) : [],
...extensions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { autocompletion } from '@codemirror/autocomplete';
import { variablesFacet } from './VariablesFacet';

import { syntaxTree } from '@codemirror/language';

import { variablesFacet } from './VariablesFacet';

export default function() {
export function autocompletionExtension() {
return [
autocompletion({
override: [
Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-playground/src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as Playground } from './Playground';
export { Playground } from './Playground';
2 changes: 1 addition & 1 deletion packages/form-js-playground/test/custom/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Step(props) {
}


export default {
export const CustomPropertiesProviderModule = {
__init__: [ 'customPropertiesProvider' ],
customPropertiesProvider: [ 'type', CustomPropertiesProvider ]
};
Expand Down
3 changes: 1 addition & 2 deletions packages/form-js-playground/test/custom/viewer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import {
Errors,
FormContext,
Expand Down Expand Up @@ -93,7 +92,7 @@ class CustomFormFields {
}
}

export default {
export const CustomFormFieldsModule = {
__init__: [ 'customFormFields' ],
customFormFields: [ 'type', CustomFormFields ]
};
Expand Down
8 changes: 4 additions & 4 deletions packages/form-js-playground/test/spec/Playground.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import otherSchema from './other-form.json';
import rowsSchema from './rows-form.json';
import customSchema from './custom.json';

import customViewerModule from '../custom/viewer';
import customEditorModule from '../custom/editor';
import { CustomFormFieldsModule } from '../custom/viewer';
import { CustomPropertiesProviderModule } from '../custom/editor';
import customStyles from '../custom/styles.css';

import {
Expand Down Expand Up @@ -152,10 +152,10 @@ describe('playground', function() {
schema: customSchema,
data,
additionalModules: [
customViewerModule
CustomFormFieldsModule
],
editorAdditionalModules: [
customEditorModule
CustomPropertiesProviderModule
]
});

Expand Down
Loading