<div align="center">
# ð¨ UI
**ðº Contents â [â¹ï¸ About](#about) · [𦾠Technology](#technology) · [ð Structure](#structure) · [ð¤ Conventions](#conventions)**
**[â¬ï¸ Top-Level README](../../README.md)**
![ManStandingBeforeUI](../../misc/ManStandingBeforeUI.png)
</div>
# <a id="about" href="#about">â¹ï¸ About</a>
_Welcome to the UI package for StableStudio!_
**If you're ready to dive in and make changes, be sure to read about [technology](#technology), [structure](#structure), [conventions](#conventions), and [plugins](../stablestudio-plugin/README.md) first.**
## ð History
StableStudio represents a new direction for [DreamStudio](https://dreamstudio.ai) with renewed focus on open-source and community-driven development, but the project has an interesting backstory...
- **Pre-Stable Diffusion Launch**
_Summer 2022_
[DreamStudio](https://dreamstudio.ai) began as passion-project by [@nin](https://twitter.com/nin_artificial) with the goal of creating an all-in-one creative studio for generative animations using Disco Diffusion. He and several collaborators wrote the original UI using Vue.js and a local Python back-end. With the imminent arrival of Stable Diffusion, focus shifted toward creating an easy-to-use interface for image generation so the release of the model would be as accessible as possible.
- **Post-Stable Diffusion Launch**
_August 2022 â November 2022_
Following the release of Stable Diffusion, [DreamStudio](https://dreamstudio.ai) served as a vehicle for new models and features shipped by [Stability AI](http://stability.ai). This period saw the introduction of [in-painting](https://platform.stability.ai/docs/features/inpainting?tab=typescript), [out-painting](https://platform.stability.ai/docs/features/inpainting?tab=typescript), and [image-to-image](https://platform.stability.ai/docs/features/image-to-image?tab=typescript).
- **React**
_December 2022 â April 2023_
In early December, work began on a new infinite-canvas version of the existing editor. Given the need to manage complicated state and side effects declaratively, the decision was made to switch the editor to React. Once a working editor MVP was finished, the opportunity was taken to rewrite the entire app while also shipping a re-imagined UX.
- **StableStudio**
_Present â Future_
The breakneck speed of the Stable Diffusion community has proven distributing generative AI is better achieved through open-source development. We're hopeful StableStudio can serve as a hub for community collaboration and a home for exciting new features.
# <a id="technology" href="#technology">𦾠Technology</a>
![SorcererWithReact](../../misc/SorcererWithReact.png)
- **[TypeScript](https://www.typescriptlang.org/)** â Type safety ftw!
- **[Vite](https://vitejs.dev/)** â Bundler and live-development tool. You can see the full config in [`vite.config.ts`](./vite.config.ts)
- **[React](https://reactjs.org/)** â We're using React with modern hooks and functional components
- **[Zustand](https://docs.pmnd.rs/zustand/getting-started/introduction)** â Extremely fast and easy-to-use state management, it's powerful and tiny!
- **[Tailwind](https://tailwindcss.com/)** â Our preferred method of styling components, the config is at [`tailwind.config.js`](./tailwind.config.cjs)
- **[Emotion](https://emotion.sh/docs/introduction)** â For when we need to break free of Tailwind and write "native CSS"
# <a id="structure" href="#structure">ð Structure</a>
![CyberPyramid](../../misc/CyberPyramid.png)
## 𧱠Domain-Driven Design
**The most important aspect of this codebase's structure is adherence to domain-driven design.**
This means we organize code around the _concepts_ rather than technical implementation details.
For example, if we identify a _concept_, let's say `User`, we would create a `User` "domain."
The `User` domain would _own_ all user-related code, including visual representation, state, hooks, etc.
Most domains are _composed_ of smaller domains; a hypothetical `User` domain might be composed of `User.State`, `User.Avatar`, `User.Preferences`, `User.Details`, etc.
_This structure is fractal in nature,_ meaning `User.Details` might itself be composed of `User.Details.SocialMedia`, `User.Details.ContactInformation`, `User.Details.UpdateRequest`, etc.
### \*ï¸â£ Domain Syntax
Here's an example of how we might represent a `User` domain in code...
```tsx
import { Avatar } from "./Avatar";
import { Preferences } from "./Preferences";
import { Details } from "./Details";
export type User = {
id: ID;
avatar?: User.Avatar;
preferences?: User.Preferences;
details?: User.Details;
};
export function User({ id }: User.Props) {
const user = User.use(id);
return (
<>
<User.Avatar avatar={avatar} />
<User.Preferences preferences={preferences} />
<User.Details details={details} />
</>
);
}
export declare namespace User {
export { Avatar, Preferences, Details };
}
export namespace User {
User.Avatar = Avatar;
User.Preferences = Preferences;
User.Details = Details;
export type Props = {
id?: ID;
};
export const use = (id: ID) => {
// Make an API call for the user or something
};
}
```
This syntax takes advantage of TypeScript's declaration merging feature to enable nice fluent-style APIs for domains...
```tsx
import { User } from "./User";
// You can use `User` as a type
const bob: User = { id: "bob" };
function App(id: ID) {
// You can use `User` as a namespace
const user = User.use(id);
const userPreferences = User.Preferences.use(id);
// You can use `User` as a component
return (
<>
<User id={user.id} />
<User.Preferences id={user.id} />
</>
);
}
```
Here is an example of a real domain ([`Editor.Camera`](./src/Editor/Camera/index.tsx)) you'll find in the app...
```tsx
// Owner of all things camera-related in the editor
Editor.Camera;
// Centers the camera in the editor
Editor.Camera.Center;
// The hand tool is used for panning around
Editor.Camera.Hand;
// For resetting the camera to the default view
Editor.Camera.Reset;
// Specifies keyboard shortcuts for camera actions
Editor.Camera.Shortcuts;
// Controls the zoom level of the camera and mouse wheel controls
Editor.Camera.Zoom;
```
Quick note about the `export declare namespace User` syntax from the first example...
This is needed when a namespace exports a type.
It's an unfortunate bit of syntax which might [not be needed](https://github.com/microsoft/TypeScript/issues/39865) in the future.
If you want to discuss this further, please check out [this issue](https://github.com/Stability-AI/StableStudio/issues/7).
### ð Directories and Files
_Domains are usually correlated one-to-one with file/folder structure._
For example, the [`Editor.Camera`](./src/Editor/Camera/index.tsx) domain mentioned above is composed of the following files...
```
./src/Editor/Camera/
âââ Center.tsx
âââ Hand.tsx
âââ Reset.tsx
âââ Shortcut.tsx
âââ Zoom.tsx
âââ index.tsx
```
This means if you see a domain like [`Generation.Image.Download`](./src/Generation/Image/Download/index.tsx), you can expect to find it at `./src/Generation/Image/Download`.
All root-level domains located at the top-level of the [`./src`](./src) folder and can be imported using the shorthand syntax...
```ts
import { ExampleDomain } from "~/ExampleDomain";
import { ExampleDomain } from "../../../../../ExampleDomain";
// ^ If you were deep in the folder tree, it would look like this without the `~` alias
```
### ð Structuring Tips
- **Look for repeated references to a word or concept**
For example, if you're working in a `User` domain and find yourself using the word "avatar" a lot, you might want to create a `User.Avatar` domain
- **Compound words are structuring hints**
Domains like `DeviceInformation` might be better represented as `
没有合适的资源?快使用搜索试试~ 我知道了~
一个生成式人工智能社区,旨在促进生成式AI技术的交流和合作
共364个文件
tsx:195个
png:54个
ts:41个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 133 浏览量
2024-01-14
14:13:32
上传
评论
收藏 35.07MB ZIP 举报
温馨提示
一个生成式人工智能社区,旨在促进生成式AI技术的交流和合作。该项目提供了一个平台,让研究者和开发者分享他们的模型、经验和创新,并共同推动生成式AI领域的发展。
资源推荐
资源详情
资源评论
收起资源包目录
一个生成式人工智能社区,旨在促进生成式AI技术的交流和合作 (364个子文件)
yarn-3.3.0.cjs 2.1MB
plugin-workspace-tools.cjs 50KB
tailwind.config.cjs 2KB
postcss.config.cjs 285B
index.css 868B
.eslintignore 46B
.gitattributes 19B
.gitignore 126B
.gitignore 19B
.gitignore 16B
.gitignore 4B
.gitignore 4B
.gitignore 4B
.gitignore 4B
index.html 776B
PluginWithoutManifest.js 2KB
PluginWithManifest.js 1KB
package.json 3KB
devcontainer.json 2KB
.eslintrc.json 2KB
package.json 2KB
package.json 1KB
package.json 1KB
package.json 1KB
package.json 1KB
package.json 1KB
launch.json 816B
devcontainer.json 758B
tsconfig.json 530B
tsconfig.json 470B
tsconfig.json 470B
tsconfig.json 470B
tsconfig.json 470B
tsconfig.json 470B
tsconfig.json 229B
settings.json 106B
.eslintrc.json 92B
.eslintrc.json 40B
.eslintrc.json 40B
.eslintrc.json 40B
.eslintrc.json 40B
.eslintrc.json 40B
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
LICENSE 1KB
yarn.lock 288KB
README.md 12KB
README.md 6KB
CODE_OF_CONDUCT.md 5KB
README.md 4KB
README.md 2KB
bug_report.md 835B
feature_request.md 604B
README.md 0B
PainterWithRobot.png 2.21MB
ManStandingBeforeUI.png 2.18MB
GenerateScreenshot.png 2.15MB
SorcererWithReact.png 2.03MB
ProgrammingRobots.png 1.96MB
CyberPyramid.png 1.88MB
RobotsHoldingHands.png 1.86MB
MagicalElectricPlugs.png 1.57MB
Electric1111.png 607KB
seascape.png 529KB
DummyImage.png 489KB
center.png 477KB
pixel-art.png 476KB
flowers.png 458KB
enhance.png 456KB
king.png 454KB
anime.png 439KB
motorcycle.png 421KB
chili.png 419KB
3d-model.png 409KB
cake.png 406KB
modeling-compound.png 404KB
spaceship.png 401KB
forest.png 396KB
sushi.png 396KB
train.png 393KB
river.png 389KB
EditScreenshot.png 387KB
robot.png 370KB
fantasy-art.png 356KB
ProjectCard.png 356KB
isometric.png 353KB
Banner.png 352KB
dragon.png 351KB
photographic.png 344KB
moon.png 343KB
analog-film.png 342KB
racecar.png 335KB
aurora.png 333KB
neon-punk.png 333KB
digital-art.png 327KB
origami.png 310KB
共 364 条
- 1
- 2
- 3
- 4
资源评论
UnknownToKnown
- 粉丝: 1w+
- 资源: 586
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Picasso_v3.1 2.ipa
- chromedriver-mac-arm64.zip
- 蓝zapro.apk
- chromedriver-linux64.zip
- UCAS研一深度学习实验-MNIST手写数字识别python源码+详细注释(高分项目)
- 基于Python和PyTorch框架完成的一个手写数字识别实验源码(带MINIST手写数字数据集)+详细注释(高分项目)
- 基于Matlab在MNIST数据集上利用CNN完成手写体数字识别任务,并实现单层CNN反向传播算法+源代码+文档说明(高分项目)
- NVIDIA驱动、CUDA和Pytorch及其依赖
- 基于SVM多特征融合的微表情识别python源码+项目说明+详细注释(高分课程设计)
- html动态爱心代码一(附源码)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功