= ({ errors }) => {
10 | console.log(errors);
11 | return {JSON.stringify(errors, null, 2)}
;
12 | };
13 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/SplitPointsPropertiesSidebar.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, NumberInput } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { HeaderSidebar } from "./HeaderSidebar";
4 | import translations from "./locales.vocab";
5 |
6 | export const SplitPointsPropertiesSidebar = ({
7 | name,
8 | }: {
9 | name: `nodes.${number}`;
10 | }) => {
11 | const { t } = useTranslations(translations);
12 |
13 | return (
14 |
15 |
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/TabContainer.tsx:
--------------------------------------------------------------------------------
1 | import { css } from "@emotion/react";
2 | import { Box } from "@openpatch/patches";
3 | import { PropsWithChildren } from "react";
4 |
5 | export type TabContainerProps = PropsWithChildren<{}>;
6 |
7 | export const TabContainer = ({ children }: TabContainerProps) => {
8 | return (
9 |
26 | {children}
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./FlowEditor";
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-editor/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/flow-editor/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flow-editor/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/flow-engine/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/flow-engine
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/flow-engine
7 | # or
8 | npm i @bitflow/flow-engine
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/flow-engine/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/flow-engine/src/collect.ts:
--------------------------------------------------------------------------------
1 | import { DoTry } from "@bitflow/core";
2 |
3 | export const collectResults = (tries: DoTry[], nodeIds: string[]) => {
4 | const results: Record = {};
5 |
6 | tries.forEach((t) => {
7 | if (nodeIds.includes(t.node.id) && t.status === "finished" && t.result) {
8 | results[t.node.id] = t.result as Bitflow.TaskResult;
9 | }
10 | });
11 |
12 | return results;
13 | };
14 |
15 | export const collectAnswers = (tries: DoTry[], nodeIds: string[]) => {
16 | const answers: Record = {};
17 |
18 | tries.forEach((t) => {
19 | if (nodeIds.includes(t.node.id) && t.status === "finished" && t.answer) {
20 | answers[t.node.id] = t.answer as Bitflow.TaskAnswer;
21 | }
22 | });
23 |
24 | return answers;
25 | };
26 |
--------------------------------------------------------------------------------
/packages/flow-engine/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./collect";
2 | export * from "./distance";
3 | export * from "./next";
4 | export * from "./previous";
5 | export * from "./types";
6 |
--------------------------------------------------------------------------------
/packages/flow-engine/src/types.ts:
--------------------------------------------------------------------------------
1 | export function ensure(
2 | argument: T | undefined | null,
3 | message: string = "This value was promised to be there."
4 | ): T {
5 | if (argument === undefined || argument === null) {
6 | throw new TypeError(message);
7 | }
8 |
9 | return argument;
10 | }
11 | export type GetAnswers = (
12 | nodeIds: string[]
13 | ) => Promise>;
14 | export type GetResults = (
15 | nodeIds: string[]
16 | ) => Promise>;
17 | export type GetPoints = () => Promise;
18 |
--------------------------------------------------------------------------------
/packages/flow-engine/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/flow-engine/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flow-node/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/flow-node
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/flow-node
7 | # or
8 | npm i @bitflow/flow-node
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/flow-node/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/flow-node/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./FlowNode";
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow-node/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "number-of-persons": {
3 | "message": "Number of persons"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/packages/flow-node/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/flow-node/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flow-node/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/flow/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/flow
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/flow
7 | # or
8 | npm i @bitflow/flow
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/flow/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/flow/src/CheckpointNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 |
5 | export const CheckpointNode = (node: {
6 | data?: {
7 | count?: number;
8 | };
9 | hideHandles?: boolean;
10 | maxWidth?: FlowNodeProps["maxWidth"];
11 | }) => {
12 | const { t } = useTranslations(translations);
13 | return (
14 |
24 | );
25 | };
26 |
--------------------------------------------------------------------------------
/packages/flow/src/PortalInputNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowPortalInputNode } from "@bitflow/core";
2 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
3 | import { useTranslations } from "@vocab/react";
4 | import translations from "./locales.vocab";
5 |
6 | export const PortalInputNode = (
7 | node: Pick & {
8 | hideHandles?: boolean;
9 | maxWidth?: FlowNodeProps["maxWidth"];
10 | }
11 | ) => {
12 | const { t } = useTranslations(translations);
13 | return (
14 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/packages/flow/src/PortalOutputNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowPortalOutputNode } from "@bitflow/core";
2 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
3 | import { useTranslations } from "@vocab/react";
4 | import translations from "./locales.vocab";
5 |
6 | export const PortalOutputNode = (
7 | node: Pick & {
8 | hideHandles?: boolean;
9 | maxWidth?: FlowNodeProps["maxWidth"];
10 | }
11 | ) => {
12 | const { t } = useTranslations(translations);
13 |
14 | return (
15 |
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/packages/flow/src/SplitAnswerNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 |
5 | export const SplitAnswerNode = (node: {
6 | hideHandles?: boolean;
7 | maxWidth?: FlowNodeProps["maxWidth"];
8 | }) => {
9 | const { t } = useTranslations(translations);
10 | return (
11 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/packages/flow/src/SplitPointsNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 |
5 | export const SplitPointsNode = (node: {
6 | hideHandles?: boolean;
7 | maxWidth?: FlowNodeProps["maxWidth"];
8 | }) => {
9 | const { t } = useTranslations(translations);
10 | return (
11 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/packages/flow/src/SplitRandomNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 |
5 | export const SplitRandomNode = (node: {
6 | hideHandles?: boolean;
7 | maxWidth?: FlowNodeProps["maxWidth"];
8 | }) => {
9 | const { t } = useTranslations(translations);
10 | return (
11 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/packages/flow/src/SplitResultNode.tsx:
--------------------------------------------------------------------------------
1 | import { FlowNode, FlowNodeProps } from "@bitflow/flow-node";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 |
5 | export const SplitResultNode = (node: {
6 | hideHandles?: boolean;
7 | maxWidth?: FlowNodeProps["maxWidth"];
8 | }) => {
9 | const { t } = useTranslations(translations);
10 | return (
11 |
20 | );
21 | };
22 |
--------------------------------------------------------------------------------
/packages/flow/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./BitNode";
2 | export * from "./CheckpointNode";
3 | export * from "./Flow";
4 | export * from "./PortalInputNode";
5 | export * from "./PortalOutputNode";
6 | export * from "./SplitAnswerNode";
7 | export * from "./SplitPointsNode";
8 | export * from "./SplitRandomNode";
9 | export * from "./SplitResultNode";
10 | export * from "./Styles";
11 | export * from "./SynchronizeNode";
12 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/flow/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/flow/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/flow/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/icons/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/icons
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/icons
7 | # or
8 | npm i @bitflow/icons
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/icons/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/icons/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/icons/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/icons/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/input-markdown/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/input-markdown
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/input-markdown
7 | # or
8 | npm i @bitflow/input-markdown
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/input-markdown/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/input-markdown/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "markdown": {
6 | "message": "Markdown"
7 | },
8 | "name": {
9 | "message": "Markdown"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/input-markdown/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/input-markdown/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/input-markdown/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/mock/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/mock
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/mock
7 | # or
8 | npm i @bitflow/mock
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/mock/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/mock/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./doResult";
2 |
--------------------------------------------------------------------------------
/packages/mock/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/mock/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/mock/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/provider/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/provider
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/provider
7 | # or
8 | npm i @bitflow/provider
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/provider/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/provider/src/index.ts:
--------------------------------------------------------------------------------
1 | export { Locale } from "./context";
2 | export * from "./Provider";
3 | export * from "./useBit";
4 | export * from "./useConfig";
5 | export * from "./useFlow";
6 | export * from "./useLocale";
7 | export * from "./withProvider";
8 |
--------------------------------------------------------------------------------
/packages/provider/src/useConfig.ts:
--------------------------------------------------------------------------------
1 | import _get from "lodash.get";
2 | import { useContext } from "react";
3 | import { context, ContextProps } from "./context";
4 |
5 | export const useConfig = (
6 | key: keyof ContextProps["config"],
7 | defaultValue = null
8 | ) => {
9 | const { config } = useContext(context);
10 | return _get(config, key, defaultValue);
11 | };
12 |
--------------------------------------------------------------------------------
/packages/provider/src/useLocale.ts:
--------------------------------------------------------------------------------
1 | import { useContext } from "react";
2 | import { context, Locale } from "./context";
3 |
4 | export const useLocale = (): [Locale, (locale: Locale) => void] => {
5 | const { locale, setLocale } = useContext(context);
6 | return [locale, setLocale];
7 | };
8 |
--------------------------------------------------------------------------------
/packages/provider/src/withProvider.tsx:
--------------------------------------------------------------------------------
1 | import { WithConditionalCSSProp } from "@emotion/react/types/jsx-namespace";
2 | import { ComponentType, PropsWithChildren } from "react";
3 | import { BitflowProvider, BitflowProviderProps } from "./Provider";
4 |
5 | export const withBitflowProvider = (
6 | WrappedComponent: ComponentType
7 | ) => {
8 | // props need to be casted. See https://github.com/emotion-js/emotion/issues/2169
9 | const Wrapper = ({
10 | locale,
11 | config,
12 | bits,
13 | ...props
14 | }: BitflowProviderProps &
15 | T &
16 | WithConditionalCSSProp>) => {
17 | return (
18 |
19 | >)}
21 | />
22 |
23 | );
24 | };
25 |
26 | return Wrapper;
27 | };
28 |
--------------------------------------------------------------------------------
/packages/provider/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/provider/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/report-flow/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/report-flow
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/report-flow
7 | # or
8 | npm i @bitflow/report-flow
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/report-flow/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/report-flow/src/EndResultNode.tsx:
--------------------------------------------------------------------------------
1 | import { DoTry, FlowEndNode } from "@bitflow/core";
2 | import { FlowNode } from "@bitflow/flow-node";
3 | import { useTranslations } from "@vocab/react";
4 | import translations from "./locales.vocab";
5 | import { StatusFooter } from "./StatusFooter";
6 |
7 | export type EndResultNodeProps = {
8 | type: "end";
9 | data: FlowEndNode["data"] & {
10 | result: {
11 | status: Record;
12 | count: number;
13 | avgTime: number;
14 | avgTries: number;
15 | };
16 | };
17 | };
18 |
19 | export const EndResultNode = ({ data }: EndResultNodeProps) => {
20 | const { t } = useTranslations(translations);
21 | const status = data.result.status;
22 | return (
23 | }
28 | targetHandles={1}
29 | />
30 | );
31 | };
32 |
--------------------------------------------------------------------------------
/packages/report-flow/src/InputResultNode.tsx:
--------------------------------------------------------------------------------
1 | import { DoTry, FlowInputNode } from "@bitflow/core";
2 | import { FlowNode } from "@bitflow/flow-node";
3 | import { StatusFooter } from "./StatusFooter";
4 |
5 | export type InputResultNodeProps = {
6 | type: "input";
7 | data: FlowInputNode["data"] & {
8 | result: {
9 | status: Record;
10 | count: number;
11 | avgTime: number;
12 | avgTries: number;
13 | };
14 | };
15 | };
16 |
17 | export const InputResultNode = ({ data, type }: InputResultNodeProps) => {
18 | const status = data.result.status;
19 | return (
20 | }
27 | targetHandles={1}
28 | sourceHandles={1}
29 | />
30 | );
31 | };
32 |
--------------------------------------------------------------------------------
/packages/report-flow/src/StartResultNode.tsx:
--------------------------------------------------------------------------------
1 | import { DoTry, FlowStartNode } from "@bitflow/core";
2 | import { FlowNode } from "@bitflow/flow-node";
3 | import { useTranslations } from "@vocab/react";
4 | import translations from "./locales.vocab";
5 | import { StatusFooter } from "./StatusFooter";
6 |
7 | export type StartResultNodeProps = {
8 | type: "start";
9 | data: FlowStartNode["data"] & {
10 | result: {
11 | status: Record;
12 | avgTime: number;
13 | avgTries: number;
14 | };
15 | };
16 | };
17 |
18 | export const StartResultNode = ({ data }: StartResultNodeProps) => {
19 | const { t } = useTranslations(translations);
20 | const status = data.result.status;
21 | return (
22 | }
27 | sourceHandles={1}
28 | />
29 | );
30 | };
31 |
--------------------------------------------------------------------------------
/packages/report-flow/src/StatusFooter.tsx:
--------------------------------------------------------------------------------
1 | import { DoTry } from "@bitflow/core";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment, ReactNode } from "react";
4 | import translations from "./locales.vocab";
5 |
6 | export type StatusFooterProps = {
7 | status: Record;
8 | };
9 |
10 | export const StatusFooter = ({ status }: StatusFooterProps) => {
11 | const { t } = useTranslations(translations);
12 | const s: ReactNode[] = [];
13 | return (
14 |
15 | {status.started || 0} |
16 | {status.finished || 0} |
17 | {status.skipped || 0}
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/packages/report-flow/src/TitleResultNode.tsx:
--------------------------------------------------------------------------------
1 | import { DoTry, FlowTitleNode } from "@bitflow/core";
2 | import { FlowNode } from "@bitflow/flow-node";
3 | import { StatusFooter } from "./StatusFooter";
4 |
5 | export type TitleResultNodeProps = {
6 | type: "title";
7 | data: FlowTitleNode["data"] & {
8 | result: {
9 | status: Record;
10 | avgTime: number;
11 | avgTries: number;
12 | };
13 | };
14 | };
15 |
16 | export const TitleResultNode = ({ data, type }: TitleResultNodeProps) => {
17 | const status = data.result.status;
18 | return (
19 | }
27 | sourceHandles={1}
28 | />
29 | );
30 | };
31 |
--------------------------------------------------------------------------------
/packages/report-flow/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./ReportFlow";
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/report-flow/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "checkpoint": {
3 | "message": "Checkpoint"
4 | },
5 | "checkpoint-helper-text": {
6 | "message": "Stop students from going backwards"
7 | },
8 | "end": {
9 | "message": "End"
10 | },
11 | "end-helper-text": {
12 | "message": "The last node in your flow"
13 | },
14 | "node-finished": {
15 | "message": "Finished"
16 | },
17 | "node-skipped": {
18 | "message": "Skipped"
19 | },
20 | "node-started": {
21 | "message": "Started"
22 | },
23 | "start": {
24 | "message": "Start"
25 | },
26 | "start-helper-text": {
27 | "message": "The first node in your flow"
28 | },
29 | "synchronize": {
30 | "message": "Synchronize"
31 | },
32 | "synchronize-helper-text": {
33 | "message": "Force students to wait on your signal"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/report-flow/src/updateReportFlow.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/packages/report-flow/src/updateReportFlow.ts
--------------------------------------------------------------------------------
/packages/report-flow/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/report-flow/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/report-flow/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/shell/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/shell
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/shell
7 | # or
8 | npm i @bitflow/shell
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/shell/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/shell/src/Progress.tsx:
--------------------------------------------------------------------------------
1 | import { FC } from "react";
2 | import { Box } from "@openpatch/patches";
3 |
4 | export type ProgressProps = {
5 | value: number;
6 | max: number;
7 | };
8 |
9 | export const Progress: FC = ({ value = 0, max = 1 }) => {
10 | return (
11 |
12 |
17 |
18 | );
19 | };
20 |
--------------------------------------------------------------------------------
/packages/shell/src/TaskShell/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./TaskShell";
2 |
--------------------------------------------------------------------------------
/packages/shell/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./EndShell";
2 | export * from "./InputShell";
3 | export * from "./Shell";
4 | export * from "./StartShell";
5 | export * from "./TaskShell";
6 | export * from "./TaskShell/actions";
7 | export * from "./TitleShell";
8 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/shell/src/types.ts:
--------------------------------------------------------------------------------
1 | export interface IShell {
2 | onNext?: () => Promise;
3 | progress?: {
4 | value: number;
5 | max: number;
6 | };
7 | onClose?: () => Promise;
8 | onPrevious?: () => Promise;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/shell/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/shell/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/shell/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/start-simple/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/start-simple
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/start-simple
7 | # or
8 | npm i @bitflow/start-simple
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/start-simple/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/start-simple/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example.markdown": {
6 | "message": "This is an example. Feel free to use it as a template."
7 | },
8 | "example.title": {
9 | "message": "Welcome"
10 | },
11 | "markdown": {
12 | "message": "Markdown"
13 | },
14 | "name": {
15 | "message": "Simple"
16 | },
17 | "title": {
18 | "message": "Title"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/start-simple/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/start-simple/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/start-simple/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/stats/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/stats
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/stats
7 | # or
8 | npm i @bitflow/stats
9 | ```
--------------------------------------------------------------------------------
/packages/stats/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config")
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | }
--------------------------------------------------------------------------------
/packages/stats/src/correlation.ts:
--------------------------------------------------------------------------------
1 | import { rank } from "./rank";
2 | import { covariance, standardDeviation } from "./variability";
3 |
4 | export function pearsonsCorrelation(x: number[], y: number[]): number {
5 | const cov = covariance(x, y);
6 | const stdvX = standardDeviation(x);
7 | const stdvY = standardDeviation(y);
8 |
9 | return cov / (stdvX * stdvY);
10 | }
11 |
12 | export function spearmansCorrelation(x: number[], y: number[]): number {
13 | const rankX = rank(x);
14 | const rankY = rank(y);
15 | const cov = covariance(rankX, rankY);
16 |
17 | return cov / standardDeviation(rankX);
18 | }
19 |
--------------------------------------------------------------------------------
/packages/stats/src/cronbachsAlpha.ts:
--------------------------------------------------------------------------------
1 | import { variance } from "./variability";
2 |
3 | export const cronbachsAlpha = (values: number[][]): number => {
4 | let n = values.length;
5 | let N = values[0].length;
6 | let varSum = 0;
7 | let total: number[] = [];
8 | for (let i = 0; i < values.length; i++) {
9 | if (values[i].length !== N) {
10 | throw new Error("unmatched lengths");
11 | }
12 |
13 | const varCol = variance(values[i]);
14 | varSum += varCol;
15 |
16 | for (let p = 0; p < N; p++) {
17 | if (!total[p]) {
18 | total.push(0);
19 | }
20 | total[p] += values[i][p];
21 | }
22 | }
23 |
24 | const varTotal = variance(total);
25 |
26 | return (n / (n - 1)) * ((varTotal - varSum) / varTotal);
27 | };
28 |
--------------------------------------------------------------------------------
/packages/stats/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./correlation";
2 | export * from "./cronbachsAlpha";
3 | export * from "./max";
4 | export * from "./mean";
5 | export * from "./median";
6 | export * from "./min";
7 | export * from "./rank";
8 | export * from "./round";
9 | export * from "./summary";
10 | export * from "./table";
11 | export * from "./variability";
12 |
--------------------------------------------------------------------------------
/packages/stats/src/max.ts:
--------------------------------------------------------------------------------
1 | export const max = (x: number[]) => {
2 | return Math.max(...x);
3 | };
4 |
--------------------------------------------------------------------------------
/packages/stats/src/mean.ts:
--------------------------------------------------------------------------------
1 | export const arithmeticMean = (values: number[]): number => {
2 | const sum = values.reduce((acc, value) => acc + value, 0);
3 | return sum / values.length;
4 | };
5 |
6 | export const geometricMean = (values: number[]): number => {
7 | const prod = values.reduce((acc, value) => acc * value, 1);
8 | return Math.pow(prod, 1 / values.length);
9 | };
10 |
11 | export const harmonicMean = (values: number[]): number => {
12 | const sum = values.reduce((acc, value) => acc + 1 / value);
13 | return values.length / sum;
14 | };
15 |
--------------------------------------------------------------------------------
/packages/stats/src/median.ts:
--------------------------------------------------------------------------------
1 | export const median = (x: number[]): number => {
2 | const sorted = x.sort((a, b) => a - b);
3 | const middle = (sorted.length - 1) / 2.0;
4 | const flooredMiddle = Math.floor(middle);
5 | if (middle == flooredMiddle) {
6 | return sorted[middle];
7 | }
8 | return (sorted[flooredMiddle] + sorted[flooredMiddle + 1]) / 2.0;
9 | };
10 |
11 | export const quartile = (
12 | x: number[],
13 | quarter: "first" | "lower" | "second" | "median" | "third" | "upper"
14 | ): number => {
15 | let middle = x.length / 2.0;
16 | if (quarter === "second" || quarter === "median") {
17 | return median(x);
18 | } else if (quarter === "first" || quarter === "lower") {
19 | const lowerHalf = x.slice(0, Math.floor(middle));
20 | return median(lowerHalf);
21 | } else if (quarter === "third" || quarter === "upper") {
22 | const upperHalf = x.slice(Math.ceil(middle), x.length);
23 | return median(upperHalf);
24 | }
25 |
26 | return 0;
27 | };
28 |
--------------------------------------------------------------------------------
/packages/stats/src/min.ts:
--------------------------------------------------------------------------------
1 | export const min = (x: number[]) => {
2 | return Math.min(...x);
3 | };
4 |
--------------------------------------------------------------------------------
/packages/stats/src/rank.ts:
--------------------------------------------------------------------------------
1 | export const rank = (values: number[]): number[] => {
2 | const sorted = [...values].sort((a, b) => b - a);
3 | return values.map((x) => sorted.indexOf(x) + 1);
4 | };
5 |
--------------------------------------------------------------------------------
/packages/stats/src/round.ts:
--------------------------------------------------------------------------------
1 | export const round = (n?: number, digits = 2) =>
2 | (n
3 | ? Math.round(n * Math.pow(10, digits)) / Math.pow(10, digits)
4 | : n
5 | )?.toFixed(digits);
6 |
--------------------------------------------------------------------------------
/packages/stats/src/summary.ts:
--------------------------------------------------------------------------------
1 | import { max } from "./max";
2 | import { arithmeticMean } from "./mean";
3 | import { median, quartile } from "./median";
4 | import { min } from "./min";
5 | import { standardDeviation, variance } from "./variability";
6 |
7 | export const summary = (x: number[]) => {
8 | return {
9 | mean: arithmeticMean(x),
10 | median: median(x),
11 | max: max(x),
12 | min: min(x),
13 | lowerQuartile: quartile(x, "lower"),
14 | upperQuartile: quartile(x, "upper"),
15 | standardDeviation: standardDeviation(x),
16 | variance: variance(x),
17 | };
18 | };
19 |
--------------------------------------------------------------------------------
/packages/stats/src/variability.ts:
--------------------------------------------------------------------------------
1 | import { arithmeticMean } from "./mean";
2 |
3 | export const covariance = (x: number[], y: number[]): number => {
4 | if (x.length !== y.length) {
5 | throw new Error("unmatched lengths");
6 | }
7 |
8 | const meanX = arithmeticMean(x);
9 | const meanY = arithmeticMean(y);
10 |
11 | let sum = 0;
12 | for (let i = 0; i < x.length; i++) {
13 | const xi = x[i];
14 | const yi = y[i];
15 |
16 | sum += (xi - meanX) * (yi - meanY);
17 | }
18 |
19 | return sum / (x.length - 1);
20 | };
21 |
22 | export const variance = (values: number[]): number => {
23 | const mean = arithmeticMean(values);
24 | const sum = values.reduce((acc, value) => acc + Math.pow(value - mean, 2), 0);
25 |
26 | return sum / (values.length - 1);
27 | };
28 |
29 | export const standardDeviation = (values: number[]): number => {
30 | const v = variance(values);
31 | return Math.sqrt(v);
32 | };
33 |
--------------------------------------------------------------------------------
/packages/stats/tests/cronbachsAlpha.test.ts:
--------------------------------------------------------------------------------
1 | import { cronbachsAlpha } from "../src/cronbachsAlpha";
2 |
3 | describe("cronbachs alpha", () => {
4 | it("should calculate correctly", () => {
5 | const matrix = [
6 | [6, 5, 9, 3, 2, 1, 5],
7 | [6, 5, 8, 2, 3, 1, 4],
8 | [8, 6, 6, 4, 2, 2, 6],
9 | ];
10 | const alpha = cronbachsAlpha(matrix);
11 | expect(alpha).toBeCloseTo(0.941);
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/packages/stats/tests/mean.test.ts:
--------------------------------------------------------------------------------
1 | import { arithmeticMean } from "../src/mean";
2 |
3 | describe("mean", () => {
4 | describe("arithmetic", () => {
5 | it("should calc mean", () => {
6 | const values = [3, 4, 4, 5, 6, 8];
7 | const m = arithmeticMean(values);
8 | expect(m).toBe(5);
9 | });
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/packages/stats/tests/median.test.ts:
--------------------------------------------------------------------------------
1 | import { median, quartile } from "../src/median";
2 | describe("median", () => {
3 | it("should calculate mean for even length", () => {
4 | const v = [1, 2, 3, 4];
5 | expect(median(v)).toBe(2.5);
6 | });
7 |
8 | it("should calculate mean for odd length", () => {
9 | const v = [1, 2, 3, 4, 5];
10 | expect(median(v)).toBe(3);
11 | });
12 | it("should calculate mean for odd length", () => {
13 | const v = [6, 7, 15];
14 | expect(median(v)).toBe(7);
15 | });
16 | });
17 |
18 | describe("quartile", () => {
19 | const v = [6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49];
20 | it("should calculate 25% quartile", () => {
21 | expect(quartile(v, "first")).toBe(15);
22 | });
23 | it("should calculate 75% quartile", () => {
24 | expect(quartile(v, "third")).toBe(43);
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/packages/stats/tests/variability.test.ts:
--------------------------------------------------------------------------------
1 | import { variance } from "../src/variability";
2 |
3 | describe("variability", () => {
4 | describe("variance", () => {
5 | it("should calc variance", () => {
6 | const values = [6, 5, 9, 3, 2, 1, 5];
7 | const v = variance(values);
8 | expect(v).toBeCloseTo(7.29);
9 | });
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/packages/stats/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/stats/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-choice/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-choice
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-choice
7 | # or
8 | npm i @bitflow/task-choice
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/task-choice/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/task-choice/src/Feedback.tsx:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/packages/task-choice/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
11 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-choice/src/updateStatistic.ts:
--------------------------------------------------------------------------------
1 | import { options } from "./schemas";
2 | import { TaskBit } from "./types";
3 |
4 | export const updateStatistic: TaskBit["updateStatistic"] = ({
5 | answer,
6 | statistic,
7 | task,
8 | }) =>
9 | new Promise((resolve) => {
10 | let pattern: string = "";
11 |
12 | task.view.choices.forEach((_, i) => {
13 | const c = options[i];
14 | const checked = answer?.checked[c] || false;
15 |
16 | if (checked) {
17 | pattern += c;
18 | }
19 | });
20 |
21 | const correctPattern = task.evaluation.correct.sort().join("");
22 | pattern = pattern.split("").sort().join("");
23 |
24 | resolve({
25 | subtype: "choice",
26 | count: (statistic?.count || 0) + 1,
27 | patterns: {
28 | ...statistic?.patterns,
29 | [pattern]: {
30 | count: (statistic?.patterns?.[pattern]?.count || 0) + 1,
31 | correct: correctPattern === pattern,
32 | },
33 | },
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/packages/task-choice/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/task-choice/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-choice/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-fill-in-the-blank
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-fill-in-the-blank
7 | # or
8 | npm i @bitflow/task-fill-in-the-blank
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/Feedback.tsx:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
11 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/src/updateStatistic.ts:
--------------------------------------------------------------------------------
1 | import { TaskBit } from "./types";
2 |
3 | export const updateStatistic: TaskBit["updateStatistic"] = async ({
4 | answer,
5 | statistic,
6 | result,
7 | }) => {
8 | const blanks = statistic?.blanks || {};
9 |
10 | Object.entries(answer.blanks).forEach(([id, value]) => {
11 | let blank = blanks[id] || {};
12 | if (!blank[value]) {
13 | blank[value] = {
14 | correct: result?.blanks[id].state === "correct",
15 | count: 1,
16 | };
17 | } else {
18 | blank[value].count += 1;
19 | }
20 | blanks[id] = blank;
21 | });
22 |
23 | return {
24 | subtype: "fill-in-the-blank",
25 | count: (statistic?.count || 0) + 1,
26 | blanks,
27 | };
28 | };
29 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/tests/schemas.test.ts:
--------------------------------------------------------------------------------
1 | import { TaskSchema } from "../src/schemas";
2 | import { ITask } from "../src/types";
3 |
4 | describe("task schema", () => {
5 | it("should succeed validating", () => {
6 | const task: ITask = {
7 | subtype: "fill-in-the-blank",
8 | description: "desc",
9 | name: "name",
10 | view: {
11 | instruction: "Instruction",
12 | textWithBlanks: "~~A~~",
13 | },
14 | feedback: {
15 | blanks: {},
16 | },
17 | evaluation: {
18 | mode: "auto",
19 | blanks: {},
20 | enableRetry: false,
21 | showFeedback: false,
22 | },
23 | };
24 |
25 | const result = TaskSchema.safeParse(task);
26 |
27 | expect(result.success).toBeTruthy();
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-fill-in-the-blank/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/task-highlighting/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-highlighting
2 |
3 | ## 0.2.0
4 |
5 | ### Minor Changes
6 |
7 | - [#508](https://github.com/openpatch/bitflow/pull/508) [`5562934`](https://github.com/openpatch/bitflow/commit/556293410578338349003475ff41eb69d9f2ffdf) Thanks [@mikebarkmin](https://github.com/mikebarkmin)! - - Update dependencies
8 |
9 | # BREAKING CHANGES
10 |
11 | - React version 18 or newer is now required.
12 | - Patches version 6 or newer is now required.
13 |
14 | ### Patch Changes
15 |
16 | - Updated dependencies [[`5562934`](https://github.com/openpatch/bitflow/commit/556293410578338349003475ff41eb69d9f2ffdf)]:
17 | - @bitflow/core@0.6.0
18 |
19 | ## 0.1.0
20 |
21 | ### Minor Changes
22 |
23 | - [#458](https://github.com/openpatch/bitflow/pull/458) [`53eff4f`](https://github.com/openpatch/bitflow/commit/53eff4f711fb1c4c6b93f03a1c51b6a96b54bc87) Thanks [@mikebarkmin](https://github.com/mikebarkmin)! - Add highlighting task bit
24 |
--------------------------------------------------------------------------------
/packages/task-highlighting/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-highlighting
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-highlighting
7 | # or
8 | npm i @bitflow/task-highlighting
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/task-highlighting/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/Feedback.tsx:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/FeedbackForm.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | AutoGrid,
3 | Box,
4 | Checkbox,
5 | HookFormController,
6 | } from "@openpatch/patches";
7 | import { useTranslations } from "@vocab/react";
8 | import translations from "./locales.vocab";
9 | import { TaskBit } from "./types";
10 |
11 | export const FeedbackForm: TaskBit["FeedbackForm"] = ({ name }) => {
12 | const { t } = useTranslations(translations);
13 | return (
14 |
15 |
16 | (
21 |
22 | {t("highlight-agreement")}
23 |
24 | )}
25 | />
26 |
27 |
28 | );
29 | };
30 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
11 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-highlighting/tests/fixtures.ts:
--------------------------------------------------------------------------------
1 | import { ITask } from "../src/types";
2 |
3 | export const task: ITask = {
4 | subtype: "highlighting",
5 | name: "Example",
6 | evaluation: {
7 | enableRetry: true,
8 | mode: "auto",
9 | showFeedback: true,
10 | highlights: [],
11 | cutoffs: {
12 | blue: 0,
13 | maroon: 0,
14 | orange: 0,
15 | yellow: 0,
16 | lavender: 0,
17 | },
18 | },
19 | feedback: {
20 | highlightAgreement: false,
21 | },
22 | view: {
23 | text: "Hallo",
24 | colors: {
25 | lavender: {
26 | enabled: true,
27 | },
28 | yellow: {
29 | enabled: false,
30 | },
31 | orange: {
32 | enabled: true,
33 | },
34 | maroon: {
35 | enabled: false,
36 | },
37 | blue: {
38 | enabled: false,
39 | },
40 | },
41 | instruction: "Test",
42 | },
43 | };
44 |
--------------------------------------------------------------------------------
/packages/task-highlighting/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/task-highlighting/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-highlighting/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/task-input/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-input
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-input
7 | # or
8 | npm i @bitflow/task-input
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/task-input/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/task-input/src/EvaluationForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 | import { TaskBit } from "./types";
5 |
6 | export const EvaluationForm: TaskBit["EvaluationForm"] = ({ name }) => {
7 | const { t } = useTranslations(translations);
8 | return (
9 |
16 | );
17 | };
18 |
--------------------------------------------------------------------------------
/packages/task-input/src/Feedback.tsx:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/packages/task-input/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, MarkdownEditor } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translation from "./locales.vocab";
5 | import { TaskBit } from "./types";
6 |
7 | export const ViewForm: TaskBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translation);
9 |
10 | return (
11 |
12 | (
17 | onChange(value)}
21 | />
22 | )}
23 | />
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/packages/task-input/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
11 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-input/src/types.ts:
--------------------------------------------------------------------------------
1 | import { Action as BaseAction, TaskBit as BaseTaskBit } from "@bitflow/core";
2 | import { z } from "zod";
3 | import {
4 | AnswerSchema,
5 | ResultSchema,
6 | StatisticSchema,
7 | TaskSchema,
8 | } from "./schemas";
9 |
10 | export interface ITaskState {
11 | input: string;
12 | }
13 |
14 | export type ITask = z.infer;
15 |
16 | export type IAnswer = z.infer;
17 |
18 | export type IResult = z.infer;
19 |
20 | export type IStatistic = z.infer;
21 |
22 | export interface IChangeAction extends BaseAction {
23 | type: "change";
24 | payload: {
25 | input: string;
26 | };
27 | }
28 |
29 | export interface IAnswerAction extends BaseAction {
30 | type: "answer";
31 | payload: {
32 | answer: IAnswer;
33 | };
34 | }
35 |
36 | export type IAction = IChangeAction | IAnswerAction;
37 |
38 | export type TaskBit = BaseTaskBit;
39 |
--------------------------------------------------------------------------------
/packages/task-input/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "rootDir": "src",
5 | "declarationDir": "dist"
6 | },
7 | "include": ["src", "../../types"]
8 | }
9 |
--------------------------------------------------------------------------------
/packages/task-input/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-input/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/task-yes-no/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/task-yes-no
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-yes-no
7 | # or
8 | npm i @bitflow/task-yes-no
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/task-yes-no/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/EvaluationForm.tsx:
--------------------------------------------------------------------------------
1 | import { Box, Checkbox, HookFormController } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 | import { TaskBit } from "./types";
5 |
6 | export const EvaluationForm: TaskBit["EvaluationForm"] = ({ name }) => {
7 | const { t } = useTranslations(translations);
8 |
9 | return (
10 | (
14 |
15 |
16 | {t("yes")}
17 |
18 |
19 | )}
20 | />
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/Feedback.tsx:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { TaskBit } from "./types";
6 |
7 | export const ViewForm: TaskBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
11 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example.feedback.no": {
6 | "message": "Nein ist nicht korrekt"
7 | },
8 | "example.feedback.yes": {
9 | "message": "Ja ist korrekt"
10 | },
11 | "name": {
12 | "message": "Ja Nein"
13 | },
14 | "no": {
15 | "message": "Nein"
16 | },
17 | "question": {
18 | "message": "Frage"
19 | },
20 | "severity.error": {
21 | "message": "Fehler"
22 | },
23 | "severity.info": {
24 | "message": "Info"
25 | },
26 | "severity.success": {
27 | "message": "Erfolgreich"
28 | },
29 | "severity.warning": {
30 | "message": "Warnung"
31 | },
32 | "yes": {
33 | "message": "Ja"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example.feedback.no": {
6 | "message": "No is not correct"
7 | },
8 | "example.feedback.yes": {
9 | "message": "Yes is correct"
10 | },
11 | "name": {
12 | "message": "Yes No"
13 | },
14 | "no": {
15 | "message": "No"
16 | },
17 | "question": {
18 | "message": "Question"
19 | },
20 | "severity.error": {
21 | "message": "Error"
22 | },
23 | "severity.info": {
24 | "message": "Info"
25 | },
26 | "severity.success": {
27 | "message": "Success"
28 | },
29 | "severity.warning": {
30 | "message": "Warning"
31 | },
32 | "yes": {
33 | "message": "Yes"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/reducer.ts:
--------------------------------------------------------------------------------
1 | import { Draft, produce } from "immer";
2 | import {
3 | IAction,
4 | IAnswer,
5 | IAnswerAction,
6 | INoAction,
7 | ITaskState,
8 | IYesAction,
9 | } from "./types";
10 |
11 | export const initialState: ITaskState = {
12 | yes: false,
13 | };
14 |
15 | export const yesAction = (): IYesAction => ({
16 | type: "yes",
17 | });
18 |
19 | export const noAction = (): INoAction => ({
20 | type: "no",
21 | });
22 |
23 | export const answerAction = ({
24 | answer,
25 | }: {
26 | answer: IAnswer;
27 | }): IAnswerAction => ({
28 | type: "answer",
29 | payload: {
30 | answer,
31 | },
32 | });
33 |
34 | export const reducer = produce((draft: Draft, action: IAction) => {
35 | switch (action.type) {
36 | case "yes":
37 | draft.yes = true;
38 | break;
39 | case "no":
40 | draft.yes = false;
41 | break;
42 | case "answer":
43 | return action.payload.answer;
44 | }
45 | });
46 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/updateStatistic.ts:
--------------------------------------------------------------------------------
1 | import { TaskBit } from "./types";
2 |
3 | export const updateStatistic: TaskBit["updateStatistic"] = async ({
4 | answer,
5 | statistic,
6 | }) => {
7 | if (!statistic) {
8 | statistic = {
9 | count: 0,
10 | no: 0,
11 | yes: 0,
12 | subtype: "yes-no",
13 | };
14 | }
15 | return {
16 | ...statistic,
17 | count: statistic.count + 1,
18 | no: !answer.yes ? statistic.no + 1 : statistic.no,
19 | yes: answer.yes ? statistic.yes + 1 : statistic.yes,
20 | };
21 | };
22 |
--------------------------------------------------------------------------------
/packages/task-yes-no/src/useInformation.ts:
--------------------------------------------------------------------------------
1 | import { useTranslations } from "@vocab/react";
2 | import translations from "./locales.vocab";
3 | import { TaskBit } from "./types";
4 |
5 | export const useInformation: TaskBit["useInformation"] = () => {
6 | const { t } = useTranslations(translations);
7 |
8 | return {
9 | name: t("name"),
10 | description: t("description"),
11 | example: {
12 | subtype: "yes-no",
13 | description: "",
14 | name: t("name"),
15 | view: {
16 | question: t("question"),
17 | },
18 | evaluation: {
19 | enableRetry: true,
20 | mode: "auto",
21 | showFeedback: true,
22 | yes: true,
23 | },
24 | feedback: {
25 | no: {
26 | message: t("example.feedback.no"),
27 | severity: "error",
28 | },
29 | yes: {
30 | message: t("example.feedback.yes"),
31 | severity: "success",
32 | },
33 | },
34 | },
35 | };
36 | };
37 |
--------------------------------------------------------------------------------
/packages/task-yes-no/tests/fixtures.ts:
--------------------------------------------------------------------------------
1 | import { ITask } from "../src/types";
2 |
3 | export const task: ITask = {
4 | subtype: "yes-no",
5 | name: "Example",
6 | evaluation: {
7 | enableRetry: true,
8 | mode: "auto",
9 | showFeedback: true,
10 | yes: true,
11 | },
12 | feedback: {},
13 | view: {
14 | question: "Example Question",
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/packages/task-yes-no/tests/reducer.test.ts:
--------------------------------------------------------------------------------
1 | import {
2 | answerAction,
3 | initialState,
4 | noAction,
5 | reducer,
6 | yesAction,
7 | } from "../src/reducer";
8 |
9 | describe("reducer", () => {
10 | it("should accept yes action", () => {
11 | const newState = reducer(initialState, yesAction());
12 | expect(newState.yes).toBeTruthy();
13 | });
14 | it("should accept no action", () => {
15 | const newState = reducer(initialState, noAction());
16 | expect(newState.yes).toBeFalsy();
17 | });
18 | it("should accept answer action", () => {
19 | const newState = reducer(
20 | initialState,
21 | answerAction({
22 | answer: {
23 | subtype: "yes-no",
24 | yes: true,
25 | },
26 | })
27 | );
28 | expect(newState.yes).toBeTruthy();
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/packages/task-yes-no/tests/updateStatistic.test.ts:
--------------------------------------------------------------------------------
1 | import { updateStatistic } from "../src/updateStatistic";
2 | import { task } from "./fixtures";
3 |
4 | describe("updateStatistic", () => {
5 | it("should work without an initial statistic", async () => {
6 | const s = await updateStatistic({
7 | task,
8 | answer: { subtype: "yes-no", yes: true },
9 | });
10 | expect(s).toEqual({
11 | count: 1,
12 | no: 0,
13 | yes: 1,
14 | subtype: "yes-no",
15 | });
16 | });
17 | it("should work with an initial statistic", async () => {
18 | const s = await updateStatistic({
19 | task,
20 | answer: { subtype: "yes-no", yes: false },
21 | statistic: {
22 | count: 49,
23 | no: 30,
24 | yes: 19,
25 | subtype: "yes-no",
26 | },
27 | });
28 | expect(s).toEqual({
29 | count: 50,
30 | no: 31,
31 | yes: 19,
32 | subtype: "yes-no",
33 | });
34 | });
35 | });
36 |
--------------------------------------------------------------------------------
/packages/task-yes-no/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/task-yes-no/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/task-yes-no/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/packages/title-simple/README.md:
--------------------------------------------------------------------------------
1 | # @bitflow/title-simple
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/title-simple
7 | # or
8 | npm i @bitflow/title-simple
9 | ```
10 |
--------------------------------------------------------------------------------
/packages/title-simple/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/packages/title-simple/src/locales.vocab/translations.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example.message": {
6 | "message": "In this section you will be asked questions about **control structures**."
7 | },
8 | "example.title": {
9 | "message": "Section One"
10 | },
11 | "message": {
12 | "message": "Message"
13 | },
14 | "name": {
15 | "message": "Simple"
16 | },
17 | "title": {
18 | "message": "Title"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/title-simple/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/title-simple/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/packages/title-simple/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/end-{{ dashCase name}}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/end-{{ dashCase name }}
7 | # or
8 | npm i @bitflow/end-{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/End.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from "@openpatch/patches";
2 | import { EndBit } from "./types";
3 |
4 | export const End: EndBit["End"] = ({ end, getResult }) => (
5 | {end.view.example}
6 | );
7 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { EndBit } from "./types";
6 |
7 | export const ViewForm: EndBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./End";
2 | export * from "./schemas";
3 | export * from "./types";
4 | export * from "./useInformation";
5 | export * from "./ViewForm";
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/de.translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Beispiel"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Example"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/schemas.ts.hbs:
--------------------------------------------------------------------------------
1 | import { EndSchema as EndSchemaBase } from "@bitflow/core";
2 | import { z } from "zod";
3 |
4 | export const EndSchema = EndSchemaBase.merge(
5 | z.object({
6 | subtype: z.literal("{{ dashCase name }}"),
7 | view: z.object({
8 | example: z.string(),
9 | }),
10 | })
11 | );
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/types.ts:
--------------------------------------------------------------------------------
1 | import { EndBit as EndBitBase } from "@bitflow/core";
2 | import { z } from "zod";
3 | import { EndSchema } from "./schemas";
4 |
5 | export type IEnd = z.infer;
6 |
7 | export type EndBit = EndBitBase;
8 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/src/useInformation.ts.hbs:
--------------------------------------------------------------------------------
1 | import { useTranslations } from "@vocab/react";
2 | import translations from "./locales.vocab";
3 | import { EndBit } from "./types";
4 |
5 | export const useInformation: EndBit["useInformation"] = () => {
6 | const { t } = useTranslations(translations);
7 |
8 | return {
9 | name: t("name"),
10 | description: t("description"),
11 | example: {
12 | subtype: "{{ dashCase name }}",
13 | description: "",
14 | name: t("name"),
15 | view: {
16 | example: t("example"),
17 | },
18 | },
19 | };
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/bits/end/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/input-{{ dashCase name}}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/input-{{ dashCase name }}
7 | # or
8 | npm i @bitflow/input-{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/Input.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from "@openpatch/patches";
2 | import { InputBit } from "./types";
3 |
4 | export const Input: InputBit["Input"] = ({ input }) => (
5 | {input.view.example}
6 | );
7 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { InputBit } from "./types";
6 |
7 | export const ViewForm: InputBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./Input";
2 | export * from "./schemas";
3 | export * from "./types";
4 | export * from "./useInformation";
5 | export * from "./ViewForm";
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/de.translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Beispiel"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Example"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/schemas.ts.hbs:
--------------------------------------------------------------------------------
1 | import { InputSchema as InputSchemaBase } from "@bitflow/core";
2 | import { z } from "zod";
3 |
4 | export const InputSchema = InputSchemaBase.merge(
5 | z.object({
6 | subtype: z.literal("{{ dashCase name }}"),
7 | view: z.object({
8 | example: z.string(),
9 | }),
10 | })
11 | );
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/types.ts:
--------------------------------------------------------------------------------
1 | import { InputBit as InputBitBase } from "@bitflow/core";
2 | import { z } from "zod";
3 | import { InputSchema } from "./schemas";
4 |
5 | export type IInput = z.infer;
6 |
7 | export type InputBit = InputBitBase;
8 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/src/useInformation.ts.hbs:
--------------------------------------------------------------------------------
1 | import { useTranslations } from "@vocab/react";
2 | import translations from "./locales.vocab";
3 | import { InputBit } from "./types";
4 |
5 | export const useInformation: InputBit["useInformation"] = () => {
6 | const { t } = useTranslations(translations);
7 |
8 | return {
9 | name: t("name"),
10 | description: t("description"),
11 | example: {
12 | subtype: "{{ dashCase name }}",
13 | description: "",
14 | name: t("name"),
15 | view: {
16 | example: t("example"),
17 | },
18 | },
19 | };
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/bits/input/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/start-{{ dashCase name}}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/start-{{ dashCase name }}
7 | # or
8 | npm i @bitflow/start-{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/Start.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from "@openpatch/patches";
2 | import { StartBit } from "./types";
3 |
4 | export const Start: StartBit["Start"] = ({ start }) => (
5 | {start.view.example}
6 | );
7 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { StartBit } from "./types";
6 |
7 | export const ViewForm: StartBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./schemas";
2 | export * from "./Start";
3 | export * from "./types";
4 | export * from "./useInformation";
5 | export * from "./ViewForm";
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/de.translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Beispiel"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Example"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/schemas.ts.hbs:
--------------------------------------------------------------------------------
1 | import { StartSchema as StartSchemaBase } from "@bitflow/core";
2 | import { z } from "zod";
3 |
4 | export const StartSchema = StartSchemaBase.merge(
5 | z.object({
6 | subtype: z.literal("{{ dashCase name }}"),
7 | view: z.object({
8 | example: z.string(),
9 | }),
10 | })
11 | );
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/types.ts:
--------------------------------------------------------------------------------
1 | import { StartBit as StartBitBase } from "@bitflow/core";
2 | import { z } from "zod";
3 | import { StartSchema } from "./schemas";
4 |
5 | export type IStart = z.infer;
6 |
7 | export type StartBit = StartBitBase;
8 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/src/useInformation.ts.hbs:
--------------------------------------------------------------------------------
1 | import { useTranslations } from "@vocab/react";
2 | import translations from "./locales.vocab";
3 | import { StartBit } from "./types";
4 |
5 | export const useInformation: StartBit["useInformation"] = () => {
6 | const { t } = useTranslations(translations);
7 |
8 | return {
9 | name: t("name"),
10 | description: t("description"),
11 | example: {
12 | subtype: "{{ dashCase name }}",
13 | description: "",
14 | name: t("name"),
15 | view: {
16 | example: t("example"),
17 | },
18 | },
19 | };
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/bits/start/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/task-{{ dashCase name }}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/task-{{ dashCase name }}
7 | # or
8 | npm i @bitflow/task-{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/EvaluationForm.tsx.hbs:
--------------------------------------------------------------------------------
1 | import { Box, Checkbox, HookFormController } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import translations from "./locales.vocab";
4 | import { TaskBit } from "./types";
5 |
6 | export const EvaluationForm: TaskBit["EvaluationForm"] = ({ name }) => {
7 | const { t } = useTranslations(translations);
8 |
9 | return (
10 | (
14 |
15 |
16 | {t("yes")}
17 |
18 |
19 | )}
20 | />
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/Feedback.tsx.hbs:
--------------------------------------------------------------------------------
1 | import { FeedbackMessage } from "@bitflow/core";
2 | import { Alert } from "@openpatch/patches";
3 | import { FC } from "react";
4 |
5 | export type FeedbackProps = FeedbackMessage;
6 |
7 | export const Feedback: FC = ({ message, severity }) => {
8 | return {message};
9 | };
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/ViewForm.tsx.hbs:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { TaskBit } from "./types";
6 |
7 | export const ViewForm: TaskBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/index.ts.hbs:
--------------------------------------------------------------------------------
1 | export * from "./evaluate";
2 | export * from "./EvaluationForm";
3 | export * from "./FeedbackForm";
4 | export * from "./schemas";
5 | export * from "./Statistic";
6 | export * from "./Task";
7 | export * from "./types";
8 | export * from "./updateStatistic";
9 | export * from "./useInformation";
10 | export * from "./ViewForm";
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/de.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example.feedback.no": {
6 | "message": "No is not correct"
7 | },
8 | "example.feedback.yes": {
9 | "message": "Yes is correct"
10 | },
11 | "name": {
12 | "message": "{{ titleCase name }}"
13 | },
14 | "no": {
15 | "message": "No"
16 | },
17 | "question": {
18 | "message": "Question"
19 | },
20 | "severity.error": {
21 | "message": "Error"
22 | },
23 | "severity.info": {
24 | "message": "Info"
25 | },
26 | "severity.success": {
27 | "message": "Success"
28 | },
29 | "severity.warning": {
30 | "message": "Warning"
31 | },
32 | "yes": {
33 | "message": "Yes"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/reducer.ts.hbs:
--------------------------------------------------------------------------------
1 | import { Draft, produce } from "immer";
2 | import {
3 | IAction,
4 | IAnswer,
5 | IAnswerAction,
6 | INoAction,
7 | ITaskState,
8 | IYesAction,
9 | } from "./types";
10 |
11 | export const initialState: ITaskState = {
12 | yes: false,
13 | };
14 |
15 | export const yesAction = (): IYesAction => ({
16 | type: "yes",
17 | });
18 |
19 | export const noAction = (): INoAction => ({
20 | type: "no",
21 | });
22 |
23 | export const answerAction = ({
24 | answer,
25 | }: {
26 | answer: IAnswer;
27 | }): IAnswerAction => ({
28 | type: "answer",
29 | payload: {
30 | answer,
31 | },
32 | });
33 |
34 | export const reducer = produce((draft: Draft, action: IAction) => {
35 | switch (action.type) {
36 | case "yes":
37 | draft.yes = true;
38 | break;
39 | case "no":
40 | draft.yes = false;
41 | break;
42 | case "answer":
43 | return action.payload.answer;
44 | }
45 | });
46 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/src/updateStatistic.ts.hbs:
--------------------------------------------------------------------------------
1 | import { TaskBit } from "./types";
2 |
3 | export const updateStatistic: TaskBit["updateStatistic"] = async ({
4 | answer,
5 | statistic,
6 | }) => {
7 | if (!statistic) {
8 | statistic = {
9 | count: 0,
10 | no: 0,
11 | yes: 0,
12 | subtype: "{{ dashCase name }}",
13 | };
14 | }
15 | return {
16 | ...statistic,
17 | count: statistic.count + 1,
18 | no: !answer.yes ? statistic.no + 1 : statistic.no,
19 | yes: answer.yes ? statistic.yes + 1 : statistic.yes,
20 | };
21 | };
22 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/tests/fixtures.ts.hbs:
--------------------------------------------------------------------------------
1 | import { ITask } from "../src/types";
2 |
3 | export const task: ITask = {
4 | subtype: "{{ dashCase name }}",
5 | name: "Example",
6 | evaluation: {
7 | enableRetry: true,
8 | mode: "auto",
9 | showFeedback: true,
10 | yes: true,
11 | },
12 | feedback: {},
13 | view: {
14 | question: "Example Question",
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/tests/reducer.test.ts.hbs:
--------------------------------------------------------------------------------
1 | import {
2 | answerAction,
3 | initialState,
4 | noAction,
5 | reducer,
6 | yesAction,
7 | } from "../src/reducer";
8 |
9 | describe("reducer", () => {
10 | it("should accept yes action", () => {
11 | const newState = reducer(initialState, yesAction());
12 | expect(newState.yes).toBeTruthy();
13 | });
14 | it("should accept no action", () => {
15 | const newState = reducer(initialState, noAction());
16 | expect(newState.yes).toBeFalsy();
17 | });
18 | it("should accept answer action", () => {
19 | const newState = reducer(
20 | initialState,
21 | answerAction({
22 | answer: {
23 | subtype: "{{ dashCase name }}",
24 | yes: true,
25 | },
26 | })
27 | );
28 | expect(newState.yes).toBeTruthy();
29 | });
30 | });
31 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/bits/task/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/title-{{ dashCase name}}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/title-{{ dashCase name }}
7 | # or
8 | npm i @bitflow/title-{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/Title.tsx:
--------------------------------------------------------------------------------
1 | import { Box } from "@openpatch/patches";
2 | import { TitleBit } from "./types";
3 |
4 | export const Title: TitleBit["Title"] = ({ title }) => (
5 | {title.view.example}
6 | );
7 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/ViewForm.tsx:
--------------------------------------------------------------------------------
1 | import { HookFormController, Input } from "@openpatch/patches";
2 | import { useTranslations } from "@vocab/react";
3 | import { Fragment } from "react";
4 | import translations from "./locales.vocab";
5 | import { TitleBit } from "./types";
6 |
7 | export const ViewForm: TitleBit["ViewForm"] = ({ name }) => {
8 | const { t } = useTranslations(translations);
9 |
10 | return (
11 |
12 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./schemas";
2 | export * from "./Title";
3 | export * from "./types";
4 | export * from "./useInformation";
5 | export * from "./ViewForm";
6 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/de.translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Beispiel"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Example"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/schemas.ts.hbs:
--------------------------------------------------------------------------------
1 | import { TitleSchema as TitleSchemaBase } from "@bitflow/core";
2 | import { z } from "zod";
3 |
4 | export const TitleSchema = TitleSchemaBase.merge(
5 | z.object({
6 | subtype: z.literal("{{ dashCase name }}"),
7 | view: z.object({
8 | example: z.string(),
9 | }),
10 | })
11 | );
12 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/types.ts:
--------------------------------------------------------------------------------
1 | import { TitleBit as TitleBitBase } from "@bitflow/core";
2 | import { z } from "zod";
3 | import { TitleSchema } from "./schemas";
4 |
5 | export type ITitle = z.infer;
6 |
7 | export type TitleBit = TitleBitBase;
8 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/src/useInformation.ts.hbs:
--------------------------------------------------------------------------------
1 | import { useTranslations } from "@vocab/react";
2 | import translations from "./locales.vocab";
3 | import { TitleBit } from "./types";
4 |
5 | export const useInformation: TitleBit["useInformation"] = () => {
6 | const { t } = useTranslations(translations);
7 |
8 | return {
9 | name: t("name"),
10 | description: t("description"),
11 | example: {
12 | subtype: "{{ dashCase name }}",
13 | description: "",
14 | name: t("name"),
15 | view: {
16 | example: t("example"),
17 | },
18 | },
19 | };
20 | };
21 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/bits/title/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/component/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/{{ dashCase name}}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/{{ dashCase name }}
7 | # or
8 | npm i @bitflow/{{ dashCase name }}
9 | ```
10 |
--------------------------------------------------------------------------------
/plop-templates/component/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config");
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | };
6 |
--------------------------------------------------------------------------------
/plop-templates/component/src/index.ts.hbs:
--------------------------------------------------------------------------------
1 | export * from "./{{ properCase name }}";
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/de.translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Beispiel"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/es.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/fr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/it.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/nl.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/pt.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/tr.translations.json:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/plop-templates/component/src/locales.vocab/translations.json.hbs:
--------------------------------------------------------------------------------
1 | {
2 | "description": {
3 | "message": " "
4 | },
5 | "example": {
6 | "message": "Example"
7 | },
8 | "name": {
9 | "message": "{{ titleCase name }}"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/plop-templates/component/src/{{ properCase name }}.tsx.hbs:
--------------------------------------------------------------------------------
1 | export type {{ properCase name }}Props = {
2 |
3 | };
4 |
5 | export const {{ properCase name}} = ({}: {{ properCase name }}Props) => {
6 | return
7 | }
--------------------------------------------------------------------------------
/plop-templates/component/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/component/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/plop-templates/component/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | { name: "fr" },
10 | { name: "es" },
11 | { name: "nl" },
12 | { name: "pt" },
13 | { name: "tr" },
14 | ],
15 | };
16 |
--------------------------------------------------------------------------------
/plop-templates/package/README.md.hbs:
--------------------------------------------------------------------------------
1 | # @bitflow/{{ dashCase packageName }}
2 |
3 | ## Installation
4 |
5 | ```sh
6 | yarn add @bitflow/{{ dashCase packageName }}
7 | # or
8 | npm i @bitflow/{{ dashCase packageName }}
9 | ```
--------------------------------------------------------------------------------
/plop-templates/package/jest.config.js:
--------------------------------------------------------------------------------
1 | const baseConfig = require("../../jest.config")
2 |
3 | module.exports = {
4 | ...baseConfig,
5 | }
--------------------------------------------------------------------------------
/plop-templates/package/src/add.ts:
--------------------------------------------------------------------------------
1 | export const add = (a: number, b: number) => a + b;
2 |
--------------------------------------------------------------------------------
/plop-templates/package/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./add";
2 |
--------------------------------------------------------------------------------
/plop-templates/package/tests/add.test.ts:
--------------------------------------------------------------------------------
1 | import { add } from "../src/add";
2 |
3 | describe("add", () => {
4 | it("should return 4", () => {
5 | expect(add(2, 2)).toEqual(4);
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/plop-templates/package/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src", "../../types"],
4 | "compilerOptions": {
5 | "rootDir": "src",
6 | "declarationDir": "dist"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/plop-templates/package/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": ["src", "../../types", "stories", "tests"]
4 | }
5 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | # all packages in subdirs of packages/ and components/
3 | - 'packages/*'
4 | - 'examples/*'
5 | - 'website'
6 | # exclude packages that are inside test directories
7 | - '!**/test/**'
8 |
--------------------------------------------------------------------------------
/prettier.config.js:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["config:base", "schedule:nonOfficeHours"],
3 | "labels": ["dependencies"],
4 | "packageRules": [
5 | {
6 | "updateTypes": ["minor", "patch", "pin", "digest"],
7 | "automerge": true
8 | }
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/scripts/build.mjs:
--------------------------------------------------------------------------------
1 | import { cwd } from 'process';
2 | import { buildPackage } from "./buildPackage.mjs";
3 |
4 | const dir = cwd();
5 | buildPackage(dir);
6 |
--------------------------------------------------------------------------------
/scripts/buildAll.mjs:
--------------------------------------------------------------------------------
1 | import walk from "walkdir";
2 | import { buildPackage } from "./buildPackage";
3 |
4 | const emitter = walk("packages", {
5 | max_depth: 1,
6 | });
7 |
8 | emitter.on("directory", async (path) => {
9 | await buildPackage(path);
10 | });
11 | emitter.on("error", (err) => console.log(err));
12 |
--------------------------------------------------------------------------------
/scripts/buildBitsPackage.mjs:
--------------------------------------------------------------------------------
1 | import nodePlop from "node-plop";
2 | import { updateBitsPackage } from "./updateBitsPackage.mjs";
3 | import { join, dirname } from "path";
4 | import { fileURLToPath } from "url";
5 |
6 | const __dirname = dirname(fileURLToPath(import.meta.url));
7 | const plop = await nodePlop(join(__dirname, "..", "plopfile.mjs"));
8 |
9 | updateBitsPackage(plop)();
10 |
--------------------------------------------------------------------------------
/scripts/emotion-shim.js:
--------------------------------------------------------------------------------
1 | import { jsx } from "@emotion/react";
2 |
3 | export { jsx };
4 |
--------------------------------------------------------------------------------
/scripts/react-shim.js:
--------------------------------------------------------------------------------
1 | // react-shim.js
2 | import * as React from 'react'
3 | export { React }
4 |
--------------------------------------------------------------------------------
/supporters.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "title": "Computer Education Research Group",
4 | "subtitle": "University of Duisburg-Essen",
5 | "logo": "https://www.ddi.wiwi.uni-due.de/fileadmin/fileupload/I-DDI/ddi_de.png",
6 | "href": "https://www.ddi.wiwi.uni-due.de/en/home/"
7 | }
8 | ]
9 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.base.json",
3 | "exclude": ["node_modules", "**/*/dist"],
4 | "compilerOptions": {
5 | "emitDeclarationOnly": false,
6 | "noEmit": true
7 | },
8 | "ts-node": {
9 | "compilerOptions": {
10 | "module": "CommonJS",
11 | "resolveJsonModule": true,
12 | "noImplicitAny": false
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/types/emotion.d.ts:
--------------------------------------------------------------------------------
1 | import "@emotion/react";
2 | import { Theme as PatchesTheme } from "@openpatch/patches";
3 |
4 | declare module "@emotion/react" {
5 | export interface Theme extends PatchesTheme {}
6 | }
7 |
--------------------------------------------------------------------------------
/types/react-tagcloud.d.ts:
--------------------------------------------------------------------------------
1 | declare module "react-tagcloud" {
2 | import * as React from "react";
3 | export interface Tag {
4 | value: string;
5 | count: number;
6 | key?: string;
7 | color?: string;
8 | props?: Record;
9 | }
10 |
11 | export interface ColorOptions {
12 | hue?: string;
13 | luminosity?: "bright" | "light" | "dark";
14 | seed?: number;
15 | format?: "rgb" | "rgba" | "rgbArray" | "hsl" | "hsla" | "hslArray" | "hex";
16 | alpha?: number;
17 | }
18 |
19 | export interface TagCloudProps {
20 | tags: Tag[];
21 | maxSize: number;
22 | minSize: number;
23 | shuffle?: boolean;
24 | colorOptions?: ColorOptions;
25 | disableRandomColor?: boolean;
26 | randomSeed?: number;
27 | renderer?: (tag: Tag, size: number, color: string) => JSX.Element;
28 | }
29 |
30 | export class TagCloud extends React.Component {}
31 | }
32 |
--------------------------------------------------------------------------------
/users.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "title": "OpenPatch",
4 | "logo": "https://avatars.githubusercontent.com/u/40797438?s=200&v=4",
5 | "href": "https://openpatch.app"
6 | }
7 | ]
8 |
--------------------------------------------------------------------------------
/website/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["next/babel", "@emotion/babel-preset-css-prop"]
3 | }
4 |
--------------------------------------------------------------------------------
/website/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
3 |
4 | # dependencies
5 | /node_modules
6 | /.pnp
7 | .pnp.js
8 |
9 | # testing
10 | /coverage
11 |
12 | # next.js
13 | /.next/
14 | /out/
15 |
16 | # production
17 | /build
18 |
19 | # misc
20 | .DS_Store
21 | *.pem
22 |
23 | # debug
24 | npm-debug.log*
25 | yarn-debug.log*
26 | yarn-error.log*
27 |
28 | # local env files
29 | .env.local
30 | .env.development.local
31 | .env.test.local
32 | .env.production.local
33 |
34 | # vercel
35 | .vercel
36 |
--------------------------------------------------------------------------------
/website/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/website/next.config.js:
--------------------------------------------------------------------------------
1 | const withMDX = require("@next/mdx")({
2 | extension: /\.mdx$/,
3 | });
4 |
5 | module.exports = withMDX({
6 | pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"]
7 | });
8 |
--------------------------------------------------------------------------------
/website/public/correct.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/correct.mp3
--------------------------------------------------------------------------------
/website/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/favicon.ico
--------------------------------------------------------------------------------
/website/public/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/icon.png
--------------------------------------------------------------------------------
/website/public/icon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/website/public/manual.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/manual.mp3
--------------------------------------------------------------------------------
/website/public/unknown.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/unknown.mp3
--------------------------------------------------------------------------------
/website/public/wrong.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openpatch/bitflow/27675a21a6bf34c76f8d92e93e4066653a03c31a/website/public/wrong.mp3
--------------------------------------------------------------------------------
/website/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["config:base"],
3 | "labels": ["dependencies"],
4 | "packageRules": [
5 | {
6 | "updateTypes": ["minor", "patch", "pin", "digest"],
7 | "automerge": true,
8 | "requiredStatusChecks": null
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/website/src/components/FlowCard.tsx:
--------------------------------------------------------------------------------
1 | import { Flow as IFlow } from "@bitflow/core";
2 | import { Flow } from "@bitflow/flow";
3 | import {
4 | Box,
5 | ButtonPrimaryLink,
6 | ButtonSecondaryLink,
7 | Card,
8 | CardFooter,
9 | CardHeader,
10 | } from "@openpatch/patches";
11 |
12 | export type FlowCardProps = {
13 | flow: IFlow;
14 | id: string;
15 | };
16 |
17 | export const FlowCard = ({ flow, id }: FlowCardProps) => {
18 | return (
19 |
20 | {flow.name}
21 |
22 |
23 |
24 |
25 |
26 | Do
27 |
28 |
29 | Edit
30 |
31 |
32 |
33 | );
34 | };
35 |
--------------------------------------------------------------------------------
/website/src/components/Link.tsx:
--------------------------------------------------------------------------------
1 | import { makeLinkComponent } from "@openpatch/patches";
2 | import NextLink from "next/link";
3 |
4 | export const Link = makeLinkComponent(({ href, ...restProps }, ref) =>
5 | href[0] === "/" ? (
6 |
7 |
8 |
9 | ) : (
10 |
11 | )
12 | );
13 |
--------------------------------------------------------------------------------
/website/src/flows/index.ts:
--------------------------------------------------------------------------------
1 | export { proceduralC } from "./proceduralC";
2 | export { simpleAnswerSplit } from "./simpleAnswerSplit";
3 | export { getStarted } from "./getStarted";
4 |
--------------------------------------------------------------------------------
/website/src/pages/docs/bits/capture-and-replay.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Capture and Replay",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/bug-report.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Bug Report",
6 | };
7 |
8 | For bug reporting you can go to https://github.com/openpatch/bitflow/issues/new
9 | and describe that you have encountered. It is easier to fix the bug, you also
10 | provide information on what did you expect to happen. If this bug is present in an
11 | open source project, please leave a link to the source code. Pictures, Gifs or
12 | videos are also welcome.
13 |
14 | If you are not sure about reporting, feel free to discuss it at our [Matrix Space](https://matrix.to/#/#openpatch:matrix.org).
15 |
16 | export default ({ children }) => (
17 |
18 |
19 | {children}
20 |
21 |
22 | );
23 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/documentation.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Documentation",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-end-bit.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New End Bit",
6 | };
7 |
8 | To add a new end bit run `pnpm plop` and select `bit` and `end`. Afterwards
9 | you can enter the name of the new end bit and every required file will be
10 | generated for you.
11 |
12 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-flow-node.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Flow Node",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-input-bit.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Input Bit",
6 | };
7 |
8 | To add a new input bit run `pnpm plop` and select `bit` and `input`. Afterwards
9 | you can enter the name of the new input bit and every required file will be
10 | generated for you.
11 |
12 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-language.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Language",
6 | };
7 |
8 | To add a new language, you need to modify the `vocab.config.js` file of each
9 | package by adding an entry to the languages list. Lets assume that you added
10 | French `fr`. Afterwards you need to add a `fr.translations.json` file to the
11 | `locales.vocab` folder. This file you have the same structure as the
12 | `translations.json` file. Then you can generate the new locales by running `pnpm build:locale`. Now everything should be ready.
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-start-bit.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Start Bit",
6 | };
7 |
8 | To add a new start bit run `pnpm plop` and select `bit` and `start`. Afterwards
9 | you can enter the name of the new start bit and every required file will be
10 | generated for you.
11 |
12 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-task-bit.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Task Bit",
6 | };
7 |
8 | To add a new task bit run `pnpm plop` and select `bit` and `task`. Afterwards
9 | you can enter the name of the new task bit and every required file will be
10 | generated for you. The generated files are based on the Yes No task.
11 |
12 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/new-title-bit.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "New Title Bit",
6 | };
7 |
8 | To add a new title bit run `pnpm plop` and select `bit` and `title`. Afterwards
9 | you can enter the name of the new title bit and every required file will be
10 | generated for you.
11 |
12 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/contributing/update-translations.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Update Translations",
6 | };
7 |
8 | If you want to update or fix translations, you need to update the
9 | `translations.json` file or `[code].translations.json` file in the
10 | `locales.vocab` folder of a given package. The simples way to do that is to
11 | visit the [GitHub repository](https://github.com/openpatch/bitflow), navigate to
12 | the file, click the little pencil icon, do your editing and propose the changes.
13 |
14 | export default ({ children }) => (
15 |
16 |
17 | {children}
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/website/src/pages/docs/do-local.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "DoLocal",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/do.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Do",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | If you are looking for a preconfigured component for doing in browser assessments without the need for a server you can
11 | use the [DoLocal](/docs/do-local) component.
12 |
13 | export default ({ children }) => (
14 |
15 |
16 | {children}
17 |
18 |
19 | );
20 |
--------------------------------------------------------------------------------
/website/src/pages/docs/flow/editor.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Flow Editor",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/flow/index.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { Flow as IFlow } from "@bitflow/core";
3 | import { Flow } from "@bitflow/flow";
4 | import { DocLayout } from "../../../components/DocLayout";
5 | import { getStarted } from "../../../flows";
6 |
7 | export const meta = {
8 | title: "Flow",
9 | };
10 |
11 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
12 |
13 | export default ({ children }) => (
14 |
15 |
16 | {children}
17 |
18 |
19 | );
20 |
--------------------------------------------------------------------------------
/website/src/pages/docs/report/index.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Report",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/end.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "End Shell",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/index.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Shells",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/input.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Input Shell",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/start.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Start Shell",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/task.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Task Shell",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/pages/docs/shells/title.mdx:
--------------------------------------------------------------------------------
1 | import { Card, CardContent } from "@openpatch/patches";
2 | import { DocLayout } from "../../../components/DocLayout";
3 |
4 | export const meta = {
5 | title: "Title Shell",
6 | };
7 |
8 | Incomplete Documentation. Feel free helping to complete it. [Contributing Documentation](/docs/Contributing/documentation)
9 |
10 | export default ({ children }) => (
11 |
12 |
13 | {children}
14 |
15 |
16 | );
17 |
--------------------------------------------------------------------------------
/website/src/utils/bitflow.ts:
--------------------------------------------------------------------------------
1 | import {
2 | makeEvaluate,
3 | makeFlowNodeSchema,
4 | makeFlowSchema,
5 | } from "@bitflow/core";
6 | import { schemas, evaluate as bitEvaluate } from "@bitflow/bits";
7 |
8 |
9 | export const FlowNodeSchema = makeFlowNodeSchema(schemas);
10 |
11 | export const FlowSchema = makeFlowSchema(schemas);
12 |
13 | export const evaluate = makeEvaluate(bitEvaluate);
14 |
--------------------------------------------------------------------------------
/website/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "typeRoots": [
10 | "./node_modules/@types",
11 | "./types"
12 | ],
13 | "jsxImportSource": "@emotion/react",
14 | "allowJs": true,
15 | "skipLibCheck": true,
16 | "strict": true,
17 | "forceConsistentCasingInFileNames": true,
18 | "noEmit": true,
19 | "esModuleInterop": true,
20 | "module": "esnext",
21 | "moduleResolution": "node",
22 | "resolveJsonModule": true,
23 | "isolatedModules": true,
24 | "jsx": "preserve",
25 | "plugins": [
26 | {
27 | "name": "typescript-styled-plugin"
28 | }
29 | ],
30 | "incremental": true
31 | },
32 | "exclude": [
33 | "node_modules"
34 | ],
35 | "include": [
36 | "next-env.d.ts",
37 | "**/*.ts",
38 | "**/*.tsx",
39 | "./types"
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/website/types/bitflow.d.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | Task,
3 | TaskResult,
4 | TaskStatistic,
5 | TaskAnswer,
6 | Input,
7 | Title,
8 | Start,
9 | End,
10 | } from "@bitflow/bits";
11 |
12 | declare global {
13 | namespace Bitflow {
14 | export {
15 | Task,
16 | TaskResult,
17 | TaskStatistic,
18 | TaskAnswer,
19 | Input,
20 | Title,
21 | Start,
22 | End,
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/website/types/emotion.d.ts:
--------------------------------------------------------------------------------
1 | import "@emotion/react";
2 | import { Theme as PatchesTheme } from "@openpatch/patches";
3 | declare module "@emotion/react" {
4 | export interface Theme extends PatchesTheme {}
5 | }
6 |
--------------------------------------------------------------------------------
/website/types/global.d.ts:
--------------------------------------------------------------------------------
1 | import { Locale } from "@bitflow/provider";
2 |
3 | declare global {
4 | interface Window {
5 | __localeId__: Locale;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/website/vocab.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | devLanguage: "en-GB",
3 | projectRoot: "./src",
4 | languages: [
5 | { name: "en" },
6 | { name: "en-US", extends: "en" },
7 | { name: "en-GB", extends: "en" },
8 | { name: "de" },
9 | ],
10 | };
11 |
--------------------------------------------------------------------------------