create-weave-frontend-app 0.21.2 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{create-app-CekXcOg7.js → create-app-Dv00W4w1.js} +6 -6
- package/dist/{create-app-CekXcOg7.js.map → create-app-Dv00W4w1.js.map} +1 -1
- package/dist/create-app.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/template/+nextjs+azure-web-pubsub/components/room/room.tsx +4 -6
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/arrow-properties.tsx +162 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/ellipse-properties.tsx +174 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/fill-properties.tsx +14 -9
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/radius-properties.tsx +179 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/size-properties.tsx +29 -9
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/star-properties.tsx +201 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/node-properties.tsx +24 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/tools-overlay.tsx +60 -0
- package/template/+nextjs+azure-web-pubsub/components/utils/constants.ts +24 -0
- package/template/+nextjs+websockets/components/room/room.tsx +4 -6
- package/template/+nextjs+websockets/components/room-components/node-properties/arrow-properties.tsx +162 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/ellipse-properties.tsx +174 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/fill-properties.tsx +14 -9
- package/template/+nextjs+websockets/components/room-components/node-properties/size-properties.tsx +29 -9
- package/template/+nextjs+websockets/components/room-components/node-properties/star-properties.tsx +201 -0
- package/template/+nextjs+websockets/components/room-components/overlay/node-properties.tsx +24 -0
- package/template/+nextjs+websockets/components/room-components/overlay/tools-overlay.tsx +60 -0
- package/template/+nextjs+websockets/components/utils/constants.ts +24 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-get-weave-js-props.tsx +0 -35
|
@@ -76,11 +76,11 @@ function tryGitInit(root) {
|
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/versions.js
|
|
78
78
|
const versions = {
|
|
79
|
-
"@inditextech/weave-types": "0.
|
|
80
|
-
"@inditextech/weave-sdk": "0.
|
|
81
|
-
"@inditextech/weave-store-websockets": "0.
|
|
82
|
-
"@inditextech/weave-store-azure-web-pubsub": "0.
|
|
83
|
-
"@inditextech/weave-react": "0.
|
|
79
|
+
"@inditextech/weave-types": "0.22.1",
|
|
80
|
+
"@inditextech/weave-sdk": "0.22.1",
|
|
81
|
+
"@inditextech/weave-store-websockets": "0.22.1",
|
|
82
|
+
"@inditextech/weave-store-azure-web-pubsub": "0.22.1",
|
|
83
|
+
"@inditextech/weave-react": "0.22.1"
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
//#endregion
|
|
@@ -431,4 +431,4 @@ function pick(obj, keys) {
|
|
|
431
431
|
|
|
432
432
|
//#endregion
|
|
433
433
|
export { create, cwd, getPackageManager };
|
|
434
|
-
//# sourceMappingURL=create-app-
|
|
434
|
+
//# sourceMappingURL=create-app-Dv00W4w1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app-CekXcOg7.js","names":["cwd: string","root: string","manager: PackageManager","dest: string","options: Options","file: string","dest: string","projectName: string","from: string","to: string","rename: (s: string) => string","obj: T","keys: K[]","result: Partial<T>"],"sources":["../src/git.ts","../src/versions.js","../template/package.json","../src/auto-install.ts","../src/constants.ts","../src/create-app.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { rmSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\n\nfunction isInGitRepository(cwd: string): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInMercurialRepository(cwd: string): boolean {\n try {\n execSync('hg --cwd . root', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isDefaultBranchSet(cwd: string): boolean {\n try {\n execSync('git config init.defaultBranch', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function tryGitInit(root: string): boolean {\n let didInit = false;\n\n try {\n execSync('git --version', { stdio: 'ignore' });\n if (isInGitRepository(root) || isInMercurialRepository(root)) {\n return false;\n }\n\n execSync('git init', { stdio: 'ignore', cwd: root });\n didInit = true;\n\n if (!isDefaultBranchSet(root)) {\n execSync('git checkout -b main', { stdio: 'ignore', cwd: root });\n }\n\n execSync('git add -A', { stdio: 'ignore', cwd: root });\n execSync('git commit -m \"Initial commit from Create Fumadocs App\"', {\n stdio: 'ignore',\n cwd: root,\n });\n return true;\n } catch {\n if (didInit) {\n try {\n rmSync(join(root, '.git'), { recursive: true, force: true });\n } catch {\n // do nothing\n }\n }\n\n return false;\n }\n}\n","export const versions = {\"@inditextech/weave-types\":\"0.21.2\",\"@inditextech/weave-sdk\":\"0.21.2\",\"@inditextech/weave-store-websockets\":\"0.21.2\",\"@inditextech/weave-store-azure-web-pubsub\":\"0.21.2\",\"@inditextech/weave-react\":\"0.21.2\"}","{\n \"name\": \"example-versions\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"description\": \"Used to track dependency versions in create-*-app\",\n \"license\": \"MIT\",\n \"dependencies\": {\n \"@hookform/resolvers\": \"^4.1.3\",\n \"@inditextech/weave-react\": \"0.0.0\",\n \"@inditextech/weave-sdk\": \"0.0.0\",\n \"@inditextech/weave-store-websockets\": \"0.0.0\",\n \"@inditextech/weave-store-azure-web-pubsub\": \"0.0.0\",\n \"@next/env\": \"^15.2.1\",\n \"@radix-ui/react-accordion\": \"^1.2.3\",\n \"@radix-ui/react-avatar\": \"^1.1.3\",\n \"@radix-ui/react-checkbox\": \"^1.1.4\",\n \"@radix-ui/react-dialog\": \"^1.1.6\",\n \"@radix-ui/react-dropdown-menu\": \"^2.1.6\",\n \"@radix-ui/react-label\": \"^2.1.2\",\n \"@radix-ui/react-popover\": \"^1.1.6\",\n \"@radix-ui/react-scroll-area\": \"^1.2.3\",\n \"@radix-ui/react-select\": \"^2.1.6\",\n \"@radix-ui/react-slider\": \"^1.2.3\",\n \"@radix-ui/react-slot\": \"^1.1.2\",\n \"@radix-ui/react-tabs\": \"^1.1.3\",\n \"@radix-ui/react-tooltip\": \"^1.1.8\",\n \"@react-three/fiber\": \"^8.18.0\",\n \"@react-three/postprocessing\": \"^2.19.1\",\n \"@tanstack/react-query\": \"^5.67.1\",\n \"boring-avatars\": \"^1.11.2\",\n \"change-case\": \"^5.4.4\",\n \"class-variance-authority\": \"^0.7.1\",\n \"clsx\": \"^2.1.1\",\n \"cmdk\": \"^1.0.0\",\n \"color\": \"^5.0.0\",\n \"framer-motion\": \"^11.18.2\",\n \"konva\": \"^9.3.18\",\n \"motion\": \"^12.4.7\",\n \"next\": \"14.2.28\",\n \"next-themes\": \"^0.4.6\",\n \"ogl\": \"^1.0.11\",\n \"onnxruntime-web\": \"^1.21.0-dev.20250206-d981b153d3\",\n \"pdf-lib\": \"^1.17.1\",\n \"platform-detect\": \"^3.0.1\",\n \"postprocessing\": \"^6.37.1\",\n \"react\": \"18.2.0\",\n \"react-dom\": \"18.2.0\",\n \"react-hook-form\": \"^7.54.2\",\n \"react-number-format\": \"^5.4.3\",\n \"sharp\": \"^0.33.5\",\n \"sonner\": \"^2.0.3\",\n \"tailwind-merge\": \"^3.0.2\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"three\": \"^0.167.1\",\n \"uuid\": \"^11.1.0\",\n \"vaul\": \"^1.1.2\",\n \"zod\": \"^3.24.2\",\n \"zustand\": \"^5.0.3\"\n },\n \"devDependencies\": {\n \"@eslint/eslintrc\": \"^3\",\n \"@tailwindcss/postcss\": \"^4\",\n \"@testing-library/dom\": \"^10.4.0\",\n \"@testing-library/react\": \"^16.2.0\",\n \"@types/node\": \"^20\",\n \"@types/react\": \"^18\",\n \"@types/react-dom\": \"^18\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"@vitest/coverage-v8\": \"^3.0.7\",\n \"eslint\": \"^8\",\n \"eslint-config-next\": \"14.2.24\",\n \"eslint-config-prettier\": \"^10.0.2\",\n \"jsdom\": \"^26.0.0\",\n \"lucide-react\": \"^0.477.0\",\n \"tailwindcss\": \"^4\",\n \"typescript\": \"^5\",\n \"vite-tsconfig-paths\": \"^5.1.4\",\n \"vitest\": \"^3.0.7\"\n }\n}\n","import { spawn } from 'cross-spawn';\n\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? '';\n\n if (userAgent.startsWith('yarn')) {\n return 'yarn';\n }\n\n if (userAgent.startsWith('pnpm')) {\n return 'pnpm';\n }\n\n if (userAgent.startsWith('bun')) {\n return 'bun';\n }\n\n return 'npm';\n}\n\nexport function autoInstall(\n manager: PackageManager,\n dest: string,\n): Promise<void> {\n return new Promise((res, reject) => {\n const installProcess = spawn(manager, ['install'], {\n stdio: 'ignore',\n env: {\n ...process.env,\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n cwd: dest,\n });\n\n installProcess.on('close', (code) => {\n if (code !== 0) {\n reject(new Error('Install failed'));\n } else {\n res();\n }\n });\n });\n}\n","import { fileURLToPath } from 'node:url';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\nexport const cwd = process.cwd();\n","import path from 'node:path';\nimport fs from 'node:fs/promises';\nimport { tryGitInit } from '@/git';\nimport { versions as localVersions } from '@/versions';\nimport versionPkg from './../template/package.json';\nimport type { PackageManager } from './auto-install';\nimport { autoInstall } from './auto-install';\nimport { cwd, sourceDir } from './constants';\n\nexport type Template = '+nextjs+websockets' | '+nextjs+azure-web-pubsub';\n\nexport interface Options {\n outputDir: string;\n template: Template;\n packageManager: PackageManager;\n installDeps?: boolean;\n initializeGit?: boolean;\n log?: (message: string) => void;\n}\n\nexport async function create(options: Options): Promise<void> {\n const {\n installDeps = true,\n initializeGit = true,\n log = console.log,\n } = options;\n const projectName = path.basename(options.outputDir);\n const dest = path.resolve(cwd, options.outputDir);\n\n function defaultRename(file: string): string {\n file = file.replace('example.gitignore', '.gitignore');\n file = file.replace('example.env', '.env');\n\n return file;\n }\n\n await copy(\n path.join(sourceDir, `template/${options.template}`),\n dest,\n defaultRename\n );\n\n const packageJson = createPackageJson(projectName, options);\n await fs.writeFile(\n path.join(dest, 'package.json'),\n JSON.stringify(packageJson, null, 2)\n );\n\n const readMe = await getReadme(dest, projectName);\n await fs.writeFile(path.join(dest, 'README.md'), readMe);\n\n if (installDeps) {\n await autoInstall(options.packageManager, dest);\n log('Installed dependencies');\n }\n\n if (initializeGit && tryGitInit(dest)) {\n log('Initialized Git repository');\n }\n}\n\nasync function getReadme(dest: string, projectName: string): Promise<string> {\n const template = await fs\n .readFile(path.join(dest, 'README.md'))\n .then((res) => res.toString());\n\n return `# ${projectName}\\n\\n${template}`;\n}\n\nasync function copy(\n from: string,\n to: string,\n rename: (s: string) => string = (s) => s\n): Promise<void> {\n const stats = await fs.stat(from);\n\n if (stats.isDirectory()) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) =>\n copy(path.join(from, file), rename(path.join(to, file)))\n )\n );\n } else {\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nfunction createPackageJson(projectName: string, options: Options): object {\n if (options.template === '+nextjs+azure-web-pubsub') {\n const dependencies = {\n ...pick(versionPkg.dependencies, [\n '@hookform/resolvers',\n '@next/env',\n '@radix-ui/react-accordion',\n '@radix-ui/react-avatar',\n '@radix-ui/react-checkbox',\n '@radix-ui/react-dialog',\n '@radix-ui/react-dropdown-menu',\n '@radix-ui/react-label',\n '@radix-ui/react-popover',\n '@radix-ui/react-scroll-area',\n '@radix-ui/react-select',\n '@radix-ui/react-slider',\n '@radix-ui/react-slot',\n '@radix-ui/react-tabs',\n '@radix-ui/react-tooltip',\n '@react-three/fiber',\n '@react-three/postprocessing',\n '@tanstack/react-query',\n 'boring-avatars',\n 'change-case',\n 'class-variance-authority',\n 'clsx',\n 'cmdk',\n 'color',\n 'framer-motion',\n 'konva',\n 'motion',\n 'next',\n 'next-themes',\n 'ogl',\n 'onnxruntime-web',\n 'pdf-lib',\n 'platform-detect',\n 'postprocessing',\n 'react',\n 'react-dom',\n 'react-hook-form',\n 'react-number-format',\n 'sharp',\n 'sonner',\n 'tailwind-merge',\n 'tailwindcss-animate',\n 'three',\n 'uuid',\n 'vaul',\n 'zod',\n 'zustand',\n ]),\n ...pick(localVersions, [\n '@inditextech/weave-react',\n '@inditextech/weave-sdk',\n '@inditextech/weave-store-azure-web-pubsub',\n ]),\n };\n\n const devDependencies = {\n ...pick(versionPkg.devDependencies, [\n '@eslint/eslintrc',\n '@tailwindcss/postcss',\n '@testing-library/dom',\n '@testing-library/react',\n '@types/node',\n '@types/react',\n '@types/react-dom',\n '@vitejs/plugin-react',\n 'eslint',\n 'eslint-config-next',\n 'eslint-config-prettier',\n 'jsdom',\n 'lucide-react',\n 'tailwindcss',\n 'typescript',\n 'vite-tsconfig-paths',\n ]),\n };\n\n return {\n name: projectName,\n version: '0.0.0',\n private: true,\n scripts: {\n build: 'next build',\n dev: 'next dev --experimental-https',\n lint: 'next lint',\n start: 'next start',\n },\n dependencies: sortObjectKeys(dependencies),\n devDependencies: sortObjectKeys(devDependencies),\n };\n }\n\n const dependencies = {\n ...pick(versionPkg.dependencies, [\n '@hookform/resolvers',\n '@next/env',\n '@radix-ui/react-accordion',\n '@radix-ui/react-avatar',\n '@radix-ui/react-checkbox',\n '@radix-ui/react-dialog',\n '@radix-ui/react-dropdown-menu',\n '@radix-ui/react-label',\n '@radix-ui/react-popover',\n '@radix-ui/react-scroll-area',\n '@radix-ui/react-select',\n '@radix-ui/react-slider',\n '@radix-ui/react-slot',\n '@radix-ui/react-tabs',\n '@radix-ui/react-tooltip',\n '@react-three/fiber',\n '@react-three/postprocessing',\n '@tanstack/react-query',\n 'boring-avatars',\n 'change-case',\n 'class-variance-authority',\n 'clsx',\n 'cmdk',\n 'color',\n 'framer-motion',\n 'konva',\n 'motion',\n 'next',\n 'next-themes',\n 'ogl',\n 'onnxruntime-web',\n 'pdf-lib',\n 'platform-detect',\n 'postprocessing',\n 'react',\n 'react-dom',\n 'react-hook-form',\n 'react-number-format',\n 'sharp',\n 'sonner',\n 'tailwind-merge',\n 'tailwindcss-animate',\n 'three',\n 'uuid',\n 'vaul',\n 'zod',\n 'zustand',\n ]),\n ...pick(localVersions, [\n '@inditextech/weave-react',\n '@inditextech/weave-sdk',\n '@inditextech/weave-store-websockets',\n ]),\n };\n\n const devDependencies = {\n ...pick(versionPkg.devDependencies, [\n '@eslint/eslintrc',\n '@tailwindcss/postcss',\n '@testing-library/dom',\n '@testing-library/react',\n '@types/node',\n '@types/react',\n '@types/react-dom',\n '@vitejs/plugin-react',\n 'eslint',\n 'eslint-config-next',\n 'eslint-config-prettier',\n 'jsdom',\n 'lucide-react',\n 'tailwindcss',\n 'typescript',\n 'vite-tsconfig-paths',\n ]),\n };\n\n return {\n name: projectName,\n version: '0.0.0',\n private: true,\n scripts: {\n build: 'next build',\n dev: 'next dev --experimental-https',\n lint: 'next lint',\n start: 'next start',\n },\n dependencies: sortObjectKeys(dependencies),\n devDependencies: sortObjectKeys(devDependencies),\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sortObjectKeys<T extends Record<string, any>>(obj: T): T {\n const sortedEntries = Object.keys(obj)\n .sort()\n .map((key) => [key, obj[key]] as [keyof T, T[keyof T]]);\n\n return Object.fromEntries(sortedEntries) as T;\n}\n\nfunction pick<T extends object, K extends keyof T>(\n obj: T,\n keys: K[]\n): Pick<T, K> {\n const result: Partial<T> = {};\n\n for (const key of keys) {\n if (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ACjD;CACF;CAED,MAAM,iBAAe;EACnB,GAAG,KAAK,gBAAW,cAAc;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD,EAAC;EACF,GAAG,KAAK,UAAe;GACrB;GACA;GACA;EACD,EAAC;CACH;CAED,MAAM,oBAAkB,EACtB,GAAG,KAAK,gBAAW,iBAAiB;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,CACH;AAED,QAAO;EACL,MAAM;EACN,SAAS;EACT,SAAS;EACT,SAAS;GACP,OAAO;GACP,KAAK;GACL,MAAM;GACN,OAAO;EACR;EACD,cAAc,eAAe,eAAa;EAC1C,iBAAiB,eAAe,kBAAgB;CACjD;AACF;AAGD,SAAS,eAA8CO,KAAW;CAChE,MAAM,gBAAgB,OAAO,KAAK,IAAI,CACnC,MAAM,CACN,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAK,EAA0B;AAEzD,QAAO,OAAO,YAAY,cAAc;AACzC;AAED,SAAS,KACPA,KACAC,MACY;CACZ,MAAMC,SAAqB,CAAE;AAE7B,MAAK,MAAM,OAAO,KAChB,KAAI,OAAO,IACT,QAAO,OAAO,IAAI;AAItB,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"create-app-Dv00W4w1.js","names":["cwd: string","root: string","manager: PackageManager","dest: string","options: Options","file: string","dest: string","projectName: string","from: string","to: string","rename: (s: string) => string","obj: T","keys: K[]","result: Partial<T>"],"sources":["../src/git.ts","../src/versions.js","../template/package.json","../src/auto-install.ts","../src/constants.ts","../src/create-app.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { rmSync } from 'node:fs';\nimport { join } from 'node:path';\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\n\nfunction isInGitRepository(cwd: string): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInMercurialRepository(cwd: string): boolean {\n try {\n execSync('hg --cwd . root', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isDefaultBranchSet(cwd: string): boolean {\n try {\n execSync('git config init.defaultBranch', { stdio: 'ignore', cwd });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function tryGitInit(root: string): boolean {\n let didInit = false;\n\n try {\n execSync('git --version', { stdio: 'ignore' });\n if (isInGitRepository(root) || isInMercurialRepository(root)) {\n return false;\n }\n\n execSync('git init', { stdio: 'ignore', cwd: root });\n didInit = true;\n\n if (!isDefaultBranchSet(root)) {\n execSync('git checkout -b main', { stdio: 'ignore', cwd: root });\n }\n\n execSync('git add -A', { stdio: 'ignore', cwd: root });\n execSync('git commit -m \"Initial commit from Create Fumadocs App\"', {\n stdio: 'ignore',\n cwd: root,\n });\n return true;\n } catch {\n if (didInit) {\n try {\n rmSync(join(root, '.git'), { recursive: true, force: true });\n } catch {\n // do nothing\n }\n }\n\n return false;\n }\n}\n","export const versions = {\"@inditextech/weave-types\":\"0.22.1\",\"@inditextech/weave-sdk\":\"0.22.1\",\"@inditextech/weave-store-websockets\":\"0.22.1\",\"@inditextech/weave-store-azure-web-pubsub\":\"0.22.1\",\"@inditextech/weave-react\":\"0.22.1\"}","{\n \"name\": \"example-versions\",\n \"version\": \"0.0.0\",\n \"private\": true,\n \"description\": \"Used to track dependency versions in create-*-app\",\n \"license\": \"MIT\",\n \"dependencies\": {\n \"@hookform/resolvers\": \"^4.1.3\",\n \"@inditextech/weave-react\": \"0.0.0\",\n \"@inditextech/weave-sdk\": \"0.0.0\",\n \"@inditextech/weave-store-websockets\": \"0.0.0\",\n \"@inditextech/weave-store-azure-web-pubsub\": \"0.0.0\",\n \"@next/env\": \"^15.2.1\",\n \"@radix-ui/react-accordion\": \"^1.2.3\",\n \"@radix-ui/react-avatar\": \"^1.1.3\",\n \"@radix-ui/react-checkbox\": \"^1.1.4\",\n \"@radix-ui/react-dialog\": \"^1.1.6\",\n \"@radix-ui/react-dropdown-menu\": \"^2.1.6\",\n \"@radix-ui/react-label\": \"^2.1.2\",\n \"@radix-ui/react-popover\": \"^1.1.6\",\n \"@radix-ui/react-scroll-area\": \"^1.2.3\",\n \"@radix-ui/react-select\": \"^2.1.6\",\n \"@radix-ui/react-slider\": \"^1.2.3\",\n \"@radix-ui/react-slot\": \"^1.1.2\",\n \"@radix-ui/react-tabs\": \"^1.1.3\",\n \"@radix-ui/react-tooltip\": \"^1.1.8\",\n \"@react-three/fiber\": \"^8.18.0\",\n \"@react-three/postprocessing\": \"^2.19.1\",\n \"@tanstack/react-query\": \"^5.67.1\",\n \"boring-avatars\": \"^1.11.2\",\n \"change-case\": \"^5.4.4\",\n \"class-variance-authority\": \"^0.7.1\",\n \"clsx\": \"^2.1.1\",\n \"cmdk\": \"^1.0.0\",\n \"color\": \"^5.0.0\",\n \"framer-motion\": \"^11.18.2\",\n \"konva\": \"^9.3.18\",\n \"motion\": \"^12.4.7\",\n \"next\": \"14.2.28\",\n \"next-themes\": \"^0.4.6\",\n \"ogl\": \"^1.0.11\",\n \"onnxruntime-web\": \"^1.21.0-dev.20250206-d981b153d3\",\n \"pdf-lib\": \"^1.17.1\",\n \"platform-detect\": \"^3.0.1\",\n \"postprocessing\": \"^6.37.1\",\n \"react\": \"18.2.0\",\n \"react-dom\": \"18.2.0\",\n \"react-hook-form\": \"^7.54.2\",\n \"react-number-format\": \"^5.4.3\",\n \"sharp\": \"^0.33.5\",\n \"sonner\": \"^2.0.3\",\n \"tailwind-merge\": \"^3.0.2\",\n \"tailwindcss-animate\": \"^1.0.7\",\n \"three\": \"^0.167.1\",\n \"uuid\": \"^11.1.0\",\n \"vaul\": \"^1.1.2\",\n \"zod\": \"^3.24.2\",\n \"zustand\": \"^5.0.3\"\n },\n \"devDependencies\": {\n \"@eslint/eslintrc\": \"^3\",\n \"@tailwindcss/postcss\": \"^4\",\n \"@testing-library/dom\": \"^10.4.0\",\n \"@testing-library/react\": \"^16.2.0\",\n \"@types/node\": \"^20\",\n \"@types/react\": \"^18\",\n \"@types/react-dom\": \"^18\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"@vitest/coverage-v8\": \"^3.0.7\",\n \"eslint\": \"^8\",\n \"eslint-config-next\": \"14.2.24\",\n \"eslint-config-prettier\": \"^10.0.2\",\n \"jsdom\": \"^26.0.0\",\n \"lucide-react\": \"^0.477.0\",\n \"tailwindcss\": \"^4\",\n \"typescript\": \"^5\",\n \"vite-tsconfig-paths\": \"^5.1.4\",\n \"vitest\": \"^3.0.7\"\n }\n}\n","import { spawn } from 'cross-spawn';\n\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? '';\n\n if (userAgent.startsWith('yarn')) {\n return 'yarn';\n }\n\n if (userAgent.startsWith('pnpm')) {\n return 'pnpm';\n }\n\n if (userAgent.startsWith('bun')) {\n return 'bun';\n }\n\n return 'npm';\n}\n\nexport function autoInstall(\n manager: PackageManager,\n dest: string,\n): Promise<void> {\n return new Promise((res, reject) => {\n const installProcess = spawn(manager, ['install'], {\n stdio: 'ignore',\n env: {\n ...process.env,\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n cwd: dest,\n });\n\n installProcess.on('close', (code) => {\n if (code !== 0) {\n reject(new Error('Install failed'));\n } else {\n res();\n }\n });\n });\n}\n","import { fileURLToPath } from 'node:url';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\nexport const cwd = process.cwd();\n","import path from 'node:path';\nimport fs from 'node:fs/promises';\nimport { tryGitInit } from '@/git';\nimport { versions as localVersions } from '@/versions';\nimport versionPkg from './../template/package.json';\nimport type { PackageManager } from './auto-install';\nimport { autoInstall } from './auto-install';\nimport { cwd, sourceDir } from './constants';\n\nexport type Template = '+nextjs+websockets' | '+nextjs+azure-web-pubsub';\n\nexport interface Options {\n outputDir: string;\n template: Template;\n packageManager: PackageManager;\n installDeps?: boolean;\n initializeGit?: boolean;\n log?: (message: string) => void;\n}\n\nexport async function create(options: Options): Promise<void> {\n const {\n installDeps = true,\n initializeGit = true,\n log = console.log,\n } = options;\n const projectName = path.basename(options.outputDir);\n const dest = path.resolve(cwd, options.outputDir);\n\n function defaultRename(file: string): string {\n file = file.replace('example.gitignore', '.gitignore');\n file = file.replace('example.env', '.env');\n\n return file;\n }\n\n await copy(\n path.join(sourceDir, `template/${options.template}`),\n dest,\n defaultRename\n );\n\n const packageJson = createPackageJson(projectName, options);\n await fs.writeFile(\n path.join(dest, 'package.json'),\n JSON.stringify(packageJson, null, 2)\n );\n\n const readMe = await getReadme(dest, projectName);\n await fs.writeFile(path.join(dest, 'README.md'), readMe);\n\n if (installDeps) {\n await autoInstall(options.packageManager, dest);\n log('Installed dependencies');\n }\n\n if (initializeGit && tryGitInit(dest)) {\n log('Initialized Git repository');\n }\n}\n\nasync function getReadme(dest: string, projectName: string): Promise<string> {\n const template = await fs\n .readFile(path.join(dest, 'README.md'))\n .then((res) => res.toString());\n\n return `# ${projectName}\\n\\n${template}`;\n}\n\nasync function copy(\n from: string,\n to: string,\n rename: (s: string) => string = (s) => s\n): Promise<void> {\n const stats = await fs.stat(from);\n\n if (stats.isDirectory()) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) =>\n copy(path.join(from, file), rename(path.join(to, file)))\n )\n );\n } else {\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nfunction createPackageJson(projectName: string, options: Options): object {\n if (options.template === '+nextjs+azure-web-pubsub') {\n const dependencies = {\n ...pick(versionPkg.dependencies, [\n '@hookform/resolvers',\n '@next/env',\n '@radix-ui/react-accordion',\n '@radix-ui/react-avatar',\n '@radix-ui/react-checkbox',\n '@radix-ui/react-dialog',\n '@radix-ui/react-dropdown-menu',\n '@radix-ui/react-label',\n '@radix-ui/react-popover',\n '@radix-ui/react-scroll-area',\n '@radix-ui/react-select',\n '@radix-ui/react-slider',\n '@radix-ui/react-slot',\n '@radix-ui/react-tabs',\n '@radix-ui/react-tooltip',\n '@react-three/fiber',\n '@react-three/postprocessing',\n '@tanstack/react-query',\n 'boring-avatars',\n 'change-case',\n 'class-variance-authority',\n 'clsx',\n 'cmdk',\n 'color',\n 'framer-motion',\n 'konva',\n 'motion',\n 'next',\n 'next-themes',\n 'ogl',\n 'onnxruntime-web',\n 'pdf-lib',\n 'platform-detect',\n 'postprocessing',\n 'react',\n 'react-dom',\n 'react-hook-form',\n 'react-number-format',\n 'sharp',\n 'sonner',\n 'tailwind-merge',\n 'tailwindcss-animate',\n 'three',\n 'uuid',\n 'vaul',\n 'zod',\n 'zustand',\n ]),\n ...pick(localVersions, [\n '@inditextech/weave-react',\n '@inditextech/weave-sdk',\n '@inditextech/weave-store-azure-web-pubsub',\n ]),\n };\n\n const devDependencies = {\n ...pick(versionPkg.devDependencies, [\n '@eslint/eslintrc',\n '@tailwindcss/postcss',\n '@testing-library/dom',\n '@testing-library/react',\n '@types/node',\n '@types/react',\n '@types/react-dom',\n '@vitejs/plugin-react',\n 'eslint',\n 'eslint-config-next',\n 'eslint-config-prettier',\n 'jsdom',\n 'lucide-react',\n 'tailwindcss',\n 'typescript',\n 'vite-tsconfig-paths',\n ]),\n };\n\n return {\n name: projectName,\n version: '0.0.0',\n private: true,\n scripts: {\n build: 'next build',\n dev: 'next dev --experimental-https',\n lint: 'next lint',\n start: 'next start',\n },\n dependencies: sortObjectKeys(dependencies),\n devDependencies: sortObjectKeys(devDependencies),\n };\n }\n\n const dependencies = {\n ...pick(versionPkg.dependencies, [\n '@hookform/resolvers',\n '@next/env',\n '@radix-ui/react-accordion',\n '@radix-ui/react-avatar',\n '@radix-ui/react-checkbox',\n '@radix-ui/react-dialog',\n '@radix-ui/react-dropdown-menu',\n '@radix-ui/react-label',\n '@radix-ui/react-popover',\n '@radix-ui/react-scroll-area',\n '@radix-ui/react-select',\n '@radix-ui/react-slider',\n '@radix-ui/react-slot',\n '@radix-ui/react-tabs',\n '@radix-ui/react-tooltip',\n '@react-three/fiber',\n '@react-three/postprocessing',\n '@tanstack/react-query',\n 'boring-avatars',\n 'change-case',\n 'class-variance-authority',\n 'clsx',\n 'cmdk',\n 'color',\n 'framer-motion',\n 'konva',\n 'motion',\n 'next',\n 'next-themes',\n 'ogl',\n 'onnxruntime-web',\n 'pdf-lib',\n 'platform-detect',\n 'postprocessing',\n 'react',\n 'react-dom',\n 'react-hook-form',\n 'react-number-format',\n 'sharp',\n 'sonner',\n 'tailwind-merge',\n 'tailwindcss-animate',\n 'three',\n 'uuid',\n 'vaul',\n 'zod',\n 'zustand',\n ]),\n ...pick(localVersions, [\n '@inditextech/weave-react',\n '@inditextech/weave-sdk',\n '@inditextech/weave-store-websockets',\n ]),\n };\n\n const devDependencies = {\n ...pick(versionPkg.devDependencies, [\n '@eslint/eslintrc',\n '@tailwindcss/postcss',\n '@testing-library/dom',\n '@testing-library/react',\n '@types/node',\n '@types/react',\n '@types/react-dom',\n '@vitejs/plugin-react',\n 'eslint',\n 'eslint-config-next',\n 'eslint-config-prettier',\n 'jsdom',\n 'lucide-react',\n 'tailwindcss',\n 'typescript',\n 'vite-tsconfig-paths',\n ]),\n };\n\n return {\n name: projectName,\n version: '0.0.0',\n private: true,\n scripts: {\n build: 'next build',\n dev: 'next dev --experimental-https',\n lint: 'next lint',\n start: 'next start',\n },\n dependencies: sortObjectKeys(dependencies),\n devDependencies: sortObjectKeys(devDependencies),\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction sortObjectKeys<T extends Record<string, any>>(obj: T): T {\n const sortedEntries = Object.keys(obj)\n .sort()\n .map((key) => [key, obj[key]] as [keyof T, T[keyof T]]);\n\n return Object.fromEntries(sortedEntries) as T;\n}\n\nfunction pick<T extends object, K extends keyof T>(\n obj: T,\n keys: K[]\n): Pick<T, K> {\n const result: Partial<T> = {};\n\n for (const key of keys) {\n if (key in obj) {\n result[key] = obj[key];\n }\n }\n\n return result as Pick<T, K>;\n}\n"],"mappings":";;;;;;;;AAUA,SAAS,kBAAkBA,OAAsB;AAC/C,KAAI;AACF,WAAS,uCAAuC;GAAE,OAAO;GAAU;EAAK,EAAC;AACzE,SAAO;CACR,QAAO;AACN,SAAO;CACR;AACF;AAED,SAAS,wBAAwBA,OAAsB;AACrD,KAAI;AACF,WAAS,mBAAmB;GAAE,OAAO;GAAU;EAAK,EAAC;AACrD,SAAO;CACR,QAAO;AACN,SAAO;CACR;AACF;AAED,SAAS,mBAAmBA,OAAsB;AAChD,KAAI;AACF,WAAS,iCAAiC;GAAE,OAAO;GAAU;EAAK,EAAC;AACnE,SAAO;CACR,QAAO;AACN,SAAO;CACR;AACF;AAED,SAAgB,WAAWC,MAAuB;CAChD,IAAI,UAAU;AAEd,KAAI;AACF,WAAS,iBAAiB,EAAE,OAAO,SAAU,EAAC;AAC9C,MAAI,kBAAkB,KAAK,IAAI,wBAAwB,KAAK,CAC1D,QAAO;AAGT,WAAS,YAAY;GAAE,OAAO;GAAU,KAAK;EAAM,EAAC;AACpD,YAAU;AAEV,OAAK,mBAAmB,KAAK,CAC3B,UAAS,wBAAwB;GAAE,OAAO;GAAU,KAAK;EAAM,EAAC;AAGlE,WAAS,cAAc;GAAE,OAAO;GAAU,KAAK;EAAM,EAAC;AACtD,WAAS,6DAA2D;GAClE,OAAO;GACP,KAAK;EACN,EAAC;AACF,SAAO;CACR,QAAO;AACN,MAAI,QACF,KAAI;AACF,UAAO,KAAK,MAAM,OAAO,EAAE;IAAE,WAAW;IAAM,OAAO;GAAM,EAAC;EAC7D,QAAO,CAEP;AAGH,SAAO;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A;GACA;GACA;GACA;GACA;EACD,EAAC,CACH;AAED,SAAO;GACL,MAAM;GACN,SAAS;GACT,SAAS;GACT,SAAS;IACP,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;GACR;GACD,cAAc,eAAe,eAAa;GAC1C,iBAAiB,eAAe,kBAAgB;EACjD;CACF;CAED,MAAM,iBAAe;EACnB,GAAG,KAAK,gBAAW,cAAc;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD,EAAC;EACF,GAAG,KAAK,UAAe;GACrB;GACA;GACA;EACD,EAAC;CACH;CAED,MAAM,oBAAkB,EACtB,GAAG,KAAK,gBAAW,iBAAiB;EAClC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,EAAC,CACH;AAED,QAAO;EACL,MAAM;EACN,SAAS;EACT,SAAS;EACT,SAAS;GACP,OAAO;GACP,KAAK;GACL,MAAM;GACN,OAAO;EACR;EACD,cAAc,eAAe,eAAa;EAC1C,iBAAiB,eAAe,kBAAgB;CACjD;AACF;AAGD,SAAS,eAA8CO,KAAW;CAChE,MAAM,gBAAgB,OAAO,KAAK,IAAI,CACnC,MAAM,CACN,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAK,EAA0B;AAEzD,QAAO,OAAO,YAAY,cAAc;AACzC;AAED,SAAS,KACPA,KACAC,MACY;CACZ,MAAMC,SAAqB,CAAE;AAE7B,MAAK,MAAM,OAAO,KAChB,KAAI,OAAO,IACT,QAAO,OAAO,IAAI;AAItB,QAAO;AACR"}
|
package/dist/create-app.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { create, cwd, getPackageManager } from "./create-app-
|
|
2
|
+
import { create, cwd, getPackageManager } from "./create-app-Dv00W4w1.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { cancel, confirm, group, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@ import { Toaster } from '@/components/ui/sonner';
|
|
|
5
5
|
import { useRouter } from 'next/navigation';
|
|
6
6
|
import { WeaveUser, WEAVE_INSTANCE_STATUS } from '@inditextech/weave-types';
|
|
7
7
|
import { useCollaborationRoom } from '@/store/store';
|
|
8
|
+
import { ACTIONS, FONTS, NODES } from '@/components/utils/constants';
|
|
8
9
|
import { useWeave, WeaveProvider } from '@inditextech/weave-react';
|
|
9
10
|
import { RoomLayout } from './room.layout';
|
|
10
11
|
import { RoomLoader } from '../room-components/room-loader/room-loader';
|
|
11
12
|
import { AnimatePresence } from 'framer-motion';
|
|
12
|
-
import useGetWeaveJSProps from '../room-components/hooks/use-get-weave-js-props';
|
|
13
13
|
import useGetAzureWebPubsubProvider from '../room-components/hooks/use-get-azure-web-pubsub-provider';
|
|
14
14
|
import useHandleRouteParams from '../room-components/hooks/use-handle-route-params';
|
|
15
15
|
import { UploadFile } from '../room-components/upload-file';
|
|
@@ -80,8 +80,6 @@ export const Room = () => {
|
|
|
80
80
|
return '';
|
|
81
81
|
}, [loadedParams, loadingFetchConnectionUrl, status, roomLoaded]);
|
|
82
82
|
|
|
83
|
-
const { fonts, nodes, actions } = useGetWeaveJSProps();
|
|
84
|
-
|
|
85
83
|
const wsStoreProvider = useGetAzureWebPubsubProvider({
|
|
86
84
|
loadedParams,
|
|
87
85
|
getUser,
|
|
@@ -149,9 +147,9 @@ export const Room = () => {
|
|
|
149
147
|
containerId="weave"
|
|
150
148
|
getUser={getUser}
|
|
151
149
|
store={wsStoreProvider}
|
|
152
|
-
fonts={
|
|
153
|
-
nodes={
|
|
154
|
-
actions={
|
|
150
|
+
fonts={FONTS}
|
|
151
|
+
nodes={NODES}
|
|
152
|
+
actions={ACTIONS}
|
|
155
153
|
>
|
|
156
154
|
<UploadFile />
|
|
157
155
|
<RoomLayout />
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { WeaveStateElement } from '@inditextech/weave-types';
|
|
5
|
+
import { useWeave } from '@inditextech/weave-react';
|
|
6
|
+
import { useCollaborationRoom } from '@/store/store';
|
|
7
|
+
import { InputNumber } from '../inputs/input-number';
|
|
8
|
+
import { ToggleIconButton } from '../toggle-icon-button';
|
|
9
|
+
import { ArrowLeftFromLine, ArrowRightFromLine } from 'lucide-react';
|
|
10
|
+
|
|
11
|
+
export function ArrowProperties() {
|
|
12
|
+
const instance = useWeave((state) => state.instance);
|
|
13
|
+
const node = useWeave((state) => state.selection.node);
|
|
14
|
+
const actualAction = useWeave((state) => state.actions.actual);
|
|
15
|
+
|
|
16
|
+
const nodePropertiesAction = useCollaborationRoom(
|
|
17
|
+
(state) => state.nodeProperties.action
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const nodeCreateProps = useCollaborationRoom(
|
|
21
|
+
(state) => state.nodeProperties.createProps
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const actualNode = React.useMemo(() => {
|
|
25
|
+
if (actualAction && nodePropertiesAction === 'create') {
|
|
26
|
+
return {
|
|
27
|
+
key: 'creating',
|
|
28
|
+
type: 'undefined',
|
|
29
|
+
props: {
|
|
30
|
+
...nodeCreateProps,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (node && nodePropertiesAction === 'update') {
|
|
35
|
+
return node;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}, [actualAction, node, nodePropertiesAction, nodeCreateProps]);
|
|
39
|
+
|
|
40
|
+
const updateElement = React.useCallback(
|
|
41
|
+
(updatedNode: WeaveStateElement) => {
|
|
42
|
+
if (!instance) return;
|
|
43
|
+
if (actualAction && nodePropertiesAction === 'create') {
|
|
44
|
+
instance.updatePropsAction(actualAction, updatedNode.props);
|
|
45
|
+
}
|
|
46
|
+
if (nodePropertiesAction === 'update') {
|
|
47
|
+
instance.updateNode(updatedNode);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[instance, actualAction, nodePropertiesAction]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
if (!instance || !actualNode || !nodePropertiesAction) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!actualAction && !actualNode) return null;
|
|
58
|
+
|
|
59
|
+
if (
|
|
60
|
+
actualAction &&
|
|
61
|
+
['selectionTool'].includes(actualAction) &&
|
|
62
|
+
!['arrow'].includes(actualNode.type)
|
|
63
|
+
) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (actualAction && !['selectionTool', 'arrowTool'].includes(actualAction)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className="border-b border-[#c9c9c9] p-[24px] flex flex-col gap-[16px]">
|
|
73
|
+
<div className="w-full flex justify-between items-center gap-3">
|
|
74
|
+
<div className="cursor-pointer hover:no-underline items-center py-0">
|
|
75
|
+
<span className="text-[13px] font-inter font-light uppercase">
|
|
76
|
+
Arrow properties
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="grid grid-cols-1 gap-3 w-full">
|
|
81
|
+
<div className="grid grid-cols-2 gap-3 w-full">
|
|
82
|
+
<InputNumber
|
|
83
|
+
label="Pointer length"
|
|
84
|
+
value={actualNode.props.pointerLength ?? 0.0}
|
|
85
|
+
onChange={(value) => {
|
|
86
|
+
const updatedNode: WeaveStateElement = {
|
|
87
|
+
...actualNode,
|
|
88
|
+
props: {
|
|
89
|
+
...actualNode.props,
|
|
90
|
+
pointerLength: value,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
updateElement(updatedNode);
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
<InputNumber
|
|
97
|
+
label="Pointer width"
|
|
98
|
+
value={actualNode.props.pointerWidth ?? 0.0}
|
|
99
|
+
onChange={(value) => {
|
|
100
|
+
const updatedNode: WeaveStateElement = {
|
|
101
|
+
...actualNode,
|
|
102
|
+
props: {
|
|
103
|
+
...actualNode.props,
|
|
104
|
+
pointerWidth: value,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
updateElement(updatedNode);
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
<div className="w-full flex justify-between items-center gap-4 col-span-2">
|
|
111
|
+
<div className="text-[12px] text-[#757575] font-inter font-light text-nowrap">
|
|
112
|
+
Pointer at start
|
|
113
|
+
</div>
|
|
114
|
+
<div className="w-full flex justify-end items-center gap-1">
|
|
115
|
+
<ToggleIconButton
|
|
116
|
+
kind="switch"
|
|
117
|
+
icon={<ArrowLeftFromLine size={20} strokeWidth={1} />}
|
|
118
|
+
pressed={actualNode.props.pointerAtBeginning ?? false}
|
|
119
|
+
onClick={() => {
|
|
120
|
+
const updatedNode: WeaveStateElement = {
|
|
121
|
+
...actualNode,
|
|
122
|
+
props: {
|
|
123
|
+
...actualNode.props,
|
|
124
|
+
pointerAtBeginning: !(
|
|
125
|
+
actualNode.props.pointerAtBeginning ?? false
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
updateElement(updatedNode);
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="w-full flex justify-between items-center gap-4 col-span-2">
|
|
135
|
+
<div className="text-[12px] text-[#757575] font-inter font-light text-nowrap">
|
|
136
|
+
Pointer at end
|
|
137
|
+
</div>
|
|
138
|
+
<div className="w-full flex justify-end items-center gap-1">
|
|
139
|
+
<ToggleIconButton
|
|
140
|
+
kind="switch"
|
|
141
|
+
icon={<ArrowRightFromLine size={20} strokeWidth={1} />}
|
|
142
|
+
pressed={actualNode.props.pointerAtEnding ?? true}
|
|
143
|
+
onClick={() => {
|
|
144
|
+
const updatedNode: WeaveStateElement = {
|
|
145
|
+
...actualNode,
|
|
146
|
+
props: {
|
|
147
|
+
...actualNode.props,
|
|
148
|
+
pointerAtEnding: !(
|
|
149
|
+
actualNode.props.pointerAtEnding ?? true
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
updateElement(updatedNode);
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { WeaveStateElement } from '@inditextech/weave-types';
|
|
5
|
+
import { useWeave } from '@inditextech/weave-react';
|
|
6
|
+
import { useCollaborationRoom } from '@/store/store';
|
|
7
|
+
import { InputNumber } from '../inputs/input-number';
|
|
8
|
+
import { ToggleIconButton } from '../toggle-icon-button';
|
|
9
|
+
import { Scaling } from 'lucide-react';
|
|
10
|
+
|
|
11
|
+
export function EllipseProperties() {
|
|
12
|
+
const instance = useWeave((state) => state.instance);
|
|
13
|
+
const node = useWeave((state) => state.selection.node);
|
|
14
|
+
const actualAction = useWeave((state) => state.actions.actual);
|
|
15
|
+
|
|
16
|
+
const nodePropertiesAction = useCollaborationRoom(
|
|
17
|
+
(state) => state.nodeProperties.action
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const nodeCreateProps = useCollaborationRoom(
|
|
21
|
+
(state) => state.nodeProperties.createProps
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const [maintainAspectRatio, setMaintainAspectRatio] = React.useState(false);
|
|
25
|
+
|
|
26
|
+
const actualNode = React.useMemo(() => {
|
|
27
|
+
if (actualAction && nodePropertiesAction === 'create') {
|
|
28
|
+
return {
|
|
29
|
+
key: 'creating',
|
|
30
|
+
type: 'undefined',
|
|
31
|
+
props: {
|
|
32
|
+
...nodeCreateProps,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (node && nodePropertiesAction === 'update') {
|
|
37
|
+
return node;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}, [actualAction, node, nodePropertiesAction, nodeCreateProps]);
|
|
41
|
+
|
|
42
|
+
const updateElement = React.useCallback(
|
|
43
|
+
(updatedNode: WeaveStateElement) => {
|
|
44
|
+
if (!instance) return;
|
|
45
|
+
if (actualAction && nodePropertiesAction === 'create') {
|
|
46
|
+
instance.updatePropsAction(actualAction, updatedNode.props);
|
|
47
|
+
}
|
|
48
|
+
if (nodePropertiesAction === 'update') {
|
|
49
|
+
instance.updateNode(updatedNode);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
[instance, actualAction, nodePropertiesAction]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (actualNode && typeof actualNode.props.keepAspectRatio !== 'undefined') {
|
|
57
|
+
setMaintainAspectRatio(actualNode.props.keepAspectRatio);
|
|
58
|
+
}
|
|
59
|
+
}, [actualNode]);
|
|
60
|
+
|
|
61
|
+
if (!instance || !actualNode || !nodePropertiesAction) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!actualAction && !actualNode) return null;
|
|
66
|
+
|
|
67
|
+
if (
|
|
68
|
+
actualAction &&
|
|
69
|
+
['selectionTool'].includes(actualAction) &&
|
|
70
|
+
!['ellipse'].includes(actualNode.type)
|
|
71
|
+
) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (
|
|
76
|
+
actualAction &&
|
|
77
|
+
!['selectionTool', 'ellipseTool'].includes(actualAction)
|
|
78
|
+
) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className="border-b border-[#c9c9c9] p-[24px] flex flex-col gap-[16px]">
|
|
84
|
+
<div className="w-full flex justify-between items-center gap-3">
|
|
85
|
+
<div className="cursor-pointer hover:no-underline items-center py-0">
|
|
86
|
+
<span className="text-[13px] font-inter font-light uppercase">
|
|
87
|
+
Size
|
|
88
|
+
</span>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div className="grid grid-cols-1 gap-3 w-full">
|
|
92
|
+
<div className="grid grid-cols-2 gap-3 w-full">
|
|
93
|
+
<InputNumber
|
|
94
|
+
label="Radius X"
|
|
95
|
+
value={actualNode.props.radiusX ?? 0.0}
|
|
96
|
+
onChange={(value) => {
|
|
97
|
+
let newRadiusX = value;
|
|
98
|
+
let newRadiusY = actualNode.props.radiusY;
|
|
99
|
+
if (maintainAspectRatio) {
|
|
100
|
+
const ratio =
|
|
101
|
+
actualNode.props.radiusX / actualNode.props.radiusY;
|
|
102
|
+
|
|
103
|
+
newRadiusX = value;
|
|
104
|
+
newRadiusY = value / ratio;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const updatedNode: WeaveStateElement = {
|
|
108
|
+
...actualNode,
|
|
109
|
+
props: {
|
|
110
|
+
...actualNode.props,
|
|
111
|
+
radiusX: newRadiusX,
|
|
112
|
+
radiusY: newRadiusY,
|
|
113
|
+
keepAspectRatio: maintainAspectRatio,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
updateElement(updatedNode);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
<InputNumber
|
|
120
|
+
label="Radius Y"
|
|
121
|
+
value={actualNode.props.radiusY ?? 0.0}
|
|
122
|
+
onChange={(value) => {
|
|
123
|
+
let newRadiusX = actualNode.props.radiusX;
|
|
124
|
+
let newRadiusY = value;
|
|
125
|
+
if (maintainAspectRatio) {
|
|
126
|
+
const ratio =
|
|
127
|
+
actualNode.props.radiusX / actualNode.props.radiusY;
|
|
128
|
+
|
|
129
|
+
newRadiusX = value;
|
|
130
|
+
newRadiusY = value / ratio;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const updatedNode: WeaveStateElement = {
|
|
134
|
+
...actualNode,
|
|
135
|
+
props: {
|
|
136
|
+
...actualNode.props,
|
|
137
|
+
radiusX: newRadiusX,
|
|
138
|
+
radiusY: newRadiusY,
|
|
139
|
+
keepAspectRatio: maintainAspectRatio,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
updateElement(updatedNode);
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
|
|
146
|
+
<div className="w-full flex justify-between items-center gap-4 col-span-2">
|
|
147
|
+
<div className="text-[12px] text-[#757575] font-inter font-light text-nowrap">
|
|
148
|
+
Maintain aspect ratio
|
|
149
|
+
</div>
|
|
150
|
+
<div className="w-full flex justify-end items-center gap-1">
|
|
151
|
+
<ToggleIconButton
|
|
152
|
+
kind="switch"
|
|
153
|
+
icon={<Scaling size={20} strokeWidth={1} />}
|
|
154
|
+
pressed={maintainAspectRatio}
|
|
155
|
+
onClick={() => {
|
|
156
|
+
setMaintainAspectRatio((prev) => !prev);
|
|
157
|
+
|
|
158
|
+
const updatedNode: WeaveStateElement = {
|
|
159
|
+
...actualNode,
|
|
160
|
+
props: {
|
|
161
|
+
...actualNode.props,
|
|
162
|
+
keepAspectRatio: !maintainAspectRatio,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
updateElement(updatedNode);
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { WeaveStateElement } from '@inditextech/weave-types';
|
|
5
5
|
import { Eye, EyeOff } from 'lucide-react';
|
|
6
|
-
import { InputColor } from '
|
|
7
|
-
import { ToggleIconButton } from '
|
|
6
|
+
import { InputColor } from '../inputs/input-color';
|
|
7
|
+
import { ToggleIconButton } from '../toggle-icon-button';
|
|
8
8
|
import { useWeave } from '@inditextech/weave-react';
|
|
9
9
|
import { useCollaborationRoom } from '@/store/store';
|
|
10
10
|
|
|
@@ -50,21 +50,26 @@ export function FillProperties() {
|
|
|
50
50
|
[instance, actualAction, nodePropertiesAction]
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
if (!instance || !
|
|
53
|
+
if (!instance || !actualNode || !nodePropertiesAction) {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (!actualAction && !actualNode)
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
57
|
+
if (!actualAction && !actualNode) return null;
|
|
60
58
|
|
|
61
59
|
if (
|
|
62
60
|
actualAction &&
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
['selectionTool'].includes(actualAction) &&
|
|
62
|
+
['text'].includes(actualNode.type)
|
|
63
|
+
) {
|
|
65
64
|
return null;
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
if (
|
|
67
|
+
if (
|
|
68
|
+
actualAction &&
|
|
69
|
+
!['selectionTool', 'rectangleTool', 'ellipseTool', 'starTool'].includes(
|
|
70
|
+
actualAction
|
|
71
|
+
)
|
|
72
|
+
) {
|
|
68
73
|
return null;
|
|
69
74
|
}
|
|
70
75
|
|