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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const getImages = async (
|
|
2
|
+
roomId: string,
|
|
3
|
+
pageSize: number,
|
|
4
|
+
page: string | undefined
|
|
5
|
+
) => {
|
|
6
|
+
let endpoint = `${process.env.NEXT_PUBLIC_API_ENDPOINT}/rooms/${roomId}/images?pageSize=${pageSize}`;
|
|
7
|
+
|
|
8
|
+
if (page) {
|
|
9
|
+
endpoint = `${endpoint}&page=${page}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const response = await fetch(endpoint);
|
|
13
|
+
const data = await response.json();
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const postImage = async (roomId: string, file: File) => {
|
|
2
|
+
const formData = new FormData();
|
|
3
|
+
formData.append('file', file);
|
|
4
|
+
|
|
5
|
+
const endpoint = `${process.env.NEXT_PUBLIC_API_ENDPOINT}/rooms/${roomId}/images`;
|
|
6
|
+
const response = await fetch(endpoint, {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
body: formData,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const data = await response.json();
|
|
12
|
+
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const postRemoveBackground = async (roomId: string, imageId: string) => {
|
|
2
|
+
const endpoint = `${process.env.NEXT_PUBLIC_API_ENDPOINT}/rooms/${roomId}/images/${imageId}/remove-background`;
|
|
3
|
+
const response = await fetch(endpoint, {
|
|
4
|
+
method: 'POST',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const data = await response.json();
|
|
8
|
+
|
|
9
|
+
return data;
|
|
10
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@plugin "tailwindcss-animate";
|
|
4
|
+
|
|
5
|
+
@custom-variant dark (&:is(.dark *));
|
|
6
|
+
|
|
7
|
+
@theme {
|
|
8
|
+
--font-noto-sans: var(--font-noto-sans);
|
|
9
|
+
--font-noto-sans-mono: var(--font-noto-sans-mono);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.custom-scrollbar {
|
|
13
|
+
scrollbar-width: thin;
|
|
14
|
+
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
|
|
15
|
+
padding-right: 6px;
|
|
16
|
+
padding-left: 6px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.custom-scrollbar::-webkit-scrollbar {
|
|
20
|
+
width: 6px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.custom-scrollbar::-webkit-scrollbar-track {
|
|
24
|
+
background: transparent;
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
29
|
+
background-color: rgba(156, 163, 175, 0.5);
|
|
30
|
+
border-radius: 10px;
|
|
31
|
+
transition: background-color 0.5s ease;
|
|
32
|
+
border: 1px solid transparent;
|
|
33
|
+
background-clip: padding-box;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
37
|
+
background-color: rgba(107, 114, 128, 0.7);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.custom-scrollbar {
|
|
41
|
+
scrollbar-width: thin;
|
|
42
|
+
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.scrollbar-gutter {
|
|
46
|
+
scrollbar-gutter: stable;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:root {
|
|
50
|
+
--background: oklch(1 0 0);
|
|
51
|
+
--foreground: oklch(0.141 0.005 285.823);
|
|
52
|
+
--card: oklch(1 0 0);
|
|
53
|
+
--card-foreground: oklch(0.141 0.005 285.823);
|
|
54
|
+
--popover: oklch(1 0 0);
|
|
55
|
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
|
56
|
+
--primary: oklch(0.21 0.006 285.885);
|
|
57
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
58
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
59
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
60
|
+
--muted: oklch(0.967 0.001 286.375);
|
|
61
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
62
|
+
--accent: oklch(0.967 0.001 286.375);
|
|
63
|
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
|
64
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
65
|
+
--destructive-foreground: oklch(0.577 0.245 27.325);
|
|
66
|
+
--border: oklch(0.92 0.004 286.32);
|
|
67
|
+
--input: oklch(0.92 0.004 286.32);
|
|
68
|
+
--ring: oklch(0.871 0.006 286.286);
|
|
69
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
70
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
71
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
72
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
73
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
74
|
+
--radius: 0.625rem;
|
|
75
|
+
--sidebar: oklch(0.985 0 0);
|
|
76
|
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
77
|
+
--sidebar-primary: oklch(0.21 0.006 285.885);
|
|
78
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
79
|
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
|
80
|
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
81
|
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
82
|
+
--sidebar-ring: oklch(0.871 0.006 286.286);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.dark {
|
|
86
|
+
--background: oklch(0.141 0.005 285.823);
|
|
87
|
+
--foreground: oklch(0.985 0 0);
|
|
88
|
+
--card: oklch(0.141 0.005 285.823);
|
|
89
|
+
--card-foreground: oklch(0.985 0 0);
|
|
90
|
+
--popover: oklch(0.141 0.005 285.823);
|
|
91
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
92
|
+
--primary: oklch(0.985 0 0);
|
|
93
|
+
--primary-foreground: oklch(0.21 0.006 285.885);
|
|
94
|
+
--secondary: oklch(0.274 0.006 286.033);
|
|
95
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
96
|
+
--muted: oklch(0.274 0.006 286.033);
|
|
97
|
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
|
98
|
+
--accent: oklch(0.274 0.006 286.033);
|
|
99
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
100
|
+
--destructive: oklch(0.396 0.141 25.723);
|
|
101
|
+
--destructive-foreground: oklch(0.637 0.237 25.331);
|
|
102
|
+
--border: oklch(0.274 0.006 286.033);
|
|
103
|
+
--input: oklch(0.274 0.006 286.033);
|
|
104
|
+
--ring: oklch(0.442 0.017 285.786);
|
|
105
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
106
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
107
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
108
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
109
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
110
|
+
--sidebar: oklch(0.21 0.006 285.885);
|
|
111
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
112
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
113
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
114
|
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
|
115
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
116
|
+
--sidebar-border: oklch(0.274 0.006 286.033);
|
|
117
|
+
--sidebar-ring: oklch(0.442 0.017 285.786);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@theme inline {
|
|
121
|
+
--color-background: var(--background);
|
|
122
|
+
--color-foreground: var(--foreground);
|
|
123
|
+
--color-card: var(--card);
|
|
124
|
+
--color-card-foreground: var(--card-foreground);
|
|
125
|
+
--color-popover: var(--popover);
|
|
126
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
127
|
+
--color-primary: var(--primary);
|
|
128
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
129
|
+
--color-secondary: var(--secondary);
|
|
130
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
131
|
+
--color-muted: var(--muted);
|
|
132
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
133
|
+
--color-accent: var(--accent);
|
|
134
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
135
|
+
--color-destructive: var(--destructive);
|
|
136
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
137
|
+
--color-border: var(--border);
|
|
138
|
+
--color-input: var(--input);
|
|
139
|
+
--color-ring: var(--ring);
|
|
140
|
+
--color-chart-1: var(--chart-1);
|
|
141
|
+
--color-chart-2: var(--chart-2);
|
|
142
|
+
--color-chart-3: var(--chart-3);
|
|
143
|
+
--color-chart-4: var(--chart-4);
|
|
144
|
+
--color-chart-5: var(--chart-5);
|
|
145
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
146
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
147
|
+
--radius-lg: var(--radius);
|
|
148
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
149
|
+
--color-sidebar: var(--sidebar);
|
|
150
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
151
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
152
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
153
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
154
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
155
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
156
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
157
|
+
--spacing-1: 4px;
|
|
158
|
+
--spacing-2: 8px;
|
|
159
|
+
--spacing-3: 12px;
|
|
160
|
+
--spacing-4: 16px;
|
|
161
|
+
--spacing-5: 20px;
|
|
162
|
+
--spacing-6: 24px;
|
|
163
|
+
--spacing-7: 32px;
|
|
164
|
+
--spacing-8: 40px;
|
|
165
|
+
--spacing-9: 48px;
|
|
166
|
+
--spacing-10: 56px;
|
|
167
|
+
--spacing-11: 64px;
|
|
168
|
+
--spacing-12: 80px;
|
|
169
|
+
--spacing-13: 96px;
|
|
170
|
+
--spacing-14: 112px;
|
|
171
|
+
--spacing-15: 128px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@layer base {
|
|
175
|
+
* {
|
|
176
|
+
@apply border-border outline-ring/50;
|
|
177
|
+
}
|
|
178
|
+
html {
|
|
179
|
+
@apply w-full h-full;
|
|
180
|
+
}
|
|
181
|
+
body {
|
|
182
|
+
@apply bg-background ring-0 text-foreground w-full h-full;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@layer base {
|
|
187
|
+
* {
|
|
188
|
+
@apply border-border outline-ring/50;
|
|
189
|
+
}
|
|
190
|
+
body {
|
|
191
|
+
@apply bg-background ring-0 text-foreground;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Metadata, Viewport } from "next";
|
|
2
|
+
import { Noto_Sans, Noto_Sans_Mono } from "next/font/google";
|
|
3
|
+
import "./globals.css";
|
|
4
|
+
import { AppProviders } from "./providers";
|
|
5
|
+
|
|
6
|
+
const notoSans = Noto_Sans({
|
|
7
|
+
preload: true,
|
|
8
|
+
variable: "--font-noto-sans",
|
|
9
|
+
subsets: ["latin"],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const notoSansMono = Noto_Sans_Mono({
|
|
13
|
+
preload: true,
|
|
14
|
+
variable: "--font-noto-sans-mono",
|
|
15
|
+
subsets: ["latin"],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const viewport: Viewport = {
|
|
19
|
+
width: "device-width",
|
|
20
|
+
initialScale: 1,
|
|
21
|
+
maximumScale: 1,
|
|
22
|
+
userScalable: false,
|
|
23
|
+
// Also supported but less commonly used
|
|
24
|
+
// interactiveWidget: 'resizes-visual',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const metadata: Metadata = {
|
|
28
|
+
title: "WeaveJS Playground",
|
|
29
|
+
description: "This is a playground for WeaveJS",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default function RootLayout({
|
|
33
|
+
children,
|
|
34
|
+
}: Readonly<{
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}>) {
|
|
37
|
+
return (
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<body
|
|
40
|
+
className={`${notoSans.variable} ${notoSansMono.variable} antialiased`}
|
|
41
|
+
>
|
|
42
|
+
<AppProviders>{children}</AppProviders>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
QueryClient,
|
|
5
|
+
QueryClientProvider,
|
|
6
|
+
} from "@tanstack/react-query";
|
|
7
|
+
|
|
8
|
+
type AppProvidersProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const queryClient = new QueryClient();
|
|
13
|
+
|
|
14
|
+
export function AppProviders({ children }: Readonly<AppProvidersProps>) {
|
|
15
|
+
return (
|
|
16
|
+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -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
|
+
}
|
package/template/+nextjs+azure-web-pubsub/components/actions/color-token-tool/color-token-tool.ts
ADDED
|
@@ -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
|
+
};
|