nuxt-studio 0.0.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 +241 -0
- package/dist/app/main.d.ts +342 -0
- package/dist/app/main.js +38597 -0
- package/dist/app/mdc-import-BDMct_Gn.js +4 -0
- package/dist/app/service-worker.d.ts +3 -0
- package/dist/app/service-worker.js +118 -0
- package/dist/app/shared-D04791PA.js +25754 -0
- package/dist/app/shared-DI6F-ifc.js +25774 -0
- package/dist/app/shared-R5zYJ3Dl.js +25803 -0
- package/dist/app/shared.d.ts +22 -0
- package/dist/app/shared.js +6 -0
- package/dist/app/utils-DI6F-ifc.js +25774 -0
- package/dist/app/utils.d.ts +22 -0
- package/dist/app/utils.js +6 -0
- package/dist/module/module.d.mts +68 -0
- package/dist/module/module.json +10 -0
- package/dist/module/module.mjs +185 -0
- package/dist/module/runtime/composables/useMeta.d.ts +6 -0
- package/dist/module/runtime/composables/useMeta.js +17 -0
- package/dist/module/runtime/host.d.ts +2 -0
- package/dist/module/runtime/host.dev.d.ts +2 -0
- package/dist/module/runtime/host.dev.js +46 -0
- package/dist/module/runtime/host.js +257 -0
- package/dist/module/runtime/plugins/studio.client.d.ts +2 -0
- package/dist/module/runtime/plugins/studio.client.dev.d.ts +2 -0
- package/dist/module/runtime/plugins/studio.client.dev.js +23 -0
- package/dist/module/runtime/plugins/studio.client.js +11 -0
- package/dist/module/runtime/server/routes/admin.d.ts +2 -0
- package/dist/module/runtime/server/routes/admin.js +192 -0
- package/dist/module/runtime/server/routes/auth/github.get.d.ts +53 -0
- package/dist/module/runtime/server/routes/auth/github.get.js +155 -0
- package/dist/module/runtime/server/routes/auth/google.get.d.ts +2 -0
- package/dist/module/runtime/server/routes/auth/google.get.js +13 -0
- package/dist/module/runtime/server/routes/auth/session.delete.d.ts +4 -0
- package/dist/module/runtime/server/routes/auth/session.delete.js +10 -0
- package/dist/module/runtime/server/routes/auth/session.get.d.ts +4 -0
- package/dist/module/runtime/server/routes/auth/session.get.js +12 -0
- package/dist/module/runtime/server/routes/dev/content/[...path].d.ts +2 -0
- package/dist/module/runtime/server/routes/dev/content/[...path].js +57 -0
- package/dist/module/runtime/server/routes/dev/public/[...path].d.ts +8 -0
- package/dist/module/runtime/server/routes/dev/public/[...path].js +61 -0
- package/dist/module/runtime/server/routes/meta.d.ts +17 -0
- package/dist/module/runtime/server/routes/meta.js +39 -0
- package/dist/module/runtime/server/routes/sw.d.ts +2 -0
- package/dist/module/runtime/server/routes/sw.js +6 -0
- package/dist/module/runtime/utils/activation.d.ts +2 -0
- package/dist/module/runtime/utils/activation.js +23 -0
- package/dist/module/runtime/utils/collection.d.ts +22 -0
- package/dist/module/runtime/utils/collection.js +154 -0
- package/dist/module/runtime/utils/ensure.d.ts +1 -0
- package/dist/module/runtime/utils/ensure.js +22 -0
- package/dist/module/runtime/utils/object.d.ts +3 -0
- package/dist/module/runtime/utils/object.js +3 -0
- package/dist/module/runtime/utils/path-meta.d.ts +50 -0
- package/dist/module/runtime/utils/path-meta.js +49 -0
- package/dist/module/types.d.mts +7 -0
- package/package.json +100 -0
package/README.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Nuxt Studio
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/nuxt-studio)
|
|
4
|
+
[](https://npm.chart.dev/nuxt-studio)
|
|
5
|
+
[](https://npmjs.com/package/nuxt-studio)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ⚠️ Alpha Release
|
|
10
|
+
|
|
11
|
+
> **Current Status: Alpha Testing**
|
|
12
|
+
>
|
|
13
|
+
> Nuxt Studio is currently in **alpha** and uses the Monaco code editor for content editing. This phase focuses on testing and stabilizing core functionality:
|
|
14
|
+
>
|
|
15
|
+
> - ✅ File operations (create, edit, delete, rename)
|
|
16
|
+
> - ✅ Content editing with Monaco editor
|
|
17
|
+
> - ✅ Media management and uploads
|
|
18
|
+
> - ✅ GitHub authentication and publishing workflow
|
|
19
|
+
>
|
|
20
|
+
> **🎨 Visual Editor Coming Soon**
|
|
21
|
+
>
|
|
22
|
+
> Once all file operations and GitHub publishing workflows are tested and stable, we'll release **Phase 2 (Beta)** with the full visual editor for Markdown, Vue components, and medias...
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
> Visual edition in production for your [Nuxt Content](https://content.nuxt.com) website.
|
|
27
|
+
|
|
28
|
+
Originally offered as a standalone premium platform at https://nuxt.studio, Studio has evolved into a free, open-source, and self-hostable Nuxt module. Enable your entire team to edit website content right in production.
|
|
29
|
+
|
|
30
|
+
**Current Features (Alpha):**
|
|
31
|
+
|
|
32
|
+
- 💻 **Monaco Code Editor** - Code editor for enhanced Markdown with MDC syntax, YAML, and JSON
|
|
33
|
+
- 🔄 **Real-time Preview** - See your changes instantly on your production website
|
|
34
|
+
- 🔐 **GitHub Authentication** - Secure OAuth-based login with GitHub
|
|
35
|
+
- 📝 **File Management** - Create, edit, delete, and rename content files (`content/` directory)
|
|
36
|
+
- 🖼️ **Media Management** - Centralized media library for all your assets (`public/` directory)
|
|
37
|
+
- 🌳 **Git Integration** - Commit changes directly from your production website and just wait your CI/CD pipeline to deploy your changes
|
|
38
|
+
- 🚀 **Development Mode** - Directly edit your content files and media files in your local filesystem using the module interface
|
|
39
|
+
|
|
40
|
+
**Coming in Beta:**
|
|
41
|
+
- 🎨 **Visual Editor** - Visual editor for content management, from text edition to media management - all without touching code
|
|
42
|
+
- 🔐 **Google OAuth Authentication** - Secure OAuth-based login with Google
|
|
43
|
+
|
|
44
|
+
**Future Features:**
|
|
45
|
+
- 📂 **Collections view** - View and manage your content collections in a unified interface
|
|
46
|
+
- 🖼️ **Media optimization** - Optimize your media files in the editor
|
|
47
|
+
- 🤖 **AI Content Assistant** — Receive smart, AI-powered suggestions to enhance your content creation flow
|
|
48
|
+
- 💡 **Community-driven Features** — Have an idea? [Share your suggestions](https://github.com/nuxt-content/studio/discussions) to shape the future of Nuxt Studio
|
|
49
|
+
|
|
50
|
+
[📖 Documentation](https://content.nuxt.com/studio)
|
|
51
|
+
[🎮 Live Demo](https://docus.dev/admin)
|
|
52
|
+
|
|
53
|
+
## Quick Setup
|
|
54
|
+
|
|
55
|
+
> **Note**: This alpha release provides a Monaco-based code editor. The visual WYSIWYG editor will be available in the beta release.
|
|
56
|
+
|
|
57
|
+
### 1. Module Installation
|
|
58
|
+
|
|
59
|
+
Install the module in your Nuxt application with one command:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx nuxi module add nuxt-studio
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Add it to your `nuxt.config` and configure your repository.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
export default defineNuxtConfig({
|
|
69
|
+
modules: [
|
|
70
|
+
'@nuxt/content',
|
|
71
|
+
'nuxt-studio'
|
|
72
|
+
],
|
|
73
|
+
studio: {
|
|
74
|
+
// Your configuration
|
|
75
|
+
repository: {
|
|
76
|
+
provider: 'github', // default: only GitHub supported currently
|
|
77
|
+
owner: 'your-username', // your GitHub owner
|
|
78
|
+
repo: 'your-repo', // your GitHub repository name
|
|
79
|
+
branch: 'main',
|
|
80
|
+
rootDir: '' // optional: location of your content app
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Create a GitHub OAuth App
|
|
87
|
+
|
|
88
|
+
1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
|
|
89
|
+
2. Click **"New OAuth App"**
|
|
90
|
+
3. Fill in the application details:
|
|
91
|
+
- **Application name**: Your App Name
|
|
92
|
+
- **Homepage URL**: Your website homepage URL
|
|
93
|
+
- **Authorization callback URL**: `${YOUR_WEBSITE_URL}/${options.route}/auth/github` (default: `${YOUR_WEBSITE_URL}/_studio/auth/github`)
|
|
94
|
+
4. Copy the **Client ID** and generate a **Client Secret**
|
|
95
|
+
5. Add them to your deployment environment variables (see next section)
|
|
96
|
+
|
|
97
|
+
### 3. Environment Variables
|
|
98
|
+
|
|
99
|
+
Nuxt Studio requires environment variables for authentication and publication on your repository.
|
|
100
|
+
|
|
101
|
+
Add the previsously generated Client ID and Client Secret to your deployment environment variables.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
STUDIO_GITHUB_CLIENT_ID=your_github_client_id
|
|
105
|
+
STUDIO_GITHUB_CLIENT_SECRET=your_github_client_secret
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
Configure Nuxt Studio in your `nuxt.config.ts`:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
export default defineNuxtConfig({
|
|
114
|
+
modules: ['nuxt-studio'],
|
|
115
|
+
studio: {
|
|
116
|
+
// Studio admin login route
|
|
117
|
+
route: '/_studio', // default
|
|
118
|
+
|
|
119
|
+
// Git repository configuration (required)
|
|
120
|
+
repository: {
|
|
121
|
+
provider: 'github', // only GitHub is supported currently (default)
|
|
122
|
+
owner: 'your-username', // your GitHub owner
|
|
123
|
+
repo: 'your-repo', // your GitHub repository name
|
|
124
|
+
branch: 'main', // your GitHub branch
|
|
125
|
+
rootDir: '' // optional: root directory for
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Development Mode
|
|
132
|
+
|
|
133
|
+
Nuxt Studio includes an **experimental** development mode that enables real-time file system synchronization:
|
|
134
|
+
|
|
135
|
+
> You must setup a local GitHub OAuth App to use this feature (pointing to `http://localhost:3000` as callback URL).
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
export default defineNuxtConfig({
|
|
139
|
+
studio: {
|
|
140
|
+
development: {
|
|
141
|
+
sync: true // Enable development mode
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
When enabled, Nuxt Studio will:
|
|
148
|
+
|
|
149
|
+
- ✅ Write changes directly to your local `content/` directory
|
|
150
|
+
- ✅ Write media changes to your local `public/` directory
|
|
151
|
+
- ❌ Listen for file system changes and update the editor
|
|
152
|
+
- ❌ Commit changes to your repository (use your classical workflow instead)
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
You must clone the repository and create a local GitHub OAuth App (pointing to `http://localhost:3000` as callback URL).
|
|
156
|
+
|
|
157
|
+
Set your GitHub OAuth credentials in the `.env` file.
|
|
158
|
+
|
|
159
|
+
### Development Setup
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Install dependencies
|
|
163
|
+
pnpm install
|
|
164
|
+
|
|
165
|
+
# Generate type stubs
|
|
166
|
+
pnpm dev:prepare
|
|
167
|
+
|
|
168
|
+
# Build the app and service worker
|
|
169
|
+
pnpm prepack
|
|
170
|
+
|
|
171
|
+
# Terminal 1: Start the playground
|
|
172
|
+
pnpm dev
|
|
173
|
+
|
|
174
|
+
# Terminal 2: Start the app dev server
|
|
175
|
+
pnpm dev:app
|
|
176
|
+
|
|
177
|
+
# Login at http://localhost:3000/admin
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Project Structure
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
studio/
|
|
184
|
+
├── src/
|
|
185
|
+
│ ├── app/ # Studio editor Vue app
|
|
186
|
+
│ └── module/ # Nuxt module
|
|
187
|
+
├── playground/ # Development playground
|
|
188
|
+
│ ├── docus/ # Docus example
|
|
189
|
+
│ └── minimal/ # Minimal example
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Testing
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Run tests
|
|
196
|
+
pnpm test
|
|
197
|
+
|
|
198
|
+
# Run type checking
|
|
199
|
+
pnpm typecheck
|
|
200
|
+
|
|
201
|
+
# Run linter
|
|
202
|
+
pnpm lint
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Roadmap
|
|
206
|
+
|
|
207
|
+
### ✅ Phase 1 - Alpha (Current)
|
|
208
|
+
- [x] Monaco code editor
|
|
209
|
+
- [x] File operations (create, edit, delete, rename)
|
|
210
|
+
- [x] Media management
|
|
211
|
+
- [x] GitHub authentication
|
|
212
|
+
- [x] Development mode (**experimental**)
|
|
213
|
+
- [x] Git integration
|
|
214
|
+
- [x] Real-time preview
|
|
215
|
+
|
|
216
|
+
### 🚧 Phase 2 - Beta (In Development)
|
|
217
|
+
- [ ] Google OAuth authentication
|
|
218
|
+
- [ ] Visual editor
|
|
219
|
+
- [ ] Frontmatter edition as form
|
|
220
|
+
- [ ] Vue Component edition (props, slots)
|
|
221
|
+
|
|
222
|
+
### 🔮 Future
|
|
223
|
+
|
|
224
|
+
- [ ] GitLab provider support
|
|
225
|
+
- [ ] Other provider support
|
|
226
|
+
- [ ] Advanced conflict resolution
|
|
227
|
+
- [ ] Pull request generation (from a branch to the main one)
|
|
228
|
+
- [ ] AI-powered content suggestions
|
|
229
|
+
|
|
230
|
+
## Links
|
|
231
|
+
|
|
232
|
+
- 📖 [Documentation](https://content.nuxt.com/studio)
|
|
233
|
+
- 🐛 [Report a Bug](https://github.com/nuxt-content/studio/issues)
|
|
234
|
+
- 💡 [Feature Request](https://github.com/nuxt-content/studio/discussions)
|
|
235
|
+
- 🗨️ [Discussions](https://github.com/nuxt-content/studio/discussions)
|
|
236
|
+
- 🆇 [Twitter](https://x.com/nuxtstudio)
|
|
237
|
+
- 🦋 [Bluesky](https://bsky.app/profile/nuxt.com)
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
Published under the [MIT](LICENSE) license.
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { CollectionItemBase } from '@nuxt/content';
|
|
2
|
+
import { ComponentData } from 'nuxt-component-meta';
|
|
3
|
+
import { DataCollectionItemBase } from '@nuxt/content';
|
|
4
|
+
import { PageCollectionItemBase } from '@nuxt/content';
|
|
5
|
+
import { RouteLocationNormalized } from 'vue-router';
|
|
6
|
+
|
|
7
|
+
export declare type ActionHandlerParams = {
|
|
8
|
+
[StudioItemActionId.CreateDocumentFolder]: CreateFolderParams;
|
|
9
|
+
[StudioItemActionId.CreateMediaFolder]: CreateFolderParams;
|
|
10
|
+
[StudioItemActionId.CreateDocument]: CreateFileParams;
|
|
11
|
+
[StudioItemActionId.UploadMedia]: UploadMediaParams;
|
|
12
|
+
[StudioItemActionId.RevertItem]: TreeItem;
|
|
13
|
+
[StudioItemActionId.RenameItem]: TreeItem | RenameFileParams;
|
|
14
|
+
[StudioItemActionId.DeleteItem]: TreeItem;
|
|
15
|
+
[StudioItemActionId.DuplicateItem]: TreeItem;
|
|
16
|
+
[StudioItemActionId.RevertAllItems]: never;
|
|
17
|
+
[StudioBranchActionId.PublishBranch]: PublishBranchParams;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export declare enum AudioFileExtension {
|
|
21
|
+
MP3 = "mp3",
|
|
22
|
+
WAV = "wav",
|
|
23
|
+
OGG = "ogg",
|
|
24
|
+
M4A = "m4a",
|
|
25
|
+
AAC = "aac",
|
|
26
|
+
FLAC = "flac"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare interface BaseItem {
|
|
30
|
+
id: string;
|
|
31
|
+
extension: string;
|
|
32
|
+
stem: string;
|
|
33
|
+
path?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare interface CommitFilesOptions extends GitBaseOptions {
|
|
37
|
+
files: RawFile[];
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare interface ComponentMeta {
|
|
42
|
+
name: string;
|
|
43
|
+
path: string;
|
|
44
|
+
meta: {
|
|
45
|
+
props: ComponentData['meta']['props'];
|
|
46
|
+
slots: ComponentData['meta']['slots'];
|
|
47
|
+
events: ComponentData['meta']['events'];
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare interface ContentConflict {
|
|
52
|
+
githubContent: string;
|
|
53
|
+
localContent: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare enum ContentFileExtension {
|
|
57
|
+
Markdown = "md",
|
|
58
|
+
YAML = "yaml",
|
|
59
|
+
YML = "yml",
|
|
60
|
+
JSON = "json"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare interface CreateFileParams {
|
|
64
|
+
fsPath: string;
|
|
65
|
+
content: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare interface CreateFolderParams {
|
|
69
|
+
fsPath: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare interface DatabaseDataItem extends DataCollectionItemBase, BaseItem {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare interface DatabaseItem extends CollectionItemBase, BaseItem {
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare interface DatabasePageItem extends PageCollectionItemBase, BaseItem {
|
|
81
|
+
path: string;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare const _default: {};
|
|
86
|
+
export default _default;
|
|
87
|
+
|
|
88
|
+
export declare interface DraftItem<T = DatabaseItem | MediaItem> {
|
|
89
|
+
id: string;
|
|
90
|
+
fsPath: string;
|
|
91
|
+
status: DraftStatus;
|
|
92
|
+
githubFile?: GithubFile;
|
|
93
|
+
original?: T;
|
|
94
|
+
modified?: T;
|
|
95
|
+
/**
|
|
96
|
+
* - Buffer media content
|
|
97
|
+
*/
|
|
98
|
+
raw?: string | Buffer;
|
|
99
|
+
/**
|
|
100
|
+
* Version of the draft
|
|
101
|
+
* Incremented when the draft is updated
|
|
102
|
+
* Used to detect changes when the draft is saved
|
|
103
|
+
*/
|
|
104
|
+
version?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Content conflict detection
|
|
107
|
+
*/
|
|
108
|
+
conflict?: ContentConflict;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export declare enum DraftStatus {
|
|
112
|
+
Deleted = "deleted",
|
|
113
|
+
Created = "created",
|
|
114
|
+
Updated = "updated",
|
|
115
|
+
Pristine = "pristine"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export declare interface ExtensionConfig {
|
|
119
|
+
allowed: string[];
|
|
120
|
+
default?: string;
|
|
121
|
+
editable: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export declare interface GitBaseOptions {
|
|
125
|
+
owner: string;
|
|
126
|
+
repo: string;
|
|
127
|
+
branch: string;
|
|
128
|
+
authorName: string;
|
|
129
|
+
authorEmail: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare interface GithubFile {
|
|
133
|
+
name: string;
|
|
134
|
+
path: string;
|
|
135
|
+
sha: string;
|
|
136
|
+
size: number;
|
|
137
|
+
url: string;
|
|
138
|
+
html_url: string;
|
|
139
|
+
git_url: string;
|
|
140
|
+
download_url: string;
|
|
141
|
+
type: string;
|
|
142
|
+
content?: string;
|
|
143
|
+
encoding?: string;
|
|
144
|
+
_links: {
|
|
145
|
+
self: string;
|
|
146
|
+
git: string;
|
|
147
|
+
html: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export declare interface GitOptions extends GitBaseOptions {
|
|
152
|
+
rootDir: string;
|
|
153
|
+
token: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export declare enum ImageFileExtension {
|
|
157
|
+
PNG = "png",
|
|
158
|
+
JPG = "jpg",
|
|
159
|
+
JPEG = "jpeg",
|
|
160
|
+
SVG = "svg",
|
|
161
|
+
WEBP = "webp",
|
|
162
|
+
ICO = "ico",
|
|
163
|
+
GIF = "gif"
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export declare type MediaFileExtension = ImageFileExtension | AudioFileExtension | VideoFileExtension;
|
|
167
|
+
|
|
168
|
+
export declare interface MediaItem extends BaseItem {
|
|
169
|
+
[key: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export declare interface PublishBranchParams {
|
|
173
|
+
commitMessage: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export declare interface RawFile {
|
|
177
|
+
path: string;
|
|
178
|
+
content: string | null;
|
|
179
|
+
status: DraftStatus;
|
|
180
|
+
encoding?: 'utf-8' | 'base64';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export declare interface RenameFileParams {
|
|
184
|
+
item: TreeItem;
|
|
185
|
+
newFsPath: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export declare interface Repository {
|
|
189
|
+
provider: 'github';
|
|
190
|
+
owner: string;
|
|
191
|
+
repo: string;
|
|
192
|
+
branch: string;
|
|
193
|
+
rootDir: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare interface StudioAction<K extends StudioItemActionId | StudioBranchActionId> {
|
|
197
|
+
id: K;
|
|
198
|
+
label: string;
|
|
199
|
+
icon: string;
|
|
200
|
+
tooltip: string;
|
|
201
|
+
handler?: (args: ActionHandlerParams[K]) => void;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export declare interface StudioActionInProgress {
|
|
205
|
+
id: StudioItemActionId | StudioBranchActionId;
|
|
206
|
+
item?: TreeItem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export declare enum StudioBranchActionId {
|
|
210
|
+
PublishBranch = "publish-branch"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export declare interface StudioConfig {
|
|
214
|
+
syncEditorAndRoute: boolean;
|
|
215
|
+
showTechnicalMode: boolean;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export declare enum StudioFeature {
|
|
219
|
+
Content = "content",
|
|
220
|
+
Media = "media"
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export declare interface StudioHost {
|
|
224
|
+
meta: {
|
|
225
|
+
dev: boolean;
|
|
226
|
+
components: () => ComponentMeta[];
|
|
227
|
+
};
|
|
228
|
+
on: {
|
|
229
|
+
routeChange: (fn: (to: RouteLocationNormalized, from: RouteLocationNormalized) => void) => void;
|
|
230
|
+
mounted: (fn: () => void) => void;
|
|
231
|
+
beforeUnload: (fn: (event: BeforeUnloadEvent) => void) => void;
|
|
232
|
+
colorModeChange: (fn: (colorMode: 'light' | 'dark') => void) => void;
|
|
233
|
+
manifestUpdate: (fn: (id: string) => void) => void;
|
|
234
|
+
documentUpdate: (fn: (id: string, type: 'remove' | 'update') => void) => void;
|
|
235
|
+
mediaUpdate: (fn: (id: string, type: 'remove' | 'update') => void) => void;
|
|
236
|
+
};
|
|
237
|
+
ui: {
|
|
238
|
+
colorMode: 'light' | 'dark';
|
|
239
|
+
activateStudio: () => void;
|
|
240
|
+
deactivateStudio: () => void;
|
|
241
|
+
expandSidebar: () => void;
|
|
242
|
+
collapseSidebar: () => void;
|
|
243
|
+
updateStyles: () => void;
|
|
244
|
+
};
|
|
245
|
+
repository: Repository;
|
|
246
|
+
document: {
|
|
247
|
+
get: (id: string) => Promise<DatabaseItem>;
|
|
248
|
+
getFileSystemPath: (id: string) => string;
|
|
249
|
+
list: () => Promise<DatabaseItem[]>;
|
|
250
|
+
upsert: (id: string, document: DatabaseItem) => Promise<void>;
|
|
251
|
+
create: (fsPath: string, content: string) => Promise<DatabaseItem>;
|
|
252
|
+
delete: (id: string) => Promise<void>;
|
|
253
|
+
detectActives: () => Array<{
|
|
254
|
+
id: string;
|
|
255
|
+
title: string;
|
|
256
|
+
}>;
|
|
257
|
+
};
|
|
258
|
+
media: {
|
|
259
|
+
get: (id: string) => Promise<MediaItem>;
|
|
260
|
+
getFileSystemPath: (id: string) => string;
|
|
261
|
+
list: () => Promise<MediaItem[]>;
|
|
262
|
+
upsert: (id: string, media: MediaItem) => Promise<void>;
|
|
263
|
+
delete: (id: string) => Promise<void>;
|
|
264
|
+
};
|
|
265
|
+
user: {
|
|
266
|
+
get: () => StudioUser;
|
|
267
|
+
};
|
|
268
|
+
app: {
|
|
269
|
+
getManifestId: () => Promise<string>;
|
|
270
|
+
requestRerender: () => void;
|
|
271
|
+
navigateTo: (path: string) => void;
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export declare enum StudioItemActionId {
|
|
276
|
+
CreateDocumentFolder = "create-document-folder",
|
|
277
|
+
CreateMediaFolder = "create-media-folder",
|
|
278
|
+
CreateDocument = "create-document",
|
|
279
|
+
UploadMedia = "upload-media",
|
|
280
|
+
RevertItem = "revert-item",
|
|
281
|
+
RenameItem = "rename-item",
|
|
282
|
+
DeleteItem = "delete-item",
|
|
283
|
+
DuplicateItem = "duplicate-item",
|
|
284
|
+
RevertAllItems = "revert-all-items"
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export declare interface StudioLocation {
|
|
288
|
+
active: boolean;
|
|
289
|
+
feature: StudioFeature;
|
|
290
|
+
fsPath: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export declare interface StudioUser {
|
|
294
|
+
githubId: string;
|
|
295
|
+
githubToken: string;
|
|
296
|
+
name: string;
|
|
297
|
+
avatar: string;
|
|
298
|
+
email: string;
|
|
299
|
+
provider: 'github' | 'google';
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export declare interface TreeItem {
|
|
303
|
+
name: string;
|
|
304
|
+
fsPath: string;
|
|
305
|
+
type: 'file' | 'directory' | 'root';
|
|
306
|
+
prefix: number | null;
|
|
307
|
+
collections: string[];
|
|
308
|
+
status?: TreeStatus;
|
|
309
|
+
routePath?: string;
|
|
310
|
+
children?: TreeItem[];
|
|
311
|
+
hide?: boolean;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export declare enum TreeRootId {
|
|
315
|
+
Content = "content",
|
|
316
|
+
Media = "public-assets"
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export declare enum TreeStatus {
|
|
320
|
+
Deleted = "deleted",
|
|
321
|
+
Created = "created",
|
|
322
|
+
Updated = "updated",
|
|
323
|
+
Renamed = "renamed",
|
|
324
|
+
Opened = "opened"
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export declare interface UploadMediaParams {
|
|
328
|
+
parentFsPath: string;
|
|
329
|
+
files: File[];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export declare type UseStudioHost = () => StudioHost;
|
|
333
|
+
|
|
334
|
+
export declare enum VideoFileExtension {
|
|
335
|
+
MP4 = "mp4",
|
|
336
|
+
MOV = "mov",
|
|
337
|
+
AVI = "avi",
|
|
338
|
+
MKV = "mkv",
|
|
339
|
+
WEBM = "webm"
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export { }
|