@vivix-labs/magic-edit 0.0.0-stage → 1.0.0-beta

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/dist/client.js ADDED
@@ -0,0 +1,3 @@
1
+ import './client-code.css';
2
+ export { default } from './client-code.js';
3
+ export * from './client-code.js';
@@ -0,0 +1,53 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ interface TargetContext {
4
+ id: string;
5
+ kind: 'surface' | 'media';
6
+ label: string;
7
+ revision?: number;
8
+ ref?: {
9
+ storeId: string;
10
+ objectId: string;
11
+ versionId: string;
12
+ };
13
+ sourceTimeMs?: number;
14
+ endSourceTimeMs?: number;
15
+ visibleText?: string;
16
+ context?: Record<string, string>;
17
+ }
18
+ type AnnotationTarget = TargetContext & {
19
+ element: HTMLElement;
20
+ };
21
+ interface MagicEditToolProps {
22
+ target: Readonly<TargetContext> | null;
23
+ regionCount: number;
24
+ disabled: boolean;
25
+ }
26
+ interface MagicEditProps {
27
+ targets?(): readonly AnnotationTarget[];
28
+ tools?: readonly {
29
+ id: string;
30
+ component: ComponentType<MagicEditToolProps>;
31
+ }[];
32
+ global?: boolean;
33
+ embeddedProject?: {
34
+ projectId: string;
35
+ frame: {
36
+ readonly current: HTMLIFrameElement | null;
37
+ };
38
+ };
39
+ }
40
+
41
+ interface MagicEditToolMount {
42
+ element: HTMLElement;
43
+ props: MagicEditToolProps;
44
+ }
45
+ interface MagicEditSource {
46
+ targets(): readonly AnnotationTarget[];
47
+ mountTools?(mount: MagicEditToolMount | null): void;
48
+ }
49
+ declare function hasGlobalMagicEdit(): boolean;
50
+ /** Publish optional project annotations to the same-origin Studio Home. */
51
+ declare function publishMagicEditSource(source: MagicEditSource): () => void;
52
+
53
+ export { type AnnotationTarget, type MagicEditProps, type MagicEditToolMount, type MagicEditToolProps, hasGlobalMagicEdit, publishMagicEditSource };
package/dist/shared.js ADDED
@@ -0,0 +1,21 @@
1
+ // packages/magic-edit/src/bridge.ts
2
+ var sourceRequest = "vivix:magic-edit-source";
3
+ function hasGlobalMagicEdit() {
4
+ try {
5
+ return window.parent !== window && Boolean(window.parent.document.querySelector("[data-vivix-magic-edit-global]"));
6
+ } catch {
7
+ return false;
8
+ }
9
+ }
10
+ function publishMagicEditSource(source) {
11
+ function respond(event) {
12
+ const receive = event.detail;
13
+ if (typeof receive === "function") receive(source);
14
+ }
15
+ document.addEventListener(sourceRequest, respond);
16
+ return () => document.removeEventListener(sourceRequest, respond);
17
+ }
18
+ export {
19
+ hasGlobalMagicEdit,
20
+ publishMagicEditSource
21
+ };
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "@vivix-labs/magic-edit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-beta",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org/",
8
+ "tag": "beta"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "studio-plugin.json",
13
+ "HTML-TO-IMAGE-LICENSE.txt"
14
+ ],
15
+ "exports": {
16
+ "./client": "./dist/client.js",
17
+ "./studio-plugin.json": "./studio-plugin.json",
18
+ "./shared": {
19
+ "types": "./dist/shared.d.ts",
20
+ "import": "./dist/shared.js"
21
+ }
22
+ },
23
+ "devDependencies": {
24
+ "html-to-image": "1.11.13",
25
+ "react": "19.3.1",
26
+ "@vivix-labs/ui-system": "1.0.0-beta"
27
+ }
6
28
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "manifestVersion": "0.2",
3
+ "id": "vivix.magic-edit",
4
+ "requirements": { "studioPluginApi": "^0.2.0" },
5
+ "requestedAccess": []
6
+ }