Spaces:
Configuration error
Configuration error
Download web/libs/editor/src/stores/CustomButton.ts from bisalsaha/lebel-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/bisalsaha/lebel-studio/resolve/main/web/libs/editor/src/stores/CustomButton.ts
- Command line
-
hf download hf://spaces/bisalsaha/lebel-studio/web/libs/editor/src/stores/CustomButton.ts
-
curl -L -o CustomButton.ts https://huggingface.co/spaces/bisalsaha/lebel-studio/resolve/main/web/libs/editor/src/stores/CustomButton.ts
1.31 kB
| import { type Instance, type SnapshotIn, types } from "mobx-state-tree"; | |
| import { guidGenerator } from "../utils/unique"; | |
| export type CustomButtonType = Instance<typeof CustomButton>; | |
| export type CustomButtonSnType = SnapshotIn<typeof CustomButton>; | |
| /** | |
| * Custom buttons that can be injected from outside application. | |
| * The only required property is `name`. If the `name` is one of the predefined buttons, it will be rendered as such. | |
| * @see CustomControl in BottomBar/Controls | |
| */ | |
| export const CustomButton = types | |
| .model("CustomButton", { | |
| id: types.optional(types.identifier, guidGenerator), | |
| name: types.string, | |
| title: types.string, | |
| variant: types.maybe( | |
| types.enumeration(["primary", "neutral", "positive", "negative", "warning", "inverted"] as const), | |
| ), | |
| look: types.maybe(types.enumeration(["filled", "outlined", "string"])), | |
| size: types.maybe(types.enumeration(["medium", "small", "smaller"])), | |
| tooltip: types.maybe(types.string), | |
| ariaLabel: types.maybe(types.string), | |
| disabled: types.maybe(types.boolean), | |
| props: types.maybe(types.frozen()), | |
| }) | |
| .actions((self) => ({ | |
| updateState(newState: CustomButtonSnType) { | |
| for (const key in newState) { | |
| if (key in self) { | |
| self[key] = newState[key]; | |
| } | |
| } | |
| }, | |
| })); | |