Skip to content

Commit

Permalink
#4887: move document builder to page editor
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Jun 16, 2024
1 parent 0a7796d commit beb7a51
Show file tree
Hide file tree
Showing 83 changed files with 163 additions and 163 deletions.
4 changes: 2 additions & 2 deletions src/analysis/analysisVisitors/varAnalysis/varAnalysis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import { SELF_EXISTENCE, VarExistence } from "./varMap";
import TryExcept from "@/bricks/transformers/controlFlow/TryExcept";
import ForEachElement from "@/bricks/transformers/controlFlow/ForEachElement";
import { DocumentRenderer } from "@/bricks/renderers/document";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import {
type ButtonDocumentElement,
type DocumentElement,
type ListDocumentElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { type Schema } from "@/types/schemaTypes";
import { services } from "@/background/messenger/api";
import { modMetadataFactory } from "@/testUtils/factories/modComponentFactories";
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/analysisVisitors/varAnalysis/varAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import blockRegistry, { type TypedBrickMap } from "@/bricks/registry";
import {
isDocumentElementArray,
type ListDocumentElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { ADAPTERS } from "@/pageEditor/starterBricks/adapter";
import { fromJS } from "@/starterBricks/factory";
import { type Schema } from "@/types/schemaTypes";
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/PipelineExpressionVisitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { DocumentRenderer } from "@/bricks/renderers/document";
import { type BrickPosition, type BrickPipeline } from "@/bricks/types";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import { type Expression } from "@/types/runtimeTypes";
import { PIPELINE_BLOCKS_FIELD_NAME } from "@/pageEditor/consts";
import PipelineExpressionVisitor from "./PipelineExpressionVisitor";
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/PipelineExpressionVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import PipelineVisitor, {
import {
isDocumentElementArray,
type DocumentElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { isExpression, isPipelineExpression } from "@/utils/expressionUtils";
import { joinPathParts } from "@/utils/formUtils";
import { BusinessError } from "@/errors/businessErrors";
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/PipelineVisitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { DocumentRenderer } from "@/bricks/renderers/document";
import ForEach from "@/bricks/transformers/controlFlow/ForEach";
import { type BrickPosition, type BrickConfig } from "@/bricks/types";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import { PIPELINE_BLOCKS_FIELD_NAME } from "@/pageEditor/consts";
import { type PipelineExpression } from "@/types/runtimeTypes";
import PipelineVisitor, { type VisitBlockExtra } from "./PipelineVisitor";
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/renderers/document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { type Schema } from "@/types/schemaTypes";
import {
DOCUMENT_ELEMENT_TYPES,
type DocumentElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import IsolatedComponent from "@/components/IsolatedComponent";
import { type DocumentViewProps } from "./documentView/DocumentViewProps";

Expand Down
4 changes: 2 additions & 2 deletions src/bricks/renderers/documentView/DocumentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import "@/vendors/bootstrapWithoutRem.css";
import "@/sidebar/sidebarBootstrapOverrides.scss";
import { buildDocumentBranch } from "@/components/documentBuilder/documentTree";
import { buildDocumentBranch } from "@/pageEditor/documentBuilder/documentTree";
import React from "react";
import { type DocumentViewProps } from "./DocumentViewProps";
import DocumentContext from "@/components/documentBuilder/render/DocumentContext";
import DocumentContext from "@/pageEditor/documentBuilder/render/DocumentContext";
import { Stylesheets } from "@/components/Stylesheets";
import { joinPathParts } from "@/utils/formUtils";
import StylesheetsContext, {
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/renderers/documentView/DocumentViewProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { type SubmitPanelAction } from "@/bricks/errors";
import { type BrickArgsContext, type BrickOptions } from "@/types/runtimeTypes";
import { type UUID } from "@/types/stringTypes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { type ModComponentFormState } from "@/pageEditor/starterBricks/formState
import { validateRegistryId, validateUUID } from "@/types/helpers";
import { selectIntegrationDependencyVariables } from "./integrationDependencyFieldUtils";
import { emptyPermissionsFactory } from "@/permissions/permissionsUtils";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { type ListDocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import { type ListDocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";

import { uuidSequence } from "@/testUtils/factories/stringFactories";
import { formStateFactory } from "@/testUtils/factories/pageEditorFactories";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { type SchemaFieldProps } from "@/components/fields/schemaFields/propType
import cx from "classnames";
import styles from "./HeadingStyleWidget.module.scss";
import { useField } from "formik";
import { VALID_HEADER_TAGS } from "@/components/documentBuilder/allowedElementTypes";
import { VALID_HEADER_TAGS } from "@/pageEditor/documentBuilder/allowedElementTypes";

const HeadingStyleWidget: React.FunctionComponent<SchemaFieldProps> = (
props,
Expand Down
2 changes: 1 addition & 1 deletion src/contrib/editors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import DatabaseGetOptions, {
import DatabasePutOptions, {
DATABASE_PUT_ID,
} from "@/pageEditor/fields/DatabasePutOptions";
import DocumentOptions from "@/components/documentBuilder/edit/DocumentOptions";
import DocumentOptions from "@/pageEditor/documentBuilder/edit/DocumentOptions";
import RemoteMethodOptions, {
REMOTE_METHOD_ID,
} from "@/pageEditor/fields/RemoteMethodOptions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from "./documentBuilderTypes";
import DocumentContext, {
initialValue,
} from "@/components/documentBuilder/render/DocumentContext";
} from "@/pageEditor/documentBuilder/render/DocumentContext";
import { toExpression } from "@/utils/expressionUtils";

// Mock the recordX trace methods. Otherwise, they'll fail and Jest will have unhandled rejection errors since we call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import React, { type ElementType } from "react";
import BlockElement from "@/components/documentBuilder/render/BlockElement";
import BlockElement from "@/pageEditor/documentBuilder/render/BlockElement";
import { get } from "lodash";
import { Col, Container, Row, Image } from "react-bootstrap";
import {
Expand All @@ -27,18 +27,18 @@ import {
type DynamicPath,
type PipelineDocumentConfig,
} from "./documentBuilderTypes";
import ButtonElement from "@/components/documentBuilder/render/ButtonElement";
import ListElement from "@/components/documentBuilder/render/ListElement";
import ButtonElement from "@/pageEditor/documentBuilder/render/ButtonElement";
import ListElement from "@/pageEditor/documentBuilder/render/ListElement";
import { BusinessError } from "@/errors/businessErrors";
import Markdown from "@/components/Markdown";
import CardElement from "./render/CardElement";
import { VALID_HEADER_TAGS } from "@/components/documentBuilder/allowedElementTypes";
import { VALID_HEADER_TAGS } from "@/pageEditor/documentBuilder/allowedElementTypes";
import { isExpression, isPipelineExpression } from "@/utils/expressionUtils";
import { boolean } from "@/utils/typeUtils";
import { joinPathParts } from "@/utils/formUtils";
import Icon from "@/icons/Icon";
import cx from "classnames";
import styles from "@/components/documentBuilder/preview/documentTree.module.scss";
import styles from "@/pageEditor/documentBuilder/preview/documentTree.module.scss";

// Legacy header components, where each header type was a separate element
const HEADER_COMPONENTS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import React, { useMemo } from "react";
import SchemaField from "@/components/fields/schemaFields/SchemaField";
import getElementEditSchemas from "@/components/documentBuilder/edit/getElementEditSchemas";
import getElementEditSchemas from "@/pageEditor/documentBuilder/edit/getElementEditSchemas";
import PipelineOptions from "./PipelineOptions";

type ButtonOptionsProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

import React from "react";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import registerDefaultWidgets from "@/components/fields/schemaFields/widgets/registerDefaultWidgets";
import userEvent from "@testing-library/user-event";
import { type ModComponentFormState } from "@/pageEditor/starterBricks/formStateTypes";
Expand All @@ -36,7 +36,7 @@ import { integrationDependencyFactory } from "@/testUtils/factories/integrationF
import { validateOutputKey } from "@/runtime/runtimeTypes";
import { toExpression } from "@/utils/expressionUtils";
import { within } from "@testing-library/react";
import DocumentOptions from "@/components/documentBuilder/edit/DocumentOptions";
import DocumentOptions from "@/pageEditor/documentBuilder/edit/DocumentOptions";

beforeAll(() => {
registerDefaultWidgets();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import React from "react";
import { useField } from "formik";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import ConfigErrorBoundary from "@/pageEditor/fields/ConfigErrorBoundary";
import { joinName } from "@/utils/formUtils";
import useAsyncEffect from "use-async-effect";
import { useSelector } from "react-redux";
import { selectNodePreviewActiveElement } from "@/pageEditor/slices/editorSelectors";
import ElementEditor from "@/components/documentBuilder/edit/ElementEditor";
import ElementEditor from "@/pageEditor/documentBuilder/edit/ElementEditor";
import ConnectedCollapsibleFieldSection from "@/pageEditor/fields/ConnectedCollapsibleFieldSection";
import SchemaField from "@/components/fields/schemaFields/SchemaField";
import { DOCUMENT_SCHEMA } from "@/bricks/renderers/document";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import { useField } from "formik";
import React from "react";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import RemoveElement from "./RemoveElement";
import MoveElement from "./MoveElement";
import elementTypeLabels from "@/components/documentBuilder/elementTypeLabels";
import useElementOptions from "@/components/documentBuilder/edit/useElementOptions";
import elementTypeLabels from "@/pageEditor/documentBuilder/elementTypeLabels";
import useElementOptions from "@/pageEditor/documentBuilder/edit/useElementOptions";
import { useSelector } from "react-redux";
import { selectNodePreviewActiveElement } from "@/pageEditor/slices/editorSelectors";
import { getProperty } from "@/utils/objectUtils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import ConnectedFieldTemplate from "@/components/form/ConnectedFieldTemplate";
import KeyNameWidget from "@/components/form/widgets/KeyNameWidget";
import FieldTemplate from "@/components/form/FieldTemplate";
import SelectWidget from "@/components/form/widgets/SelectWidget";
import { getAllowedChildTypes } from "@/components/documentBuilder/allowedElementTypes";
import elementTypeLabels from "@/components/documentBuilder/elementTypeLabels";
import { getAllowedChildTypes } from "@/pageEditor/documentBuilder/allowedElementTypes";
import elementTypeLabels from "@/pageEditor/documentBuilder/elementTypeLabels";
import { type SchemaFieldProps } from "@/components/fields/schemaFields/propTypes";
import SchemaField from "@/components/fields/schemaFields/SchemaField";
import {
type DocumentElementType,
type ListDocumentElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { produce } from "immer";
import { createNewElement } from "@/components/documentBuilder/createNewElement";
import { createNewElement } from "@/pageEditor/documentBuilder/createNewElement";
import { useField } from "formik";
import { joinName } from "@/utils/formUtils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import React from "react";
import FieldTemplate from "@/components/form/FieldTemplate";
import LayoutWidget from "@/components/LayoutWidget";
import useMoveWithinParent from "@/components/documentBuilder/hooks/useMoveWithinParent";
import useMoveWithinParent from "@/pageEditor/documentBuilder/hooks/useMoveWithinParent";

type MoveElementProps = {
documentBodyName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import React from "react";
import { Button } from "react-bootstrap";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faTrash } from "@fortawesome/free-solid-svg-icons";
import useDeleteElement from "@/components/documentBuilder/hooks/useDeleteElement";
import useDeleteElement from "@/pageEditor/documentBuilder/hooks/useDeleteElement";
import { selectNodePreviewActiveElement } from "@/pageEditor/slices/editorSelectors";
import { useSelector } from "react-redux";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import getElementCollectionName from "@/components/documentBuilder/edit/getElementCollectionName";
import getElementCollectionName from "@/pageEditor/documentBuilder/edit/getElementCollectionName";

test("returns collection name for an element", () => {
const elementName = "body.0.children.3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import { type SchemaFieldProps } from "@/components/fields/schemaFields/propTypes";
import { type DocumentElementType } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElementType } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import React from "react";
import { VALID_HEADER_TAGS } from "@/components/documentBuilder/allowedElementTypes";
import { VALID_HEADER_TAGS } from "@/pageEditor/documentBuilder/allowedElementTypes";
import { joinName } from "@/utils/formUtils";
import { type UiSchema } from "@/types/schemaTypes";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import {
isButtonElement,
isListElement,
isPipelineElement,
} from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/documentBuilderTypes";
import React, { useMemo } from "react";
import ListOptions from "@/components/documentBuilder/edit/ListOptions";
import ListOptions from "@/pageEditor/documentBuilder/edit/ListOptions";
import SchemaField from "@/components/fields/schemaFields/SchemaField";
import getElementEditSchemas from "@/components/documentBuilder/edit/getElementEditSchemas";
import PipelineOptions from "@/components/documentBuilder/edit/PipelineOptions";
import ButtonOptions from "@/components/documentBuilder/edit/ButtonOptions";
import getElementEditSchemas from "@/pageEditor/documentBuilder/edit/getElementEditSchemas";
import PipelineOptions from "@/pageEditor/documentBuilder/edit/PipelineOptions";
import ButtonOptions from "@/pageEditor/documentBuilder/edit/ButtonOptions";

const useElementOptions = (
element: DocumentElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { type DocumentElementType } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElementType } from "@/pageEditor/documentBuilder/documentBuilderTypes";

const elementTypeLabels: Record<DocumentElementType, string> = {
header: "Header",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { getIn, useFormikContext } from "formik";
import { type ModComponentFormState } from "@/pageEditor/starterBricks/formStateTypes";
import getElementCollectionName from "@/components/documentBuilder/edit/getElementCollectionName";
import getElementCollectionName from "@/pageEditor/documentBuilder/edit/getElementCollectionName";
import { produce } from "immer";
import { produceExcludeUnusedDependencies } from "@/components/fields/schemaFields/integrations/integrationDependencyFieldUtils";
import { useCallback } from "react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import {
arrayMove,
moveElement,
} from "@/components/documentBuilder/hooks/useMoveElement";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
} from "@/pageEditor/documentBuilder/hooks/useMoveElement";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import { toExpression } from "@/utils/expressionUtils";

const data = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import {
type TreeDestinationPosition,
type TreeSourcePosition,
} from "@atlaskit/tree";
import { produce } from "immer";
import { getIn, useField } from "formik";
import { getAllowedChildTypes } from "@/components/documentBuilder/allowedElementTypes";
import { getAllowedChildTypes } from "@/pageEditor/documentBuilder/allowedElementTypes";
import { useCallback } from "react";
import useReduxState from "@/hooks/useReduxState";
import { selectNodePreviewActiveElement } from "@/pageEditor/slices/editorSelectors";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import useReduxState from "@/hooks/useReduxState";
import { selectNodePreviewActiveElement } from "@/pageEditor/slices/editorSelectors";
import { actions } from "@/pageEditor/slices/editorSlice";
import { useField } from "formik";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import getElementCollectionName from "@/components/documentBuilder/edit/getElementCollectionName";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import getElementCollectionName from "@/pageEditor/documentBuilder/edit/getElementCollectionName";

import { joinPathParts } from "@/utils/formUtils";
import { assertNotNullish } from "@/utils/nullishUtils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { useField } from "formik";
import React, { useCallback, useMemo, useState } from "react";
import { type DocumentElement } from "@/components/documentBuilder/documentBuilderTypes";
import { type DocumentElement } from "@/pageEditor/documentBuilder/documentBuilderTypes";
import Tree, {
type ItemId,
type RenderItemParams,
Expand All @@ -29,12 +29,12 @@ import { type RootState } from "@/pageEditor/pageEditorTypes";
import { selectNodeDataPanelTabState } from "@/pageEditor/slices/editorSelectors";
import { DataPanelTabKey } from "@/pageEditor/tabs/editTab/dataPanel/dataPanelTypes";
import { actions } from "@/pageEditor/slices/editorSlice";
import { selectTreeData } from "@/components/documentBuilder/outline/outlineHelpers";
import { selectTreeData } from "@/pageEditor/documentBuilder/outline/outlineHelpers";
import OutlineItem, {
LEVEL_PADDING_PX,
} from "@/components/documentBuilder/outline/OutlineItem";
import useMoveElement from "@/components/documentBuilder/hooks/useMoveElement";
import useDeleteElement from "@/components/documentBuilder/hooks/useDeleteElement";
} from "@/pageEditor/documentBuilder/outline/OutlineItem";
import useMoveElement from "@/pageEditor/documentBuilder/hooks/useMoveElement";
import useDeleteElement from "@/pageEditor/documentBuilder/hooks/useDeleteElement";

type DocumentOutlineProps = {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import React from "react";
import { type ComponentMeta, type ComponentStory } from "@storybook/react";
import OutlineItem from "@/components/documentBuilder/outline/OutlineItem";
import OutlineItem from "@/pageEditor/documentBuilder/outline/OutlineItem";
import { action } from "@storybook/addon-actions";
import {
DragDropContext,
Expand Down
Loading

0 comments on commit beb7a51

Please sign in to comment.