create-weave-frontend-app 0.1.0
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/README.md +11 -0
- package/dist/chunk-HZJMO45D.js +437 -0
- package/dist/create-app.d.ts +14 -0
- package/dist/create-app.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +106 -0
- package/package.json +65 -0
- package/template/+nextjs+azure-web-pubsub/README.md +36 -0
- package/template/+nextjs+azure-web-pubsub/api/del-image.ts +8 -0
- package/template/+nextjs+azure-web-pubsub/api/get-images.ts +15 -0
- package/template/+nextjs+azure-web-pubsub/api/post-image.ts +14 -0
- package/template/+nextjs+azure-web-pubsub/api/post-remove-background.ts +10 -0
- package/template/+nextjs+azure-web-pubsub/app/error/page.tsx +10 -0
- package/template/+nextjs+azure-web-pubsub/app/favicon.ico +0 -0
- package/template/+nextjs+azure-web-pubsub/app/globals.css +193 -0
- package/template/+nextjs+azure-web-pubsub/app/layout.tsx +46 -0
- package/template/+nextjs+azure-web-pubsub/app/page.tsx +7 -0
- package/template/+nextjs+azure-web-pubsub/app/providers.tsx +18 -0
- package/template/+nextjs+azure-web-pubsub/app/room/[roomId]/page.tsx +5 -0
- package/template/+nextjs+azure-web-pubsub/assets/images/home.png +0 -0
- package/template/+nextjs+azure-web-pubsub/assets/images/logo.png +0 -0
- package/template/+nextjs+azure-web-pubsub/components/actions/align-elements-tool/align-elements-tool.ts +94 -0
- package/template/+nextjs+azure-web-pubsub/components/actions/color-token-tool/color-token-tool.ts +164 -0
- package/template/+nextjs+azure-web-pubsub/components/actions/color-token-tool/constants.ts +5 -0
- package/template/+nextjs+azure-web-pubsub/components/actions/color-token-tool/types.ts +12 -0
- package/template/+nextjs+azure-web-pubsub/components/error/error.tsx +62 -0
- package/template/+nextjs+azure-web-pubsub/components/error/errors.ts +35 -0
- package/template/+nextjs+azure-web-pubsub/components/home/home.tsx +92 -0
- package/template/+nextjs+azure-web-pubsub/components/home-components/home-showcase-animation.tsx +119 -0
- package/template/+nextjs+azure-web-pubsub/components/home-components/login-form.tsx +117 -0
- package/template/+nextjs+azure-web-pubsub/components/nodes/color-token/color-token.ts +171 -0
- package/template/+nextjs+azure-web-pubsub/components/room/room.layout.tsx +115 -0
- package/template/+nextjs+azure-web-pubsub/components/room/room.tsx +125 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/color-tokens-library/color-token.tsx +31 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/color-tokens-library/color-tokens-library.tsx +64 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/connected-users.tsx +152 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/connection-status.tsx +52 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/context-menu.tsx +152 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/frames-library/frames-library.image.tsx +48 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/frames-library/frames-library.presentation-image.tsx +61 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/frames-library/frames-library.tsx +316 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/frames-library/utils.ts +27 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-arrange.tsx +69 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-drawer.tsx +140 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-edit.tsx +80 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-selection.tsx +30 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-shortcut-element.tsx +24 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-tools.tsx +89 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-view.tsx +30 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/help-zoom.tsx +46 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/help/shortcut-element.tsx +42 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-context-menu.tsx +514 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-get-azure-web-pubsub-provider.ts +78 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-get-os.ts +12 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-get-weave-js-props.tsx +120 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-handle-route-params.ts +30 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-key-down.ts +29 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/hooks/use-keyboard-handler.tsx +557 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/images-library/images-library.tsx +146 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/inputs/input-color.tsx +101 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/inputs/input-font-family.tsx +99 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/inputs/input-number.tsx +61 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/inputs/input-text.tsx +51 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/inputs/number-input.tsx +107 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/appearance-properties.tsx +119 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/color-token-properties.tsx +108 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/crop-properties.tsx +156 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/fill-properties.tsx +115 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/frame-properties.tsx +100 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/image-properties.tsx +57 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/position-properties.tsx +156 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/size-properties.tsx +131 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/stroke-properties.tsx +327 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/node-properties/text-properties.tsx +467 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/multiuse-overlay.tsx +127 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/node-properties.tsx +98 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/overlay-animation-wrapper.tsx +31 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/room-information-overlay.tsx +247 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/room-users-overlay.tsx +31 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/tools-overlay.tsx +289 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/variants.ts +58 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/overlay/zoom-handler-overlay.tsx +447 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/room-error.tsx +37 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/room-loader/room-loader.tsx +98 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/selection-information.tsx +74 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/toggle-icon-button.tsx +60 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/toolbar/toolbar-button.tsx +60 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/toolbar/toolbar-toggle-button.tsx +40 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/toolbar/toolbar.tsx +28 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/upload-file.tsx +130 -0
- package/template/+nextjs+azure-web-pubsub/components/room-components/with-instance-node.tsx +53 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/accordion.tsx +66 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/avatar.tsx +53 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/button.tsx +58 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/card.tsx +68 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/checkbox.tsx +32 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/color-picker-component.tsx +69 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/context/color-picker-context.tsx +28 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/editor/color-picker-format-editor.tsx +34 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/index.ts +7 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/selector/color-picker-alpha.tsx +79 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/selector/color-picker-eyedropper.tsx +95 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/selector/color-picker-format-selector.tsx +50 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/selector/color-picker-hue.tsx +67 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/selector/color-picker-saturation.tsx +145 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/text-inputs/color-picker-alpha-percentage.tsx +60 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/text-inputs/color-picker-hexa.tsx +65 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/color-picker/text-inputs/color-picker-rgba.tsx +62 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/command.tsx +177 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/dialog.tsx +135 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/drawer.tsx +132 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/dropdown-menu.tsx +201 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/form.tsx +167 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/input.tsx +21 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/label.tsx +24 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/popover.tsx +48 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/reactbits/Backgrounds/Dither/Dither.tsx +350 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/reactbits/Backgrounds/Threads/Threads.tsx +239 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/reactbits/TextAnimations/RotatingText/RotatingText.tsx +276 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/scroll-area.tsx +58 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/select.tsx +185 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/sheet.tsx +139 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/sonner.tsx +25 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/tabs.tsx +66 -0
- package/template/+nextjs+azure-web-pubsub/components/ui/tooltip.tsx +61 -0
- package/template/+nextjs+azure-web-pubsub/components/utils/constants.ts +118 -0
- package/template/+nextjs+azure-web-pubsub/components/utils/logo.tsx +34 -0
- package/template/+nextjs+azure-web-pubsub/components.json +21 -0
- package/template/+nextjs+azure-web-pubsub/example.env +2 -0
- package/template/+nextjs+azure-web-pubsub/example.gitignore +44 -0
- package/template/+nextjs+azure-web-pubsub/jsrepo.json +11 -0
- package/template/+nextjs+azure-web-pubsub/lib/utils.ts +43 -0
- package/template/+nextjs+azure-web-pubsub/new-types.d.ts +8 -0
- package/template/+nextjs+azure-web-pubsub/next-env.d.ts +5 -0
- package/template/+nextjs+azure-web-pubsub/next.config.js +52 -0
- package/template/+nextjs+azure-web-pubsub/postcss.config.mjs +5 -0
- package/template/+nextjs+azure-web-pubsub/store/store.ts +241 -0
- package/template/+nextjs+azure-web-pubsub/tsconfig.json +37 -0
- package/template/+nextjs+azure-web-pubsub/vitest.config.mts +10 -0
- package/template/+nextjs+websockets/README.md +39 -0
- package/template/+nextjs+websockets/api/del-image.ts +8 -0
- package/template/+nextjs+websockets/api/get-images.ts +15 -0
- package/template/+nextjs+websockets/api/post-image.ts +14 -0
- package/template/+nextjs+websockets/api/post-remove-background.ts +10 -0
- package/template/+nextjs+websockets/app/error/page.tsx +10 -0
- package/template/+nextjs+websockets/app/favicon.ico +0 -0
- package/template/+nextjs+websockets/app/globals.css +193 -0
- package/template/+nextjs+websockets/app/layout.tsx +46 -0
- package/template/+nextjs+websockets/app/page.tsx +7 -0
- package/template/+nextjs+websockets/app/providers.tsx +18 -0
- package/template/+nextjs+websockets/app/room/[roomId]/page.tsx +5 -0
- package/template/+nextjs+websockets/assets/images/home.png +0 -0
- package/template/+nextjs+websockets/assets/images/logo.png +0 -0
- package/template/+nextjs+websockets/components/actions/align-elements-tool/align-elements-tool.ts +94 -0
- package/template/+nextjs+websockets/components/actions/color-token-tool/color-token-tool.ts +164 -0
- package/template/+nextjs+websockets/components/actions/color-token-tool/constants.ts +5 -0
- package/template/+nextjs+websockets/components/actions/color-token-tool/types.ts +12 -0
- package/template/+nextjs+websockets/components/error/error.tsx +62 -0
- package/template/+nextjs+websockets/components/error/errors.ts +35 -0
- package/template/+nextjs+websockets/components/home/home.tsx +92 -0
- package/template/+nextjs+websockets/components/home-components/home-showcase-animation.tsx +119 -0
- package/template/+nextjs+websockets/components/home-components/login-form.tsx +117 -0
- package/template/+nextjs+websockets/components/nodes/color-token/color-token.ts +171 -0
- package/template/+nextjs+websockets/components/room/room.layout.tsx +115 -0
- package/template/+nextjs+websockets/components/room/room.tsx +125 -0
- package/template/+nextjs+websockets/components/room-components/color-tokens-library/color-token.tsx +31 -0
- package/template/+nextjs+websockets/components/room-components/color-tokens-library/color-tokens-library.tsx +64 -0
- package/template/+nextjs+websockets/components/room-components/connected-users.tsx +152 -0
- package/template/+nextjs+websockets/components/room-components/connection-status.tsx +52 -0
- package/template/+nextjs+websockets/components/room-components/context-menu.tsx +152 -0
- package/template/+nextjs+websockets/components/room-components/frames-library/frames-library.image.tsx +48 -0
- package/template/+nextjs+websockets/components/room-components/frames-library/frames-library.presentation-image.tsx +61 -0
- package/template/+nextjs+websockets/components/room-components/frames-library/frames-library.tsx +316 -0
- package/template/+nextjs+websockets/components/room-components/frames-library/utils.ts +27 -0
- package/template/+nextjs+websockets/components/room-components/help/help-arrange.tsx +69 -0
- package/template/+nextjs+websockets/components/room-components/help/help-drawer.tsx +140 -0
- package/template/+nextjs+websockets/components/room-components/help/help-edit.tsx +80 -0
- package/template/+nextjs+websockets/components/room-components/help/help-selection.tsx +30 -0
- package/template/+nextjs+websockets/components/room-components/help/help-shortcut-element.tsx +24 -0
- package/template/+nextjs+websockets/components/room-components/help/help-tools.tsx +89 -0
- package/template/+nextjs+websockets/components/room-components/help/help-view.tsx +30 -0
- package/template/+nextjs+websockets/components/room-components/help/help-zoom.tsx +46 -0
- package/template/+nextjs+websockets/components/room-components/help/shortcut-element.tsx +42 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-context-menu.tsx +514 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-get-os.ts +12 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-get-weave-js-props.tsx +120 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-get-websockets-provider.ts +79 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-handle-route-params.ts +30 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-key-down.ts +29 -0
- package/template/+nextjs+websockets/components/room-components/hooks/use-keyboard-handler.tsx +557 -0
- package/template/+nextjs+websockets/components/room-components/images-library/images-library.tsx +146 -0
- package/template/+nextjs+websockets/components/room-components/inputs/input-color.tsx +101 -0
- package/template/+nextjs+websockets/components/room-components/inputs/input-font-family.tsx +99 -0
- package/template/+nextjs+websockets/components/room-components/inputs/input-number.tsx +61 -0
- package/template/+nextjs+websockets/components/room-components/inputs/input-text.tsx +51 -0
- package/template/+nextjs+websockets/components/room-components/inputs/number-input.tsx +107 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/appearance-properties.tsx +119 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/color-token-properties.tsx +108 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/crop-properties.tsx +156 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/fill-properties.tsx +115 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/frame-properties.tsx +100 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/image-properties.tsx +57 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/position-properties.tsx +156 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/size-properties.tsx +131 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/stroke-properties.tsx +327 -0
- package/template/+nextjs+websockets/components/room-components/node-properties/text-properties.tsx +467 -0
- package/template/+nextjs+websockets/components/room-components/overlay/multiuse-overlay.tsx +127 -0
- package/template/+nextjs+websockets/components/room-components/overlay/node-properties.tsx +98 -0
- package/template/+nextjs+websockets/components/room-components/overlay/overlay-animation-wrapper.tsx +31 -0
- package/template/+nextjs+websockets/components/room-components/overlay/room-information-overlay.tsx +247 -0
- package/template/+nextjs+websockets/components/room-components/overlay/room-users-overlay.tsx +31 -0
- package/template/+nextjs+websockets/components/room-components/overlay/tools-overlay.tsx +289 -0
- package/template/+nextjs+websockets/components/room-components/overlay/variants.ts +58 -0
- package/template/+nextjs+websockets/components/room-components/overlay/zoom-handler-overlay.tsx +447 -0
- package/template/+nextjs+websockets/components/room-components/room-error.tsx +37 -0
- package/template/+nextjs+websockets/components/room-components/room-loader/room-loader.tsx +98 -0
- package/template/+nextjs+websockets/components/room-components/selection-information.tsx +74 -0
- package/template/+nextjs+websockets/components/room-components/toggle-icon-button.tsx +60 -0
- package/template/+nextjs+websockets/components/room-components/toolbar/toolbar-button.tsx +60 -0
- package/template/+nextjs+websockets/components/room-components/toolbar/toolbar-toggle-button.tsx +40 -0
- package/template/+nextjs+websockets/components/room-components/toolbar/toolbar.tsx +28 -0
- package/template/+nextjs+websockets/components/room-components/upload-file.tsx +130 -0
- package/template/+nextjs+websockets/components/room-components/with-instance-node.tsx +53 -0
- package/template/+nextjs+websockets/components/ui/accordion.tsx +66 -0
- package/template/+nextjs+websockets/components/ui/avatar.tsx +53 -0
- package/template/+nextjs+websockets/components/ui/button.tsx +58 -0
- package/template/+nextjs+websockets/components/ui/card.tsx +68 -0
- package/template/+nextjs+websockets/components/ui/checkbox.tsx +32 -0
- package/template/+nextjs+websockets/components/ui/color-picker/color-picker-component.tsx +69 -0
- package/template/+nextjs+websockets/components/ui/color-picker/context/color-picker-context.tsx +28 -0
- package/template/+nextjs+websockets/components/ui/color-picker/editor/color-picker-format-editor.tsx +34 -0
- package/template/+nextjs+websockets/components/ui/color-picker/index.ts +7 -0
- package/template/+nextjs+websockets/components/ui/color-picker/selector/color-picker-alpha.tsx +79 -0
- package/template/+nextjs+websockets/components/ui/color-picker/selector/color-picker-eyedropper.tsx +95 -0
- package/template/+nextjs+websockets/components/ui/color-picker/selector/color-picker-format-selector.tsx +50 -0
- package/template/+nextjs+websockets/components/ui/color-picker/selector/color-picker-hue.tsx +67 -0
- package/template/+nextjs+websockets/components/ui/color-picker/selector/color-picker-saturation.tsx +145 -0
- package/template/+nextjs+websockets/components/ui/color-picker/text-inputs/color-picker-alpha-percentage.tsx +60 -0
- package/template/+nextjs+websockets/components/ui/color-picker/text-inputs/color-picker-hexa.tsx +65 -0
- package/template/+nextjs+websockets/components/ui/color-picker/text-inputs/color-picker-rgba.tsx +62 -0
- package/template/+nextjs+websockets/components/ui/command.tsx +177 -0
- package/template/+nextjs+websockets/components/ui/dialog.tsx +135 -0
- package/template/+nextjs+websockets/components/ui/drawer.tsx +132 -0
- package/template/+nextjs+websockets/components/ui/dropdown-menu.tsx +201 -0
- package/template/+nextjs+websockets/components/ui/form.tsx +167 -0
- package/template/+nextjs+websockets/components/ui/input.tsx +21 -0
- package/template/+nextjs+websockets/components/ui/label.tsx +24 -0
- package/template/+nextjs+websockets/components/ui/popover.tsx +48 -0
- package/template/+nextjs+websockets/components/ui/reactbits/Backgrounds/Dither/Dither.tsx +350 -0
- package/template/+nextjs+websockets/components/ui/reactbits/Backgrounds/Threads/Threads.tsx +239 -0
- package/template/+nextjs+websockets/components/ui/reactbits/TextAnimations/RotatingText/RotatingText.tsx +276 -0
- package/template/+nextjs+websockets/components/ui/scroll-area.tsx +58 -0
- package/template/+nextjs+websockets/components/ui/select.tsx +185 -0
- package/template/+nextjs+websockets/components/ui/sheet.tsx +139 -0
- package/template/+nextjs+websockets/components/ui/sonner.tsx +25 -0
- package/template/+nextjs+websockets/components/ui/tabs.tsx +66 -0
- package/template/+nextjs+websockets/components/ui/tooltip.tsx +61 -0
- package/template/+nextjs+websockets/components/utils/constants.ts +118 -0
- package/template/+nextjs+websockets/components/utils/logo.tsx +34 -0
- package/template/+nextjs+websockets/components.json +21 -0
- package/template/+nextjs+websockets/example.env +2 -0
- package/template/+nextjs+websockets/example.gitignore +44 -0
- package/template/+nextjs+websockets/jsrepo.json +11 -0
- package/template/+nextjs+websockets/lib/utils.ts +43 -0
- package/template/+nextjs+websockets/new-types.d.ts +8 -0
- package/template/+nextjs+websockets/next-env.d.ts +5 -0
- package/template/+nextjs+websockets/next.config.js +52 -0
- package/template/+nextjs+websockets/postcss.config.mjs +5 -0
- package/template/+nextjs+websockets/store/store.ts +241 -0
- package/template/+nextjs+websockets/tsconfig.json +37 -0
- package/template/+nextjs+websockets/vitest.config.mts +10 -0
- package/template/package.json +81 -0
package/template/+nextjs+websockets/components/actions/align-elements-tool/align-elements-tool.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { WeaveAction } from '@inditextech/weave-sdk';
|
|
2
|
+
import { WeaveElementInstance, WeaveSelection } from '@inditextech/weave-types';
|
|
3
|
+
import Konva from 'konva';
|
|
4
|
+
|
|
5
|
+
export class AlignElementsToolAction extends WeaveAction {
|
|
6
|
+
protected cancelAction!: () => void;
|
|
7
|
+
internalUpdate = undefined;
|
|
8
|
+
init = undefined;
|
|
9
|
+
|
|
10
|
+
getName(): string {
|
|
11
|
+
return 'alignElementsTool';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private alignElements(nodes: WeaveSelection[], gap: number) {
|
|
15
|
+
if (nodes.length === 0) {
|
|
16
|
+
this.cancelAction?.();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const instances: Konva.Node[] = [];
|
|
21
|
+
let actualType: string | undefined = nodes[0].node.type;
|
|
22
|
+
for (const node of nodes) {
|
|
23
|
+
if (node.instance.getAttrs().nodeType === actualType) {
|
|
24
|
+
instances.push(node.instance);
|
|
25
|
+
}
|
|
26
|
+
if (node.instance.getAttrs().nodeType !== actualType) {
|
|
27
|
+
actualType = undefined;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!actualType) {
|
|
33
|
+
this.cancelAction?.();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let y: number | undefined = undefined;
|
|
38
|
+
let prevInstance: Konva.Node | undefined = undefined;
|
|
39
|
+
for (const [index, instance] of instances.entries()) {
|
|
40
|
+
if (index === 0) {
|
|
41
|
+
prevInstance = instance;
|
|
42
|
+
y = instance.y();
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (prevInstance) {
|
|
47
|
+
const handler = this.instance.getNodeHandler(
|
|
48
|
+
instance.getAttrs().nodeType
|
|
49
|
+
);
|
|
50
|
+
const node = handler.toNode(instance as WeaveElementInstance);
|
|
51
|
+
|
|
52
|
+
const newNode = {
|
|
53
|
+
...node,
|
|
54
|
+
props: {
|
|
55
|
+
...node.props,
|
|
56
|
+
x: (prevInstance.x() ?? 0) + (prevInstance.width() ?? 0) + gap,
|
|
57
|
+
y,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
instance.setAttrs({
|
|
62
|
+
x: (prevInstance.x() ?? 0) + (prevInstance.width() ?? 0) + gap,
|
|
63
|
+
y,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
this.instance.updateNode(newNode);
|
|
67
|
+
|
|
68
|
+
prevInstance = instance;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.cancelAction?.();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
trigger(
|
|
76
|
+
cancelAction: () => void,
|
|
77
|
+
{ gap = 20, nodes }: { gap: number; nodes: WeaveSelection[] }
|
|
78
|
+
) {
|
|
79
|
+
if (!this.instance) {
|
|
80
|
+
throw new Error('Instance not defined');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const stage = this.instance.getStage();
|
|
84
|
+
|
|
85
|
+
stage.container().tabIndex = 1;
|
|
86
|
+
stage.container().focus();
|
|
87
|
+
|
|
88
|
+
this.cancelAction = cancelAction;
|
|
89
|
+
|
|
90
|
+
this.alignElements(nodes, gap);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
cleanup() {}
|
|
94
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { Vector2d } from 'konva/lib/types';
|
|
3
|
+
import {
|
|
4
|
+
ColorTokenToolCallbacks,
|
|
5
|
+
ColorTokenToolActionState,
|
|
6
|
+
ColorTokenToolActionTriggerParams,
|
|
7
|
+
} from './types';
|
|
8
|
+
import { COLOR_TOKEN_TOOL_STATE } from './constants';
|
|
9
|
+
import { WeaveAction, WeaveNodesSelectionPlugin } from '@inditextech/weave-sdk';
|
|
10
|
+
import Konva from 'konva';
|
|
11
|
+
|
|
12
|
+
export class ColorTokenToolAction extends WeaveAction {
|
|
13
|
+
protected initialized: boolean = false;
|
|
14
|
+
protected state: ColorTokenToolActionState;
|
|
15
|
+
protected colorTokenId: string | null;
|
|
16
|
+
protected container: Konva.Layer | Konva.Group | undefined;
|
|
17
|
+
protected clickPoint: Vector2d | null;
|
|
18
|
+
protected cancelAction!: () => void;
|
|
19
|
+
internalUpdate = undefined;
|
|
20
|
+
|
|
21
|
+
constructor(callbacks: ColorTokenToolCallbacks) {
|
|
22
|
+
super(callbacks);
|
|
23
|
+
|
|
24
|
+
this.initialized = false;
|
|
25
|
+
this.state = COLOR_TOKEN_TOOL_STATE.IDLE;
|
|
26
|
+
this.colorTokenId = null;
|
|
27
|
+
this.container = undefined;
|
|
28
|
+
this.clickPoint = null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getName(): string {
|
|
32
|
+
return 'colorTokenTool';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
initProps() {
|
|
36
|
+
return {
|
|
37
|
+
colorToken: '#000000',
|
|
38
|
+
width: 300,
|
|
39
|
+
height: 300,
|
|
40
|
+
opacity: 1,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
init() {
|
|
45
|
+
this.instance.addEventListener('onStageDrop', () => {
|
|
46
|
+
if (window.colorTokenDragColor) {
|
|
47
|
+
this.instance.triggerAction('colorTokenTool', {
|
|
48
|
+
color: window.colorTokenDragColor,
|
|
49
|
+
});
|
|
50
|
+
window.colorTokenDragColor = undefined;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private setupEvents() {
|
|
56
|
+
const stage = this.instance.getStage();
|
|
57
|
+
|
|
58
|
+
stage.container().addEventListener('keydown', (e) => {
|
|
59
|
+
if (e.key === 'Escape') {
|
|
60
|
+
this.cancelAction();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
stage.on('click tap', (e) => {
|
|
66
|
+
e.evt.preventDefault();
|
|
67
|
+
|
|
68
|
+
if (this.state === COLOR_TOKEN_TOOL_STATE.IDLE) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.state === COLOR_TOKEN_TOOL_STATE.ADDING) {
|
|
73
|
+
this.handleAdding();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
this.initialized = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private setState(state: ColorTokenToolActionState) {
|
|
82
|
+
this.state = state;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private addColorToken() {
|
|
86
|
+
const stage = this.instance.getStage();
|
|
87
|
+
|
|
88
|
+
stage.container().style.cursor = 'crosshair';
|
|
89
|
+
stage.container().focus();
|
|
90
|
+
|
|
91
|
+
this.colorTokenId = null;
|
|
92
|
+
this.clickPoint = null;
|
|
93
|
+
this.setState(COLOR_TOKEN_TOOL_STATE.ADDING);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private handleAdding() {
|
|
97
|
+
const { mousePoint, container } = this.instance.getMousePointer();
|
|
98
|
+
|
|
99
|
+
this.clickPoint = mousePoint;
|
|
100
|
+
this.container = container;
|
|
101
|
+
|
|
102
|
+
this.colorTokenId = uuidv4();
|
|
103
|
+
|
|
104
|
+
const nodeHandler = this.instance.getNodeHandler('color-token');
|
|
105
|
+
|
|
106
|
+
const node = nodeHandler.createNode(this.colorTokenId, {
|
|
107
|
+
...this.props,
|
|
108
|
+
x: this.clickPoint.x,
|
|
109
|
+
y: this.clickPoint.y,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
this.instance.addNode(node, this.container?.getAttrs().id);
|
|
113
|
+
|
|
114
|
+
this.cancelAction?.();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
trigger(
|
|
118
|
+
cancelAction: () => void,
|
|
119
|
+
params?: ColorTokenToolActionTriggerParams
|
|
120
|
+
) {
|
|
121
|
+
if (!this.instance) {
|
|
122
|
+
throw new Error('Instance not defined');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!this.initialized) {
|
|
126
|
+
this.setupEvents();
|
|
127
|
+
}
|
|
128
|
+
const stage = this.instance.getStage();
|
|
129
|
+
|
|
130
|
+
stage.container().tabIndex = 1;
|
|
131
|
+
stage.container().focus();
|
|
132
|
+
|
|
133
|
+
this.cancelAction = cancelAction;
|
|
134
|
+
|
|
135
|
+
this.props = this.initProps();
|
|
136
|
+
|
|
137
|
+
if (params?.color) {
|
|
138
|
+
this.props.colorToken = params.color;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.addColorToken();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
cleanup() {
|
|
145
|
+
const stage = this.instance.getStage();
|
|
146
|
+
|
|
147
|
+
stage.container().style.cursor = 'default';
|
|
148
|
+
|
|
149
|
+
const selectionPlugin =
|
|
150
|
+
this.instance.getPlugin<WeaveNodesSelectionPlugin>('nodesSelection');
|
|
151
|
+
if (selectionPlugin) {
|
|
152
|
+
const node = stage.findOne(`#${this.colorTokenId}`);
|
|
153
|
+
if (node) {
|
|
154
|
+
selectionPlugin.setSelectedNodes([node]);
|
|
155
|
+
}
|
|
156
|
+
this.instance.triggerAction('selectionTool');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.colorTokenId = null;
|
|
160
|
+
this.container = undefined;
|
|
161
|
+
this.clickPoint = null;
|
|
162
|
+
this.setState(COLOR_TOKEN_TOOL_STATE.IDLE);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WeaveActionCallbacks } from '@inditextech/weave-sdk';
|
|
2
|
+
import { COLOR_TOKEN_TOOL_STATE } from './constants';
|
|
3
|
+
|
|
4
|
+
export type ColorTokenToolActionStateKeys = keyof typeof COLOR_TOKEN_TOOL_STATE;
|
|
5
|
+
export type ColorTokenToolActionState =
|
|
6
|
+
(typeof COLOR_TOKEN_TOOL_STATE)[ColorTokenToolActionStateKeys];
|
|
7
|
+
|
|
8
|
+
export type ColorTokenToolCallbacks = WeaveActionCallbacks;
|
|
9
|
+
|
|
10
|
+
export type ColorTokenToolActionTriggerParams = {
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { AlertCircle } from "lucide-react";
|
|
7
|
+
import {
|
|
8
|
+
Card,
|
|
9
|
+
CardContent,
|
|
10
|
+
CardFooter,
|
|
11
|
+
CardHeader,
|
|
12
|
+
} from "@/components/ui/card";
|
|
13
|
+
import { Logo } from "@/components/utils/logo";
|
|
14
|
+
import { useSearchParams } from "next/navigation";
|
|
15
|
+
import { getError } from "./errors";
|
|
16
|
+
|
|
17
|
+
export const Error = () => {
|
|
18
|
+
const searchParams = useSearchParams();
|
|
19
|
+
|
|
20
|
+
const errorCode = searchParams.get("errorCode");
|
|
21
|
+
|
|
22
|
+
const { description, action, href } = getError(errorCode || "");
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="flex min-h-screen flex-col items-center justify-center bg-background relative">
|
|
26
|
+
<div className="absolute left-8 top-8 text-lg font-semibold text-primary">
|
|
27
|
+
<h1 className="text-4xl font-noto-sans-mono font-extralight text-foreground uppercase">
|
|
28
|
+
Whiteboard
|
|
29
|
+
</h1>
|
|
30
|
+
<h2 className="text-2xl font-noto-sans-mono font-extralight text-muted-foreground uppercase">
|
|
31
|
+
Error
|
|
32
|
+
</h2>
|
|
33
|
+
</div>
|
|
34
|
+
<div className="absolute left-8 bottom-8 text-lg font-semibold text-primary">
|
|
35
|
+
<Logo />
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<Card className="mx-auto max-w-md shadow-lg border-0 shadow-none">
|
|
39
|
+
<CardHeader className="flex flex-col items-center text-center">
|
|
40
|
+
<div className="mb-4 rounded-full bg-destructive/10 p-3">
|
|
41
|
+
<AlertCircle className="h-10 w-10 text-destructive" />
|
|
42
|
+
</div>
|
|
43
|
+
<h3 className="text-xl font-noto-sans font-extralight">
|
|
44
|
+
An error has occurred
|
|
45
|
+
</h3>
|
|
46
|
+
</CardHeader>
|
|
47
|
+
|
|
48
|
+
<CardContent className="text-center">
|
|
49
|
+
<p>
|
|
50
|
+
<span className="text-sm font-noto-sans-mono">{description}</span>
|
|
51
|
+
</p>
|
|
52
|
+
</CardContent>
|
|
53
|
+
|
|
54
|
+
<CardFooter className="flex flex-col mt-3">
|
|
55
|
+
<Button asChild className="w-full font-noto-sans-mono uppercase">
|
|
56
|
+
<Link href={href}>{action}</Link>
|
|
57
|
+
</Button>
|
|
58
|
+
</CardFooter>
|
|
59
|
+
</Card>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const errors = {
|
|
2
|
+
"room-required-parameters": {
|
|
3
|
+
description: "No room or username defined.",
|
|
4
|
+
action: "Back to Home",
|
|
5
|
+
href: "/",
|
|
6
|
+
},
|
|
7
|
+
"room-failed-connection": {
|
|
8
|
+
description: "Failed to obtain the room connection endpoint.",
|
|
9
|
+
action: "Back to Home",
|
|
10
|
+
href: "/",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type CommonErrors = {
|
|
15
|
+
[key: string]: {
|
|
16
|
+
description: string;
|
|
17
|
+
action: string;
|
|
18
|
+
href: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const COMMON_ERRORS: CommonErrors = {
|
|
23
|
+
"room-required-parameters": errors["room-required-parameters"],
|
|
24
|
+
"room-failed-connection": errors["room-failed-connection"],
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getError = (errorCode: string) => {
|
|
28
|
+
return (
|
|
29
|
+
COMMON_ERRORS[errorCode] || {
|
|
30
|
+
description: "An unknown error occurred.",
|
|
31
|
+
action: "Back to Home",
|
|
32
|
+
href: "/",
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Toaster } from "@/components/ui/sonner";
|
|
5
|
+
import { motion } from "motion/react";
|
|
6
|
+
import { Logo } from "@/components/utils/logo";
|
|
7
|
+
import LoginForm from "../home-components/login-form";
|
|
8
|
+
import Dither from "../ui/reactbits/Backgrounds/Dither/Dither";
|
|
9
|
+
import RotatingText from "../ui/reactbits/TextAnimations/RotatingText/RotatingText";
|
|
10
|
+
|
|
11
|
+
export const Home = () => {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<main className="w-full h-full grid grid-cols-2">
|
|
15
|
+
<motion.section
|
|
16
|
+
initial={{ opacity: 0, x: -20 }}
|
|
17
|
+
animate={{ opacity: 1, x: 0 }}
|
|
18
|
+
transition={{ duration: 0.5 }}
|
|
19
|
+
className="relative flex h-full w-full flex-col items-center justify-center p-6"
|
|
20
|
+
>
|
|
21
|
+
<div className="absolute left-6 top-6 flex flex-col gap-2 md:left-8 md:top-8">
|
|
22
|
+
<motion.div
|
|
23
|
+
initial={{ opacity: 0, y: -20 }}
|
|
24
|
+
animate={{ opacity: 1, y: 0 }}
|
|
25
|
+
transition={{ duration: 0.5, delay: 0.2 }}
|
|
26
|
+
className="flex flex-col items-start justify-start bg-background"
|
|
27
|
+
>
|
|
28
|
+
<h1 className="text-5xl font-noto-sans-mono font-extralight text-foreground uppercase">
|
|
29
|
+
WHITEBOARD
|
|
30
|
+
</h1>
|
|
31
|
+
<h2 className="text-3xl font-noto-sans-mono font-extralight text-muted-foreground uppercase mb-8">
|
|
32
|
+
SHOWCASE
|
|
33
|
+
</h2>
|
|
34
|
+
</motion.div>
|
|
35
|
+
</div>
|
|
36
|
+
<h3 className="text-2xl font-noto-sans-mono font-extralight text-muted-foreground uppercase mb-8">
|
|
37
|
+
Join a Room
|
|
38
|
+
</h3>
|
|
39
|
+
<LoginForm />
|
|
40
|
+
<div className="absolute bottom-8 left-8 flex flex-col gap-5 justify-center items-center">
|
|
41
|
+
<div className="p-0 bg-light-background-1 flex justify-start items-center gap-2">
|
|
42
|
+
<Logo />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</motion.section>
|
|
46
|
+
<motion.aside
|
|
47
|
+
initial={{ opacity: 0 }}
|
|
48
|
+
animate={{ opacity: 1 }}
|
|
49
|
+
transition={{ duration: 0.8 }}
|
|
50
|
+
className="relative items-center justify-center bg-muted"
|
|
51
|
+
>
|
|
52
|
+
<Dither
|
|
53
|
+
waveColor={[0.5, 0.5, 0.5]}
|
|
54
|
+
disableAnimation={false}
|
|
55
|
+
enableMouseInteraction={false}
|
|
56
|
+
mouseRadius={0.3}
|
|
57
|
+
colorNum={6}
|
|
58
|
+
pixelSize={1}
|
|
59
|
+
waveAmplitude={0.1}
|
|
60
|
+
waveFrequency={6}
|
|
61
|
+
waveSpeed={0.05}
|
|
62
|
+
/>
|
|
63
|
+
<div className="absolute top-0 left-0 right-0 bottom-0 flex gap-3 justify-center items-center">
|
|
64
|
+
<div className="font-noto-sans-mono bg-transparent text-black p-3 rounded-lg text-4xl">
|
|
65
|
+
Weave.js is
|
|
66
|
+
</div>
|
|
67
|
+
<RotatingText
|
|
68
|
+
texts={[
|
|
69
|
+
"collaborative",
|
|
70
|
+
"easy to use",
|
|
71
|
+
"extensible",
|
|
72
|
+
"flexible",
|
|
73
|
+
"open source",
|
|
74
|
+
]}
|
|
75
|
+
mainClassName="font-noto-sans-mono p-3 bg-orange-400/50 text-black overflow-hidden justify-center rounded-lg text-4xl"
|
|
76
|
+
staggerFrom={"last"}
|
|
77
|
+
initial={{ y: "100%" }}
|
|
78
|
+
animate={{ y: 0 }}
|
|
79
|
+
exit={{ y: "-120%" }}
|
|
80
|
+
staggerDuration={0.025}
|
|
81
|
+
splitBy="characters"
|
|
82
|
+
splitLevelClassName="overflow-hidden pb-0.5 sm:pb-1 md:pb-1"
|
|
83
|
+
transition={{ type: "spring", damping: 30, stiffness: 400 }}
|
|
84
|
+
rotationInterval={2000}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
</motion.aside>
|
|
88
|
+
</main>
|
|
89
|
+
<Toaster />
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type React from "react"
|
|
4
|
+
import { motion } from "framer-motion"
|
|
5
|
+
|
|
6
|
+
const draw = {
|
|
7
|
+
hidden: { pathLength: 0, opacity: 0 },
|
|
8
|
+
visible: (i: number) => {
|
|
9
|
+
const delay = 1 + i * 0.5
|
|
10
|
+
return {
|
|
11
|
+
pathLength: 1,
|
|
12
|
+
opacity: 1,
|
|
13
|
+
transition: {
|
|
14
|
+
pathLength: { delay, type: "spring", duration: 1.5, bounce: 0 },
|
|
15
|
+
opacity: { delay, duration: 0.01 },
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const HomeShowCaseAnimation: React.FC = () => {
|
|
22
|
+
return (
|
|
23
|
+
<motion.svg
|
|
24
|
+
width="600"
|
|
25
|
+
height="600"
|
|
26
|
+
viewBox="0 0 600 600"
|
|
27
|
+
initial="hidden"
|
|
28
|
+
animate="visible"
|
|
29
|
+
className="max-w-full h-auto"
|
|
30
|
+
>
|
|
31
|
+
<motion.rect x="50" y="50" width="500" height="500" rx="30" fill="#f0f0f0" stroke="#e0e0e0" strokeWidth="5" />
|
|
32
|
+
|
|
33
|
+
<motion.path
|
|
34
|
+
d="M150 400 Q150 300 300 200 Q450 300 450 400 L450 400 Q450 420 430 420 L170 420 Q150 420 150 400 Z"
|
|
35
|
+
stroke="#ff6b6b"
|
|
36
|
+
strokeWidth="4"
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
fill="none"
|
|
40
|
+
variants={draw}
|
|
41
|
+
custom={0}
|
|
42
|
+
/>
|
|
43
|
+
<motion.path
|
|
44
|
+
d="M250 420 L250 340 Q250 320 270 320 L330 320 Q350 320 350 340 L350 420"
|
|
45
|
+
stroke="#ff6b6b"
|
|
46
|
+
strokeWidth="4"
|
|
47
|
+
strokeLinecap="round"
|
|
48
|
+
strokeLinejoin="round"
|
|
49
|
+
fill="none"
|
|
50
|
+
variants={draw}
|
|
51
|
+
custom={1}
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<motion.path
|
|
55
|
+
d="M380 180 Q410 140 450 160 Q490 160 490 200 Q490 240 450 240 Q430 270 390 240 Q350 240 350 200 Q350 160 380 180 Z"
|
|
56
|
+
stroke="#4ecdc4"
|
|
57
|
+
strokeWidth="4"
|
|
58
|
+
strokeLinecap="round"
|
|
59
|
+
strokeLinejoin="round"
|
|
60
|
+
fill="none"
|
|
61
|
+
variants={draw}
|
|
62
|
+
custom={2}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<motion.path
|
|
66
|
+
d="M120 450 Q120 380 150 380 Q180 380 180 450 M150 380 Q120 340 150 300 Q180 340 150 380"
|
|
67
|
+
stroke="#45b7d1"
|
|
68
|
+
strokeWidth="4"
|
|
69
|
+
strokeLinecap="round"
|
|
70
|
+
strokeLinejoin="round"
|
|
71
|
+
fill="none"
|
|
72
|
+
variants={draw}
|
|
73
|
+
custom={3}
|
|
74
|
+
/>
|
|
75
|
+
<motion.path
|
|
76
|
+
d="M470 450 Q470 380 500 380 Q530 380 530 450 M500 380 Q470 340 500 300 Q530 340 500 380"
|
|
77
|
+
stroke="#45b7d1"
|
|
78
|
+
strokeWidth="4"
|
|
79
|
+
strokeLinecap="round"
|
|
80
|
+
strokeLinejoin="round"
|
|
81
|
+
fill="none"
|
|
82
|
+
variants={draw}
|
|
83
|
+
custom={4}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
<motion.circle
|
|
87
|
+
cx="200"
|
|
88
|
+
cy="200"
|
|
89
|
+
r="5"
|
|
90
|
+
fill="#ff6b6b"
|
|
91
|
+
animate={{
|
|
92
|
+
x: [0, 100, 0],
|
|
93
|
+
y: [0, 50, 0],
|
|
94
|
+
}}
|
|
95
|
+
transition={{
|
|
96
|
+
duration: 5,
|
|
97
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
98
|
+
repeatType: "reverse",
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
<motion.circle
|
|
102
|
+
cx="400"
|
|
103
|
+
cy="400"
|
|
104
|
+
r="5"
|
|
105
|
+
fill="#4ecdc4"
|
|
106
|
+
animate={{
|
|
107
|
+
x: [0, -50, 0],
|
|
108
|
+
y: [0, -100, 0],
|
|
109
|
+
}}
|
|
110
|
+
transition={{
|
|
111
|
+
duration: 4,
|
|
112
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
113
|
+
repeatType: "reverse",
|
|
114
|
+
}}
|
|
115
|
+
/>
|
|
116
|
+
</motion.svg>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { motion } from "motion/react";
|
|
5
|
+
import { useRouter } from "next/navigation";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
8
|
+
import { useForm } from "react-hook-form";
|
|
9
|
+
import {
|
|
10
|
+
Form,
|
|
11
|
+
FormControl,
|
|
12
|
+
FormField,
|
|
13
|
+
FormItem,
|
|
14
|
+
FormLabel,
|
|
15
|
+
FormMessage,
|
|
16
|
+
} from "@/components/ui/form";
|
|
17
|
+
import { Input } from "@/components/ui/input";
|
|
18
|
+
import { Button } from "@/components/ui/button";
|
|
19
|
+
import { useCollaborationRoom } from "@/store/store";
|
|
20
|
+
|
|
21
|
+
const formSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
username: z
|
|
24
|
+
.string()
|
|
25
|
+
.trim()
|
|
26
|
+
.min(1, { message: "The username is required" })
|
|
27
|
+
.max(50, { message: "The username must be maximum 50 characters long" }),
|
|
28
|
+
roomId: z
|
|
29
|
+
.string()
|
|
30
|
+
.trim()
|
|
31
|
+
.min(1, { message: "The room name is required" })
|
|
32
|
+
.max(50, { message: "The room name must be maximum 50 characters long" }),
|
|
33
|
+
})
|
|
34
|
+
.required();
|
|
35
|
+
|
|
36
|
+
function LoginForm() {
|
|
37
|
+
const router = useRouter();
|
|
38
|
+
|
|
39
|
+
const setRoom = useCollaborationRoom((state) => state.setRoom);
|
|
40
|
+
const setUser = useCollaborationRoom((state) => state.setUser);
|
|
41
|
+
|
|
42
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
|
43
|
+
resolver: zodResolver(formSchema),
|
|
44
|
+
defaultValues: {
|
|
45
|
+
username: "",
|
|
46
|
+
roomId: "",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
function onSubmit(values: z.infer<typeof formSchema>) {
|
|
51
|
+
setRoom(values.roomId);
|
|
52
|
+
setUser({
|
|
53
|
+
name: values.username,
|
|
54
|
+
email: `${values.username}@weavejs.com`,
|
|
55
|
+
});
|
|
56
|
+
router.push(`/room/${values.roomId}?userName=${values.username}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<motion.div
|
|
61
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
62
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
63
|
+
transition={{ duration: 0.5, delay: 0.4 }}
|
|
64
|
+
className="w-full max-w-md"
|
|
65
|
+
>
|
|
66
|
+
<Form {...form}>
|
|
67
|
+
<form
|
|
68
|
+
onSubmit={form.handleSubmit(onSubmit)}
|
|
69
|
+
className="w-full space-y-5"
|
|
70
|
+
>
|
|
71
|
+
<FormField
|
|
72
|
+
control={form.control}
|
|
73
|
+
name="roomId"
|
|
74
|
+
render={({ field }) => (
|
|
75
|
+
<FormItem>
|
|
76
|
+
<FormLabel className="font-noto-sans-mono">ROOM</FormLabel>
|
|
77
|
+
<FormControl>
|
|
78
|
+
<Input
|
|
79
|
+
placeholder="the room name to join"
|
|
80
|
+
className="font-noto-sans-mono rounded-none shadow-none"
|
|
81
|
+
{...field}
|
|
82
|
+
/>
|
|
83
|
+
</FormControl>
|
|
84
|
+
<FormMessage />
|
|
85
|
+
</FormItem>
|
|
86
|
+
)}
|
|
87
|
+
/>
|
|
88
|
+
<FormField
|
|
89
|
+
control={form.control}
|
|
90
|
+
name="username"
|
|
91
|
+
render={({ field }) => (
|
|
92
|
+
<FormItem>
|
|
93
|
+
<FormLabel className="font-noto-sans-mono">USERNAME</FormLabel>
|
|
94
|
+
<FormControl>
|
|
95
|
+
<Input
|
|
96
|
+
placeholder="your username"
|
|
97
|
+
className="font-noto-sans-mono rounded-none shadow-none"
|
|
98
|
+
{...field}
|
|
99
|
+
/>
|
|
100
|
+
</FormControl>
|
|
101
|
+
<FormMessage />
|
|
102
|
+
</FormItem>
|
|
103
|
+
)}
|
|
104
|
+
/>
|
|
105
|
+
<Button
|
|
106
|
+
type="submit"
|
|
107
|
+
className="w-full cursor-pointer font-mono rounded-none"
|
|
108
|
+
>
|
|
109
|
+
ENTER THE ROOM
|
|
110
|
+
</Button>
|
|
111
|
+
</form>
|
|
112
|
+
</Form>
|
|
113
|
+
</motion.div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default LoginForm;
|