@myop/cli 0.1.46 → 0.1.48

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.
@@ -1,12 +1,123 @@
1
1
  ---
2
2
  name: myop-vue-host
3
- description: "Integrate Myop components into Vue 3 applications using @myop/vue. This skill covers MyopComponent props, events, slots, data binding, preloading, auto-generated packages, and local dev setup. Activate when the user is building a Vue app that hosts Myop components, or when you see @myop/vue in package.json."
3
+ description: "Integrate Myop components into Vue 3 applications using @myop/vue. ALWAYS use the MyopComponent Vue component or auto-generated packages — NEVER create iframes manually. Covers MyopComponent props, events, slots, data binding, preloading, auto-generated packages, and local dev setup. Activate when the user is building a Vue app that hosts Myop components, or when you see @myop/vue in package.json."
4
4
  ---
5
5
 
6
6
  # Myop Vue Host Integration
7
7
 
8
8
  Embed Myop components in Vue 3 applications using `@myop/vue`.
9
9
 
10
+ ## CRITICAL: Always Use the SDK
11
+
12
+ **NEVER create `<iframe>` elements manually. NEVER call `myop_init_interface()` or wire `myop_cta_handler()` directly.**
13
+
14
+ The `@myop/vue` SDK handles all iframe management, communication, loading, error handling, and caching. Always use `<MyopComponent>` or an auto-generated package.
15
+
16
+ ```vue
17
+ <!-- WRONG — never do this -->
18
+ <iframe ref="myIframe" src="/component.html" />
19
+
20
+ <!-- CORRECT — always use the SDK -->
21
+ <MyopComponent component-id="abc-123" :data="data" @cta="handleCta" />
22
+ ```
23
+
24
+ ## End-to-End Workflow: Vue App with Myop Components
25
+
26
+ Each Myop component is a **separate project** in its own directory. You create them, develop them, push them to get a `componentId`, then reference that ID in your Vue host app.
27
+
28
+ ### Step 1: Create component projects
29
+
30
+ ```bash
31
+ # Each component gets its own directory
32
+ mkdir components/sidebar && cd components/sidebar
33
+ npx myop create # Scaffolds index.html + myop.config.json
34
+ # Build the component UI (see myop-component skill), then Ctrl+C
35
+
36
+ cd ../ && mkdir chart && cd chart
37
+ npx myop create
38
+ ```
39
+
40
+ ### Step 2: Push components to get IDs
41
+
42
+ ```bash
43
+ cd components/sidebar
44
+ npx myop push # Uploads → componentId written to myop.config.json
45
+
46
+ cd ../chart
47
+ npx myop push
48
+ ```
49
+
50
+ ### Step 3: Use in your Vue app
51
+
52
+ ```bash
53
+ cd my-vue-app
54
+ npm install @myop/vue @myop/sdk
55
+ ```
56
+
57
+ ```vue
58
+ <script setup>
59
+ import { MyopComponent } from "@myop/vue";
60
+ </script>
61
+
62
+ <template>
63
+ <MyopComponent
64
+ component-id="<sidebar-componentId-from-step-2>"
65
+ :data="{ items: ['Home', 'Settings'] }"
66
+ @cta="(action, payload) => console.log(action, payload)"
67
+ style="width: 300px"
68
+ />
69
+ <MyopComponent
70
+ component-id="<chart-componentId-from-step-2>"
71
+ :data="{ values: [10, 20, 30] }"
72
+ style="flex: 1"
73
+ />
74
+ </template>
75
+ ```
76
+
77
+ ### Working locally on existing components (componentId already in code)
78
+
79
+ When you find `componentId` values already used in the codebase and the developer wants to modify those components locally:
80
+
81
+ **Step A: Pull the component source**
82
+
83
+ ```bash
84
+ mkdir components/sidebar && cd components/sidebar
85
+ npx myop pull <componentId>
86
+ # Downloads index.html + creates myop.config.json with the componentId
87
+ ```
88
+
89
+ **Step B: Start the local dev server**
90
+
91
+ ```bash
92
+ npx myop dev # Serves component on port 9292 with HMR
93
+ ```
94
+
95
+ **Step C: Point the Vue app to local dev server**
96
+
97
+ ```ts
98
+ import { enableLocalDev } from "@myop/vue";
99
+ enableLocalDev(); // All <MyopComponent> instances load from localhost:9292
100
+ ```
101
+
102
+ Now edits to `index.html` are reflected instantly in the Vue app.
103
+
104
+ **Step D: Push changes when done**
105
+
106
+ ```bash
107
+ npx myop push # Uploads updated component to the same componentId
108
+ ```
109
+
110
+ Remove or comment out `enableLocalDev()` to go back to loading from the Myop cloud.
111
+
112
+ **Multiple components:**
113
+
114
+ ```bash
115
+ mkdir -p components && cd components
116
+ npx myop pull <sidebar-id> -o sidebar/index.html
117
+ npx myop pull <chart-id> -o chart/index.html
118
+ npx myop dev -m # Monorepo mode — select which components to serve
119
+ ```
120
+
10
121
  ## When This Skill Activates
11
122
 
12
123
  - `@myop/vue` is in `package.json` dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myop/cli",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "Myop cli",
5
5
  "type": "module",
6
6
  "repository": {