-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release' of github.com:appsmithorg/appsmith into release
- Loading branch information
Showing
29 changed files
with
679 additions
and
435 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["../../.eslintrc.base.json"], | ||
"ignorePatterns": ["build"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coverage-summary.json | ||
build/ | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
transform: { | ||
"^.+\\.(png|js|ts|tsx)$": "ts-jest", | ||
}, | ||
verbose: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@shared/dsl", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"author": "", | ||
"license": "ISC", | ||
"scripts": { | ||
"test:unit": "jest -b --colors --no-cache --silent --coverage --collectCoverage=true --coverageDirectory='./' --coverageReporters='json-summary'", | ||
"test:jest": "jest --watch", | ||
"lint": "yarn g:lint", | ||
"prettier": "yarn g:prettier", | ||
"build": "rollup -c", | ||
"start": "rollup -c", | ||
"postinstall": "yarn build" | ||
}, | ||
"main": "build/index.js", | ||
"module": "build/index.es.js", | ||
"types": "build/index.d.ts", | ||
"files": [ | ||
"build" | ||
], | ||
"publishConfig": { | ||
"directory": "build" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.21.0", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@types/escodegen": "^0.0.7", | ||
"@types/lodash": "^4.14.120", | ||
"normalizr": "^3.6.2", | ||
"rollup": "^2.77.0", | ||
"rollup-plugin-generate-package-json": "^3.2.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-typescript2": "^0.32.0", | ||
"typescript": "4.5.5" | ||
}, | ||
"devDependencies": { | ||
"jest": "^29.5.0", | ||
"ts-jest": "^29.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import typescript from "rollup-plugin-typescript2"; | ||
import generatePackageJson from "rollup-plugin-generate-package-json"; | ||
|
||
const packageJson = require("./package.json"); | ||
|
||
export default { | ||
// TODO: Figure out regex where each directory can be a separate module without having to manually add them | ||
input: ["./src/index.ts"], | ||
output: [ | ||
{ | ||
file: packageJson.module, | ||
format: "esm", | ||
sourcemap: true, | ||
}, | ||
{ | ||
file: packageJson.main, | ||
format: "cjs", | ||
sourcemap: true, | ||
}, | ||
], | ||
plugins: [ | ||
peerDepsExternal(), | ||
commonjs(), | ||
typescript({ | ||
useTsconfigDeclarationDir: true, | ||
}), | ||
generatePackageJson({ | ||
baseContents: (pkg) => ({ | ||
...pkg, | ||
main: "index.js", | ||
module: "index.es.js", | ||
types: "index.d.ts", | ||
}), | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { ROOT_CONTAINER_WIDGET_ID } from "./constants"; | ||
import type { NormalizedSchema } from "normalizr"; | ||
import { schema, normalize, denormalize } from "normalizr"; | ||
|
||
export type NestedDSLWidget<W> = W & { children?: NestedDSLWidget<W>[] }; | ||
export type NestedDSL<W> = NestedDSLWidget<W>; | ||
|
||
export type FlattenedDSLWidget<W> = W & { children?: string[] }; | ||
export type FlattenedDSL<W> = { [widgetId: string]: FlattenedDSLWidget<W> }; | ||
|
||
export type FlattenedDSLEntities<W> = { canvasWidgets: FlattenedDSL<W> }; | ||
|
||
// Schema by widgetId | ||
const SCHEMA_BY_ID = new schema.Entity( | ||
"canvasWidgets", | ||
{}, | ||
{ idAttribute: "widgetId" }, | ||
); | ||
SCHEMA_BY_ID.define({ children: [SCHEMA_BY_ID] }); | ||
|
||
// Normalising using widgetId | ||
export function flattenDSL<W>(nestedDSL: NestedDSL<W>): FlattenedDSL<W> { | ||
const { | ||
entities, | ||
}: NormalizedSchema<FlattenedDSLEntities<W>, string> = normalize( | ||
nestedDSL, | ||
SCHEMA_BY_ID, | ||
); | ||
return entities.canvasWidgets; | ||
} | ||
|
||
// Denormalising using widgetId | ||
export function nestDSL<W>( | ||
flattenedDSL: FlattenedDSL<W>, | ||
widgetId: string = ROOT_CONTAINER_WIDGET_ID, | ||
): NestedDSL<W> { | ||
const entities = { canvasWidgets: flattenedDSL }; | ||
return denormalize(widgetId, SCHEMA_BY_ID, entities); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const ROOT_CONTAINER_WIDGET_ID = "0"; | ||
export const ROOT_CONTAINER_WIDGET_NAME = "MainContainer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { nestDSL, flattenDSL } from "./DSL"; | ||
import { ROOT_CONTAINER_WIDGET_ID } from "./constants"; | ||
|
||
describe("Test #1 - Check export types & constant values", () => { | ||
it("nestDSL is a function", () => { | ||
expect(typeof nestDSL).toBe("function"); | ||
}); | ||
|
||
it("flattenDSL is a function", () => { | ||
expect(typeof flattenDSL).toBe("function"); | ||
}); | ||
|
||
it("ROOT_CONTAINER_WIDGET_ID is a string", () => { | ||
expect(typeof ROOT_CONTAINER_WIDGET_ID).toBe("string"); | ||
}); | ||
|
||
it("ROOT_CONTAINER_WIDGET_ID remains 0", () => { | ||
expect(ROOT_CONTAINER_WIDGET_ID).toBe("0"); | ||
}); | ||
}); | ||
|
||
describe("Test #2 - normalize operations on SIMPLE DSL structures", () => { | ||
const simple_dsl = { | ||
widgetId: "0", | ||
widgetName: "MainContainer", | ||
isCanvas: true, | ||
children: [ | ||
{ | ||
widgetId: "0/0", | ||
widgetName: "Text1", | ||
isCanvas: false, | ||
}, | ||
{ | ||
widgetId: "0/1", | ||
widgetName: "Container1", | ||
isCanvas: false, | ||
children: [ | ||
{ | ||
widgetId: "0/1/0", | ||
widgetName: "Canvas1", | ||
isCanvas: true, | ||
children: [ | ||
{ | ||
widgetId: "0/1/0/0", | ||
widgetName: "Button1", | ||
isCanvas: false, | ||
label: "Click me!", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
const simple_flat_dsl = { | ||
"0": { | ||
widgetId: "0", | ||
widgetName: "MainContainer", | ||
isCanvas: true, | ||
children: ["0/0", "0/1"], | ||
}, | ||
"0/0": { | ||
widgetId: "0/0", | ||
widgetName: "Text1", | ||
isCanvas: false, | ||
}, | ||
"0/1": { | ||
widgetId: "0/1", | ||
widgetName: "Container1", | ||
children: ["0/1/0"], | ||
isCanvas: false, | ||
}, | ||
"0/1/0": { | ||
widgetId: "0/1/0", | ||
widgetName: "Canvas1", | ||
isCanvas: true, | ||
children: ["0/1/0/0"], | ||
}, | ||
"0/1/0/0": { | ||
widgetId: "0/1/0/0", | ||
widgetName: "Button1", | ||
isCanvas: false, | ||
label: "Click me!", | ||
}, | ||
}; | ||
|
||
it("Test `flattenDSL` for simple_dsl", () => { | ||
const flatDSL = flattenDSL<Record<string, any>>(simple_dsl); | ||
expect(flatDSL).toStrictEqual(simple_flat_dsl); | ||
}); | ||
|
||
it("Test `nestDSL` for simple_flat_dsl", () => { | ||
const nestedDSL = nestDSL(simple_flat_dsl); | ||
expect(nestedDSL).toStrictEqual(simple_dsl); | ||
}); | ||
}); | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export { nestDSL, flattenDSL } from "./DSL"; | ||
export { ROOT_CONTAINER_WIDGET_ID } from "./constants"; | ||
|
||
export type { | ||
NestedDSLWidget, | ||
NestedDSL, | ||
FlattenedDSLWidget, | ||
FlattenedDSL, | ||
FlattenedDSLEntities, | ||
} from "./DSL"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["./src/**/*"], | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/client/src/components/editorComponents/CodeEditor/utils/deleteLine.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { getPlatformOS } from "utils/helpers"; | ||
import { KEYBOARD_SHORTCUTS_BY_PLATFORM } from "./keyboardShortcutConstants"; | ||
|
||
export const getDeleteLineShortcut = () => { | ||
const platformOS = getPlatformOS() || "default"; | ||
return KEYBOARD_SHORTCUTS_BY_PLATFORM[platformOS].deleteLine; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.