@myop/vue 0.0.25 → 0.0.27
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 +290 -111
- package/dist/components/MyopComponent.vue.d.ts +27 -0
- package/dist/components/MyopFallback.vue.d.ts +12 -0
- package/dist/components/MyopLoader.vue.d.ts +19 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.js +633 -1990
- package/dist/index.umd.cjs +11 -110
- package/dist/types.d.ts +75 -0
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -24,6 +24,83 @@ yarn add @myop/vue
|
|
|
24
24
|
pnpm add @myop/vue
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## Auto-Generated Vue Components
|
|
28
|
+
|
|
29
|
+
Myop automatically generates a typed Vue component package for every component you create in the [dashboard](https://dashboard.myop.dev/). Install it directly via npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install https://cloud.myop.dev/npm/{component-id}/vue
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then import and use it like any Vue component. For example, if you created a table component called "users-table" in the dashboard:
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { UsersTable } from "@myop/users-table";
|
|
40
|
+
|
|
41
|
+
const users = [
|
|
42
|
+
{ id: 1, name: "Alice", email: "alice@example.com", role: "Admin" },
|
|
43
|
+
{ id: 2, name: "Bob", email: "bob@example.com", role: "User" },
|
|
44
|
+
{ id: 3, name: "Charlie", email: "charlie@example.com", role: "User" },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function handleRowClicked(payload: { rowData: any }) {
|
|
48
|
+
console.log("Selected user:", payload.rowData);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleDeleteClicked(payload: { userId: number }) {
|
|
52
|
+
deleteUser(payload.userId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleExportRequested(payload: { format: "csv" | "xlsx" }) {
|
|
56
|
+
exportToFormat(payload.format);
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<UsersTable
|
|
62
|
+
:data="{ rows: users }"
|
|
63
|
+
@row-clicked="handleRowClicked"
|
|
64
|
+
@delete-clicked="handleDeleteClicked"
|
|
65
|
+
@export-requested="handleExportRequested"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Why this is powerful:**
|
|
71
|
+
|
|
72
|
+
- **Fully typed** — The generated package includes complete TypeScript types for your component's data interface and all CTA event payloads
|
|
73
|
+
- **Auto loaded** — Components are fetched and rendered automatically, no manual setup required
|
|
74
|
+
- **Not in your code** — The actual component implementation lives on Myop and is loaded at runtime. Update your component in the dashboard and it's instantly live—no rebuild, no redeploy
|
|
75
|
+
- **Zero bundle impact** — The entire `@myop/vue` package costs only ~6KB gzipped—and that's the total cost whether you use 1, 2, or 1,000 components. Auto-generated component packages are just thin typed wrappers. The actual component implementations are loaded at runtime, meaning your Myop components can be as complex, feature-rich, and heavy as you need without adding a single byte to your application bundle. Consider typical bundle costs: a chart library (~60KB), a map component (~200KB), a data grid (~150KB), a rich text editor (~100KB), or a chat widget with emoji picker (~80KB). With Myop, all of these cost ~0KB to your bundle—they load on-demand when needed
|
|
76
|
+
|
|
77
|
+
**Environment options:**
|
|
78
|
+
|
|
79
|
+
Set the default environment for all components using `setEnvironment`:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { setEnvironment } from "@myop/vue";
|
|
83
|
+
|
|
84
|
+
// Set default environment for all component loads
|
|
85
|
+
setEnvironment("staging");
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You can also override the environment directly on a specific component:
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<template>
|
|
92
|
+
<UsersTable
|
|
93
|
+
:data="{ rows: users }"
|
|
94
|
+
:preview="true"
|
|
95
|
+
environment="staging"
|
|
96
|
+
/>
|
|
97
|
+
</template>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Environments are fully configurable in the [dashboard](https://dashboard.myop.dev/), allowing you to test changes in staging before publishing to production.
|
|
101
|
+
|
|
102
|
+
For more details on auto-generated packages, see the [Auto-Generated Packages documentation](https://docs.myop.dev/docs/learnMyop/AutoGeneratedPackages).
|
|
103
|
+
|
|
27
104
|
## Requirements
|
|
28
105
|
|
|
29
106
|
- Vue 3.0+
|
|
@@ -32,57 +109,55 @@ pnpm add @myop/vue
|
|
|
32
109
|
|
|
33
110
|
```vue
|
|
34
111
|
<script setup lang="ts">
|
|
35
|
-
import {
|
|
112
|
+
import { MyopComponent } from "@myop/vue";
|
|
36
113
|
|
|
37
|
-
function
|
|
38
|
-
console.log("
|
|
114
|
+
function handleAction(action: string, payload: any) {
|
|
115
|
+
console.log("Action:", action, "Payload:", payload);
|
|
39
116
|
}
|
|
40
117
|
</script>
|
|
41
118
|
|
|
42
119
|
<template>
|
|
43
|
-
<
|
|
120
|
+
<MyopComponent
|
|
44
121
|
componentId="your-component-id"
|
|
45
|
-
:onReady="handleReady"
|
|
46
122
|
:style="{ width: '600px', height: '400px' }"
|
|
123
|
+
@action="handleAction"
|
|
47
124
|
/>
|
|
48
125
|
</template>
|
|
49
126
|
```
|
|
50
127
|
|
|
51
128
|
## Components
|
|
52
129
|
|
|
53
|
-
### `
|
|
130
|
+
### `MyopComponent`
|
|
54
131
|
|
|
55
|
-
The main component for embedding Myop components
|
|
132
|
+
The main component for embedding Myop components.
|
|
56
133
|
|
|
57
134
|
```vue
|
|
58
135
|
<script setup lang="ts">
|
|
59
|
-
import {
|
|
60
|
-
import type { IMyopComponent } from "@myop/sdk/host";
|
|
136
|
+
import { MyopComponent } from "@myop/vue";
|
|
61
137
|
|
|
62
|
-
const items = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
138
|
+
const items = [{ id: 1, name: "Item 1" }, { id: 2, name: "Item 2" }];
|
|
139
|
+
|
|
140
|
+
function handleRowClicked(payload: any) {
|
|
141
|
+
console.log("Row clicked:", payload);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function handleLoad(component: any) {
|
|
145
|
+
console.log("Loaded!", component);
|
|
146
|
+
}
|
|
66
147
|
|
|
67
|
-
function
|
|
68
|
-
console.
|
|
69
|
-
// Access inner Vue component if the Myop component is Vue-based
|
|
70
|
-
if (innerVueComponentRef) {
|
|
71
|
-
console.log("Inner Vue component:", innerVueComponentRef);
|
|
72
|
-
}
|
|
148
|
+
function handleError(error: string) {
|
|
149
|
+
console.error("Error:", error);
|
|
73
150
|
}
|
|
74
151
|
</script>
|
|
75
152
|
|
|
76
153
|
<template>
|
|
77
|
-
<
|
|
154
|
+
<MyopComponent
|
|
78
155
|
componentId="abc123"
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
</template>
|
|
85
|
-
</MyopContainer>
|
|
156
|
+
:data="{ items }"
|
|
157
|
+
@row-clicked="handleRowClicked"
|
|
158
|
+
@load="handleLoad"
|
|
159
|
+
@error="handleError"
|
|
160
|
+
/>
|
|
86
161
|
</template>
|
|
87
162
|
```
|
|
88
163
|
|
|
@@ -90,132 +165,235 @@ function handleReady(component: IMyopComponent, innerVueComponentRef?: any) {
|
|
|
90
165
|
|
|
91
166
|
| Prop | Type | Description |
|
|
92
167
|
|------|------|-------------|
|
|
93
|
-
| `componentId` | `string` |
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
168
|
+
| `componentId` | `string` | The ID of the Myop component to load |
|
|
169
|
+
| `data` | `object` | Data to pass to the component via `myop_init_interface` |
|
|
170
|
+
| `style` | `object` | CSS styles for the container |
|
|
171
|
+
| `#loader` | `slot` | Loading indicator slot (default: no loader). Use `<MyopLoader />` for default Myop loader |
|
|
172
|
+
| `#fallback` | `slot` | Error fallback slot (default: `<MyopFallback />`). Override with custom component |
|
|
173
|
+
| `fadeDuration` | `number` | Loader fade-out duration in ms (default: `200`) |
|
|
174
|
+
| `environment` | `string` | Load from a specific environment (e.g., `"staging"`, `"prod"`) |
|
|
175
|
+
| `preview` | `boolean` | Load the unpublished preview version of the component |
|
|
176
|
+
|
|
177
|
+
#### Events
|
|
96
178
|
|
|
97
|
-
|
|
179
|
+
| Event | Payload | Description |
|
|
180
|
+
|-------|---------|-------------|
|
|
181
|
+
| `@action` | `(action, payload)` | Generic handler for all CTA events |
|
|
182
|
+
| `@[action-name]` | `payload` | Handler for specific actions (e.g., `@row-clicked`) |
|
|
183
|
+
| `@load` | `component` | Called when the component finishes loading |
|
|
184
|
+
| `@error` | `error: string` | Called when loading fails |
|
|
98
185
|
|
|
99
|
-
|
|
186
|
+
#### Environments & Preview
|
|
187
|
+
|
|
188
|
+
Myop supports multiple environments, allowing you to test changes before going live:
|
|
100
189
|
|
|
101
190
|
```vue
|
|
102
191
|
<template>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:rows="tableData"
|
|
106
|
-
:columns="columnConfig"
|
|
107
|
-
:sortable="true"
|
|
108
|
-
title="Users Table"
|
|
109
|
-
/>
|
|
110
|
-
</template>
|
|
111
|
-
```
|
|
192
|
+
<!-- Production (default) -->
|
|
193
|
+
<MyopComponent componentId="abc123" />
|
|
112
194
|
|
|
113
|
-
|
|
195
|
+
<!-- Load from staging environment -->
|
|
196
|
+
<MyopComponent componentId="abc123" environment="staging" />
|
|
114
197
|
|
|
115
|
-
|
|
198
|
+
<!-- Load unpublished preview version (for testing before publishing) -->
|
|
199
|
+
<MyopComponent componentId="abc123" :preview="true" />
|
|
116
200
|
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
<MyopContainer componentId="my-component">
|
|
120
|
-
<template #loading>
|
|
121
|
-
<div class="custom-loader">
|
|
122
|
-
<span>Loading component...</span>
|
|
123
|
-
</div>
|
|
124
|
-
</template>
|
|
125
|
-
</MyopContainer>
|
|
201
|
+
<!-- Combine both: preview version in staging -->
|
|
202
|
+
<MyopComponent componentId="abc123" environment="staging" :preview="true" />
|
|
126
203
|
</template>
|
|
127
204
|
```
|
|
128
205
|
|
|
129
|
-
|
|
206
|
+
Environments are configured in the [dashboard](https://dashboard.myop.dev/). Use `:preview="true"` to test unpublished changes before making them live.
|
|
130
207
|
|
|
131
|
-
|
|
208
|
+
### `MyopContainer` (Legacy)
|
|
132
209
|
|
|
133
|
-
|
|
134
|
-
- **Expose access**: Access the inner component's exposed properties and methods via the `innerVueComponentRef` parameter in `onReady`
|
|
210
|
+
The legacy container component. Use `MyopComponent` for new projects.
|
|
135
211
|
|
|
136
212
|
```vue
|
|
137
213
|
<script setup lang="ts">
|
|
138
|
-
import { ref } from "vue";
|
|
139
214
|
import { MyopContainer } from "@myop/vue";
|
|
140
215
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
function handleReady(component, innerVueRef) {
|
|
144
|
-
// Call methods exposed by the inner Vue component
|
|
145
|
-
if (innerVueRef?.someMethod) {
|
|
146
|
-
innerVueRef.someMethod();
|
|
147
|
-
}
|
|
216
|
+
function handleReady(component: any) {
|
|
217
|
+
console.log("Ready!", component);
|
|
148
218
|
}
|
|
149
219
|
</script>
|
|
150
220
|
|
|
151
221
|
<template>
|
|
152
222
|
<MyopContainer
|
|
153
|
-
|
|
154
|
-
componentId="vue-component"
|
|
223
|
+
componentId="abc123"
|
|
155
224
|
:onReady="handleReady"
|
|
156
225
|
/>
|
|
157
226
|
</template>
|
|
158
227
|
```
|
|
159
228
|
|
|
160
|
-
##
|
|
229
|
+
## Type-Safe Event Handlers
|
|
161
230
|
|
|
162
|
-
|
|
231
|
+
Define your CTA payloads for fully typed event handlers:
|
|
163
232
|
|
|
164
233
|
```vue
|
|
165
234
|
<script setup lang="ts">
|
|
166
|
-
import {
|
|
235
|
+
import { MyopComponent } from "@myop/vue";
|
|
167
236
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
});
|
|
237
|
+
// Define your component's data and CTA payload types
|
|
238
|
+
interface MyData {
|
|
239
|
+
items: { id: string; name: string }[];
|
|
240
|
+
}
|
|
173
241
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
242
|
+
interface RowClickedPayload {
|
|
243
|
+
rowIndex: number;
|
|
244
|
+
rowData: any;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface ItemSelectedPayload {
|
|
248
|
+
itemId: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface ExportRequestedPayload {
|
|
252
|
+
format: "csv" | "json";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function handleRowClicked(payload: RowClickedPayload) {
|
|
256
|
+
console.log("Row clicked:", payload.rowIndex);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function handleItemSelected(payload: ItemSelectedPayload) {
|
|
260
|
+
console.log("Item selected:", payload.itemId);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function handleAction(action: string, payload: any) {
|
|
264
|
+
console.log(action, payload);
|
|
177
265
|
}
|
|
178
266
|
</script>
|
|
179
267
|
|
|
180
268
|
<template>
|
|
181
|
-
<
|
|
182
|
-
componentId="
|
|
183
|
-
:
|
|
269
|
+
<MyopComponent
|
|
270
|
+
componentId="dashboard-component"
|
|
271
|
+
:data="{ items: [...] }"
|
|
272
|
+
@row-clicked="handleRowClicked"
|
|
273
|
+
@item-selected="handleItemSelected"
|
|
274
|
+
@action="handleAction"
|
|
184
275
|
/>
|
|
185
276
|
</template>
|
|
186
277
|
```
|
|
187
278
|
|
|
188
|
-
##
|
|
279
|
+
## Configuration
|
|
280
|
+
|
|
281
|
+
### Preloading Components
|
|
282
|
+
|
|
283
|
+
Preload components for faster rendering:
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
import { preloadComponents, isPreloaded } from "@myop/vue";
|
|
287
|
+
|
|
288
|
+
// Preload multiple components
|
|
289
|
+
await preloadComponents(["component-1", "component-2"]);
|
|
290
|
+
|
|
291
|
+
// Check if a component is preloaded
|
|
292
|
+
if (isPreloaded("component-1")) {
|
|
293
|
+
console.log("Component is cached and ready");
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Custom Repository URL
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
import { setCloudRepositoryUrl } from "@myop/vue";
|
|
301
|
+
|
|
302
|
+
// Point to a custom Myop server
|
|
303
|
+
setCloudRepositoryUrl("https://your-custom-server.com");
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Environment Configuration
|
|
307
|
+
|
|
308
|
+
```ts
|
|
309
|
+
import { setEnvironment } from "@myop/vue";
|
|
310
|
+
|
|
311
|
+
// Set default environment for all component loads
|
|
312
|
+
setEnvironment("staging");
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Local Development
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import { enableLocalDev } from "@myop/vue";
|
|
319
|
+
|
|
320
|
+
// Connect to local Myop development server (localhost:9292)
|
|
321
|
+
enableLocalDev();
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Advanced: Custom Repository
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
import { setCloudRepository, getCloudRepository } from "@myop/vue";
|
|
328
|
+
import { CloudRepository } from "@myop/sdk/helpers";
|
|
329
|
+
|
|
330
|
+
// Set a custom CloudRepository instance
|
|
331
|
+
const customRepo = new CloudRepository("https://custom-url.com");
|
|
332
|
+
setCloudRepository(customRepo);
|
|
333
|
+
|
|
334
|
+
// Get the current repository
|
|
335
|
+
const repo = getCloudRepository();
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## Loading & Error States
|
|
339
|
+
|
|
340
|
+
By default, no loader is shown while the component loads. The Myop-branded fallback is displayed automatically on error.
|
|
189
341
|
|
|
190
|
-
|
|
342
|
+
### Using the Default Myop Loader
|
|
191
343
|
|
|
192
344
|
```vue
|
|
193
345
|
<script setup lang="ts">
|
|
194
|
-
import {
|
|
195
|
-
|
|
346
|
+
import { MyopComponent, MyopLoader } from "@myop/vue";
|
|
347
|
+
</script>
|
|
196
348
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
349
|
+
<template>
|
|
350
|
+
<MyopComponent componentId="my-component" :fadeDuration="300">
|
|
351
|
+
<template #loader>
|
|
352
|
+
<MyopLoader />
|
|
353
|
+
</template>
|
|
354
|
+
</MyopComponent>
|
|
355
|
+
</template>
|
|
356
|
+
```
|
|
200
357
|
|
|
201
|
-
|
|
202
|
-
rows: [
|
|
203
|
-
{ id: 1, name: "Alice" },
|
|
204
|
-
{ id: 2, name: "Bob" },
|
|
205
|
-
],
|
|
206
|
-
};
|
|
358
|
+
### Custom Loading State
|
|
207
359
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
360
|
+
```vue
|
|
361
|
+
<template>
|
|
362
|
+
<MyopComponent componentId="my-component" :fadeDuration="300">
|
|
363
|
+
<template #loader>
|
|
364
|
+
<div class="custom-loader">
|
|
365
|
+
<Spinner />
|
|
366
|
+
<p>Loading component...</p>
|
|
367
|
+
</div>
|
|
368
|
+
</template>
|
|
369
|
+
</MyopComponent>
|
|
370
|
+
</template>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Custom Error Fallback
|
|
374
|
+
|
|
375
|
+
```vue
|
|
376
|
+
<script setup lang="ts">
|
|
377
|
+
import { MyopComponent, MyopFallback } from "@myop/vue";
|
|
211
378
|
</script>
|
|
212
379
|
|
|
213
380
|
<template>
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
381
|
+
<MyopComponent componentId="my-component">
|
|
382
|
+
<!-- Custom fallback -->
|
|
383
|
+
<template #fallback>
|
|
384
|
+
<div class="error-state">
|
|
385
|
+
<p>Failed to load component</p>
|
|
386
|
+
<button @click="() => window.location.reload()">Retry</button>
|
|
387
|
+
</div>
|
|
388
|
+
</template>
|
|
389
|
+
</MyopComponent>
|
|
390
|
+
|
|
391
|
+
<!-- Or use default Myop fallback explicitly -->
|
|
392
|
+
<MyopComponent componentId="other-component">
|
|
393
|
+
<template #fallback>
|
|
394
|
+
<MyopFallback />
|
|
395
|
+
</template>
|
|
396
|
+
</MyopComponent>
|
|
219
397
|
</template>
|
|
220
398
|
```
|
|
221
399
|
|
|
@@ -225,16 +403,17 @@ function handleReady(component: IMyopComponent) {
|
|
|
225
403
|
|
|
226
404
|
| Export | Description |
|
|
227
405
|
|--------|-------------|
|
|
228
|
-
| `
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
|
233
|
-
|
|
234
|
-
| `
|
|
235
|
-
| `
|
|
236
|
-
| `
|
|
406
|
+
| `MyopComponent` | Main component for embedding Myop components |
|
|
407
|
+
| `MyopLoader` | Default Myop-branded loading indicator (opt-in) |
|
|
408
|
+
| `MyopFallback` | Default Myop-branded error fallback |
|
|
409
|
+
| `preloadComponents` | Preload components for faster rendering |
|
|
410
|
+
| `isPreloaded` | Check if a component is cached |
|
|
411
|
+
| `enableLocalDev` | Enable local development mode |
|
|
412
|
+
| `setCloudRepositoryUrl` | Set custom server URL |
|
|
413
|
+
| `setCloudRepository` | Set custom CloudRepository instance |
|
|
414
|
+
| `getCloudRepository` | Get current CloudRepository instance |
|
|
415
|
+
| `setEnvironment` | Set default environment |
|
|
237
416
|
|
|
238
417
|
## License
|
|
239
418
|
|
|
240
|
-
MIT
|
|
419
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type IMyopComponent } from "@myop/sdk/host";
|
|
2
|
+
import type { SizeInfo, ITypedMyopComponent, IBaseProps } from "../types";
|
|
3
|
+
declare const _default: <TData = any, TCtaPayloads extends Record<string, any> = Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
5
|
+
readonly onError?: ((error: string) => any) | undefined;
|
|
6
|
+
readonly onLoad?: ((component: ITypedMyopComponent<TData, TCtaPayloads>) => any) | undefined;
|
|
7
|
+
readonly onSizeChange?: ((size: SizeInfo) => any) | undefined;
|
|
8
|
+
readonly onCta?: ((action: string, payload: any) => any) | undefined;
|
|
9
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onLoad" | "onError" | "onSizeChange" | "onCta"> & IBaseProps<TData, TCtaPayloads> & Partial<{}>> & import("vue").PublicProps;
|
|
10
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{
|
|
11
|
+
myopComponent: import("vue").ShallowRef<IMyopComponent<any, any> | null, IMyopComponent<any, any> | null>;
|
|
12
|
+
isLoaded: import("vue").Ref<boolean, boolean>;
|
|
13
|
+
}>): void;
|
|
14
|
+
attrs: any;
|
|
15
|
+
slots: {
|
|
16
|
+
loader?: (props: {}) => any;
|
|
17
|
+
} & {
|
|
18
|
+
fallback?: (props: {}) => any;
|
|
19
|
+
};
|
|
20
|
+
emit: ((evt: "error", error: string) => void) & ((evt: "load", component: ITypedMyopComponent<TData, TCtaPayloads>) => void) & ((evt: "sizeChange", size: SizeInfo) => void) & ((evt: "cta", action: string, payload: any) => void);
|
|
21
|
+
}>) => import("vue").VNode & {
|
|
22
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_PrettifyLocal<T> = {
|
|
26
|
+
[K in keyof T]: T[K];
|
|
27
|
+
} & {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
9
|
+
new (): {
|
|
10
|
+
$slots: S;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
opacity?: number;
|
|
3
|
+
fadeDuration?: number;
|
|
4
|
+
}
|
|
5
|
+
declare var __VLS_1: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_1) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
10
|
+
opacity: number;
|
|
11
|
+
fadeDuration: number;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,44 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as MyopComponent } from "./components/MyopComponent.vue";
|
|
2
|
+
export { default as MyopLoader } from "./components/MyopLoader.vue";
|
|
3
|
+
export { default as MyopFallback } from "./components/MyopFallback.vue";
|
|
4
|
+
export { default as MyopContainer } from "./components/MyopVueComponent.vue";
|
|
5
|
+
export type { IMyopComponent } from "@myop/sdk/host";
|
|
6
|
+
export type { IComponentInstanceConfig, SizeInfo, IPropTypes, KebabToPascal, EventHandlerProps, IMyopComponentProps, ITypedMyopComponent, } from "./types";
|
|
7
|
+
import { CloudRepository } from "@myop/sdk/helpers";
|
|
8
|
+
/**
|
|
9
|
+
* Get the current CloudRepository instance
|
|
10
|
+
*/
|
|
11
|
+
export declare const getCloudRepository: () => CloudRepository;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a component is already preloaded/cached
|
|
14
|
+
* If env/preview not provided, checks if ANY version is preloaded
|
|
15
|
+
*/
|
|
16
|
+
export declare const isPreloaded: (componentId: string, env?: string, preview?: boolean) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the preloaded params for a component
|
|
19
|
+
*/
|
|
20
|
+
export declare const getPreloadedParams: (componentId: string) => {
|
|
21
|
+
env: string;
|
|
22
|
+
preview: boolean;
|
|
23
|
+
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Enable local development mode
|
|
26
|
+
*/
|
|
27
|
+
export declare const enableLocalDev: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Set a custom CloudRepository URL
|
|
30
|
+
*/
|
|
31
|
+
export declare const setCloudRepositoryUrl: (url: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Set a custom CloudRepository instance
|
|
34
|
+
*/
|
|
35
|
+
export declare const setCloudRepository: (repository: CloudRepository) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Set the default environment for component loading
|
|
38
|
+
*/
|
|
39
|
+
export declare const setEnvironment: (env: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Preload components for faster rendering.
|
|
42
|
+
* Continues even if some components fail to load.
|
|
43
|
+
*/
|
|
44
|
+
export declare const preloadComponents: (ids: string[], env?: string, preview?: boolean) => Promise<PromiseSettledResult<import("@myop/sdk/common").IComponentConfig>[]>;
|