30 |
31 | );
32 | }
33 |
34 | export default ClickableBox;
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 |
--------------------------------------------------------------------------------
/playgrounds/dflex-dnd-playground/src/components/todo/TodoListWithEvents.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | import DFlexDnDComponent from "../DFlexDnDComponent";
4 |
5 | const TodoListWithEvents = () => {
6 | const tasks = [
7 | { id: "mtg", msg: "Meet with Laura" },
8 | { id: "org", msg: "Organize weekly meetup" },
9 |
10 | { id: "gym", msg: "Hit the gym" },
11 | ];
12 |
13 | return (
14 |
35 | );
36 | };
37 |
38 | export default TodoListWithEvents;
39 |
--------------------------------------------------------------------------------
/playgrounds/dflex-vue-playground/src/components/icons/IconCommunity.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/playgrounds/dflex-next-playground/src/pages/list/asymmetric.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react/no-array-index-key */
2 | import React from "react";
3 | import { TodoItem, TodoContainer } from "../../components";
4 |
5 | const AsymmetricPage = () => {
6 | const tasks = [
7 | {
8 | id: "async-meeting-laura",
9 | task: "Meet with Laura",
10 | style: { height: "3rem" },
11 | },
12 | {
13 | id: "async-weekly-meetup",
14 | task: "Organize the weekly meetup",
15 | style: { height: "6rem" },
16 | },
17 | {
18 | id: "async-project-work",
19 | task: "Work on the project",
20 | style: { height: "4rem" },
21 | },
22 | {
23 | id: "async-gym-session",
24 | task: "Go to the gym",
25 | style: { height: "3.5rem" },
26 | },
27 | ];
28 |
29 | return (
30 |
31 | {tasks.map(({ task, id }) => (
32 |
33 | {task}
34 |
35 | ))}
36 |
37 | );
38 | };
39 |
40 | export default AsymmetricPage;
41 |
--------------------------------------------------------------------------------
/packages/dflex-dnd/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-core-instance/src/Element/DFlexElement.ts:
--------------------------------------------------------------------------------
1 | import type { Axis, AxesPoint } from "@dflex/utils";
2 | import DFlexCoreNode from "./DFlexCoreElement";
3 |
4 | // TODO: Remove this class and depend entirely on Box/Rect classes instead.
5 | class DFlexElement extends DFlexCoreNode {
6 | static getDistance(
7 | currentPosition: AxesPoint,
8 | elm: DFlexElement,
9 | axis: Axis,
10 | ) {
11 | let diff = currentPosition[axis] - elm.rect[axis === "x" ? "left" : "top"];
12 |
13 | diff += elm.translate![axis];
14 |
15 | return diff;
16 | }
17 |
18 | static getDisplacement(
19 | currentPosition: AxesPoint,
20 | elm: DFlexElement,
21 | axis: Axis,
22 | ) {
23 | const diff = axis === "x" ? elm.rect.right : elm.rect.bottom;
24 |
25 | return currentPosition[axis] - diff;
26 | }
27 |
28 | getDisplacement(elm: this, axis: Axis): number {
29 | return DFlexElement.getDisplacement(this.rect.getPosition(), elm, axis);
30 | }
31 |
32 | getDistance(elm: this, axis: Axis): number {
33 | return DFlexElement.getDistance(this.rect.getPosition(), elm, axis);
34 | }
35 | }
36 |
37 | export default DFlexElement;
38 |
--------------------------------------------------------------------------------
/packages/dflex-dom-gen/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-store/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-utils/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-core-instance/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-draggable/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-utils/src/types.ts:
--------------------------------------------------------------------------------
1 | export interface Dimensions {
2 | height: number;
3 | width: number;
4 | }
5 |
6 | export type Direction = 1 | -1;
7 |
8 | /** Single Axis. */
9 | export type Axis = "x" | "y";
10 |
11 | /** Bi-directional Axis. */
12 | export type Axes = Axis | "z";
13 |
14 | export const BOTH_AXIS: readonly Axis[] = Object.freeze(["x", "y"]);
15 |
16 | export type CubicBezier =
17 | | "ease"
18 | | "ease-in"
19 | | "ease-out"
20 | | "ease-in-out"
21 | | "linear";
22 |
23 | export type AnimationOpts = {
24 | /**
25 | * The easing function to use for the animation.
26 | * Specifies the speed curve of the animation.
27 | * Example values: 'linear', 'ease-in', 'ease-out', 'ease-in-out'.
28 | * (Default: 'ease-in')
29 | */
30 | easing: CubicBezier;
31 |
32 | /**
33 | * The duration of the animation in milliseconds.
34 | * Specifies how long the animation should take to complete.
35 | * (Default: 'dynamic')
36 | */
37 | duration: number | "dynamic";
38 | } | null;
39 |
40 | export type CSSStyle = Record;
41 |
42 | export type CSSClass = string;
43 |
44 | export type CSS = CSSClass | CSSStyle;
45 |
--------------------------------------------------------------------------------
/playgrounds/dflex-dnd-playground/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022, Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-dnd/src/DnD.ts:
--------------------------------------------------------------------------------
1 | import type { AxesPoint } from "@dflex/utils";
2 |
3 | import DraggableInteractive from "./Draggable";
4 | import Mechanism from "./Mechanism";
5 | import { store } from "./LayoutManager";
6 |
7 | import type { DFlexDnDOpts, FinalDndOpts } from "./types";
8 |
9 | import { extractOpts } from "./utils/extractOpts";
10 | import { defaultOpts } from "./utils/constants";
11 |
12 | class DnD extends Mechanism {
13 | /**
14 | *
15 | * @param id -
16 | * @param initCoordinates -
17 | * @param opts -
18 | */
19 | constructor(
20 | id: string,
21 | initCoordinates: AxesPoint,
22 | opts: DFlexDnDOpts = defaultOpts,
23 | ) {
24 | if (__DEV__) {
25 | if (!store.registry.has(id)) {
26 | throw new Error(`DFlex: ${id} is not registered in the Store.`);
27 | }
28 | }
29 |
30 | const options = extractOpts(opts);
31 |
32 | if (__DEV__) {
33 | Object.freeze(options);
34 | }
35 |
36 | const draggable = new DraggableInteractive(
37 | id,
38 | initCoordinates,
39 | options as FinalDndOpts,
40 | );
41 |
42 | super(draggable);
43 | }
44 | }
45 |
46 | export default DnD;
47 |
--------------------------------------------------------------------------------
/playgrounds/dflex-draggable-playground/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019-2020 Jalal Maskoun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/packages/dflex-dnd/src/Listeners/types.ts:
--------------------------------------------------------------------------------
1 | import { DFLEX_LISTENERS_CAT, LAYOUT_STATES } from "./constants";
2 |
3 | export type LayoutState = (typeof LAYOUT_STATES)[keyof typeof LAYOUT_STATES];
4 |
5 | type PayloadMutation = {
6 | /**
7 | * Represents the container where the element is now located after the
8 | * mutation.
9 | * */
10 | target: HTMLElement;
11 |
12 | /**
13 | * Contains an ordered list of IDs representing the committed elements.
14 | * These IDs are listed in the sequence in which the elements were committed.
15 | */
16 | ids: string[];
17 | };
18 |
19 | export type DFlexLayoutStateNotification = {
20 | type: typeof DFLEX_LISTENERS_CAT.LAYOUT_CAT;
21 |
22 | /** The current status of the layout. */
23 | status: LayoutState;
24 | };
25 |
26 | export type DFlexMutationNotification = {
27 | type: typeof DFLEX_LISTENERS_CAT.MUTATION_CAT;
28 | payload: PayloadMutation;
29 | };
30 |
31 | export type DFlexErrorNotification = {
32 | type: typeof DFLEX_LISTENERS_CAT.ERROR_CAT;
33 | error: unknown;
34 | };
35 |
36 | export type DFlexListenerNotifications =
37 | | DFlexLayoutStateNotification
38 | | DFlexMutationNotification
39 | | DFlexErrorNotification;
40 |
--------------------------------------------------------------------------------
/packages/dflex-dnd/src/Listeners/constants.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Layout State:
3 | * - 'pending': when DnD is initiated but not activated yet.
4 | */
5 | const PENDING = "pending";
6 |
7 | /**
8 | * Layout State:
9 | * - 'ready': When clicking over the registered element. The element is ready but not being dragged.
10 | */
11 | const READY = "ready";
12 |
13 | /**
14 | * Layout State:
15 | * - 'dragging': as expected.
16 | */
17 | const DRAGGING = "dragging";
18 |
19 | /**
20 | * Layout State:
21 | * - 'dragEnd': as expected.
22 | */
23 | const DRAG_END = "dragEnd";
24 |
25 | /**
26 | * Layout State:
27 | * - 'dragCancel': When releasing the drag without settling in the new position.
28 | */
29 | const DRAG_CANCEL = "dragCancel";
30 |
31 | const LAYOUT_STATES = {
32 | PENDING,
33 | READY,
34 | DRAGGING,
35 | DRAG_END,
36 | DRAG_CANCEL,
37 | } as const;
38 |
39 | const LAYOUT_CAT = "layoutState";
40 | const MUTATION_CAT = "mutation";
41 | const ERROR_CAT = "error";
42 |
43 | const DFLEX_LISTENERS_CAT = {
44 | LAYOUT_CAT,
45 | MUTATION_CAT,
46 | ERROR_CAT,
47 | } as const;
48 |
49 | const { freeze } = Object;
50 |
51 | freeze(LAYOUT_STATES);
52 | freeze(DFLEX_LISTENERS_CAT);
53 |
54 | export { LAYOUT_STATES, DFLEX_LISTENERS_CAT };
55 |
--------------------------------------------------------------------------------
/playgrounds/dflex-vue-playground/src/components/icons/IconDocumentation.vue:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/jest.config.ts:
--------------------------------------------------------------------------------
1 | import type { JestConfigWithTsJest } from "ts-jest";
2 |
3 | const tsJestConfig: JestConfigWithTsJest = {
4 | clearMocks: true,
5 | moduleFileExtensions: ["js", "ts", "tsx", "json"],
6 | globals: {
7 | fakeTimers: { enableGlobally: true },
8 | __DEV__: true,
9 | // https://github.com/testing-library/react-testing-library/issues/1061#issuecomment-1117450890
10 | IS_REACT_ACT_ENVIRONMENT: true,
11 | },
12 | moduleNameMapper: {
13 | "^./dist/(.+)": "./src/$1",
14 | "^@dflex/utils$": "/packages/dflex-utils/src/index.ts",
15 | "^@dflex/dom-gen$": "/packages/dflex-dom-gen/src/index.ts",
16 | "^@dflex/core-instance$":
17 | "/packages/dflex-core-instance/src/index.ts",
18 | "^@dflex/store$": "/packages/dflex-store/src/index.ts",
19 | "^@dflex/draggable$": "/packages/dflex-draggable/src/index.ts",
20 | "^@dflex/dnd$": "/packages/dflex-dnd/src/index.ts",
21 | },
22 | testEnvironment: "jsdom",
23 | testPathIgnorePatterns: ["cypress"],
24 | transform: {
25 | "^.+\\.(ts|tsx)?$": [
26 | "ts-jest",
27 | {
28 | tsconfig: "tsconfig.test.json",
29 | },
30 | ],
31 | },
32 | testMatch: ["**/test/**/*.test{.ts,.tsx,.js,.jsx}"],
33 | };
34 |
35 | export default tsJestConfig;
36 |
--------------------------------------------------------------------------------
/playgrounds/dflex-vue-playground/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dflex-vue-playground",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vite",
7 | "build": "run-p type-check \"build-only {@}\" --",
8 | "preview": "vite preview",
9 | "build-only": "vite build",
10 | "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
11 | "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
12 | "format": "prettier --write src/"
13 | },
14 | "dependencies": {
15 | "@dflex/dnd": "workspace:^3.9.9",
16 | "vue": "^3.3.7",
17 | "vue-router": "^4.2.5"
18 | },
19 | "devDependencies": {
20 | "@rushstack/eslint-patch": "^1.5.1",
21 | "@tsconfig/node18": "^18.2.2",
22 | "@types/node": "^20.8.10",
23 | "@vitejs/plugin-vue": "^4.4.0",
24 | "@vitejs/plugin-vue-jsx": "^3.0.2",
25 | "@vue/eslint-config-prettier": "^8.0.0",
26 | "@vue/eslint-config-typescript": "^12.0.0",
27 | "@vue/tsconfig": "^0.4.0",
28 | "eslint": "^8.52.0",
29 | "eslint-plugin-vue": "^9.18.1",
30 | "npm-run-all2": "^6.1.1",
31 | "prettier": "^3.0.3",
32 | "typescript": "~5.2.2",
33 | "vite": "^4.5.0",
34 | "vite-plugin-replace": "^0.1.1",
35 | "vue-tsc": "^1.8.22"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/scripts/dflex-bundle-types/index.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 |
3 | /* eslint-disable no-console */
4 |
5 | import { rollup as _rollup } from "rollup";
6 | import { resolve, join } from "path";
7 | import packages from "npm-packages";
8 | import { dts } from "rollup-plugin-dts";
9 |
10 | /**
11 | * @param {"es" |"cjs"} format
12 | * @param {string} inputFile
13 | * @param {string} outputFile
14 | */
15 | async function build(format, inputFile, outputFile) {
16 | const inputOptions = {
17 | input: inputFile,
18 | plugins: [dts({ tsconfig: resolve("./tsconfig.json") })],
19 | };
20 |
21 | const result = await _rollup(inputOptions);
22 |
23 | await result.write({
24 | externalLiveBindings: false,
25 | format,
26 | exports: "auto",
27 | file: outputFile,
28 | freeze: false,
29 | interop: undefined,
30 | });
31 | }
32 |
33 | const buildPromise = packages.map((pkg) => {
34 | const { sourcePath, typesPath, modules } = pkg;
35 |
36 | const { sourceFileName, format } = modules[1];
37 |
38 | const inputFile = resolve(join(sourcePath, sourceFileName));
39 |
40 | const outputFile = resolve(join(typesPath, "index.d.ts"));
41 |
42 | return build(format, inputFile, outputFile);
43 | });
44 |
45 | Promise.all(buildPromise)
46 | .then()
47 | .catch((e) => {
48 | console.error(e);
49 | });
50 |
--------------------------------------------------------------------------------
/playgrounds/dflex-dnd-playground/src/components/todo/TodoList.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | // import type { LayoutStateEvent } from "@dflex/dnd";
3 |
4 | import DFlexDnDComponent from "../DFlexDnDComponent";
5 |
6 | const TodoListWithEvents = () => {
7 | const tasks = [
8 | { id: "mtg", msg: "Meet with Laura", style: { height: "3rem" } },
9 | { id: "org", msg: "Organize weekly meetup", style: { height: "6.5rem" } },
10 | {
11 | id: "proj",
12 | msg: "Continue working on the project",
13 | style: { height: "5rem" },
14 | },
15 | { id: "gym", msg: "Hit the gym", style: { height: "4.5rem" } },
16 | ];
17 |
18 | return (
19 |
43 |
44 | # @dflex/store
45 |
46 | DFlex DOM store is an internal DFlex package.
47 |
48 | ## Documentation 📖
49 |
50 | For documentation, more information about DFlex and a live demo, be sure to visit the DFlex website
51 |
52 | ## License 🤝
53 |
54 | DFlex is [MIT License](LICENSE).
55 |
--------------------------------------------------------------------------------
/packages/dflex-utils/README.md:
--------------------------------------------------------------------------------
1 |