@uniformdev/canvas-vue 16.2.0 → 16.2.1-nuxt.274

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Supports only Vue 3, and uses Uniform Context SDK internally.**
4
4
 
5
- ⚠️ If you want Uniform Optimize with Vue 2 support, stick to the versions before v15.
5
+ ⚠️ If you want Uniform Optimize with Vue 2 support, stick to the versions before v16.0.0.
6
6
 
7
7
 
8
8
  ---
package/dist/index.d.ts CHANGED
@@ -1,12 +1,7 @@
1
- import { ConcreteComponent, Component, Ref, InjectionKey } from 'vue-demi';
1
+ import * as vue_demi from 'vue-demi';
2
+ import { ConcreteComponent, PropType, Ref } from 'vue-demi';
2
3
  import { ComponentInstance, ComponentParameter, SubscribeToCompositionOptions } from '@uniformdev/canvas';
3
4
 
4
- declare type MapComponentNameProps = {
5
- name: string;
6
- components: Array<ComponentInstance>;
7
- };
8
- declare type SlotDataProps = Record<string, any>;
9
- declare type MapSlotDataResolve = Array<MapComponentNameProps>;
10
5
  interface TestComponent {
11
6
  slots?: {
12
7
  test?: ComponentInstance[];
@@ -32,7 +27,7 @@ interface PersonalizeComponent {
32
27
  declare type ComponentProps<TProps = unknown> = TProps & {
33
28
  component: ComponentInstance;
34
29
  };
35
- declare type ResolveRenderer = (componentInstance: ComponentInstance) => ConcreteComponent | undefined;
30
+ declare type ResolveRenderer = (componentInstance: ComponentInstance) => ConcreteComponent<any>;
36
31
 
37
32
  declare type CompositionProps = {
38
33
  /** A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject */
@@ -51,7 +46,40 @@ declare type CompositionProps = {
51
46
  */
52
47
  behaviorTracking?: 'onLoad' | 'onView';
53
48
  };
54
- declare const Composition: Component;
49
+ declare const Composition: vue_demi.DefineComponent<{
50
+ data: {
51
+ type: PropType<ComponentInstance>;
52
+ required: true;
53
+ };
54
+ resolveRenderer: {
55
+ type: PropType<ResolveRenderer | undefined>;
56
+ default: () => ({ type }: ComponentInstance) => string | ConcreteComponent<{}, any, any, vue_demi.ComputedOptions, vue_demi.MethodOptions>;
57
+ };
58
+ behaviorTracking: {
59
+ type: PropType<"onLoad" | "onView" | undefined>;
60
+ default: string;
61
+ };
62
+ }, (() => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
63
+ [key: string]: any;
64
+ }>) | (() => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
65
+ [key: string]: any;
66
+ }>[] | undefined), unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, Record<string, any>, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
67
+ data: {
68
+ type: PropType<ComponentInstance>;
69
+ required: true;
70
+ };
71
+ resolveRenderer: {
72
+ type: PropType<ResolveRenderer | undefined>;
73
+ default: () => ({ type }: ComponentInstance) => string | ConcreteComponent<{}, any, any, vue_demi.ComputedOptions, vue_demi.MethodOptions>;
74
+ };
75
+ behaviorTracking: {
76
+ type: PropType<"onLoad" | "onView" | undefined>;
77
+ default: string;
78
+ };
79
+ }>>, {
80
+ resolveRenderer: ResolveRenderer | undefined;
81
+ behaviorTracking: "onLoad" | "onView" | undefined;
82
+ }>;
55
83
 
56
84
  declare type SlotComponentProps = {
57
85
  /** Name of the slot to render */
@@ -66,46 +94,43 @@ declare type SlotComponentProps = {
66
94
  * Renders the content of a Canvas composition's slot
67
95
  * @vue-prop {String} name - name of the Uniform Canvas slot you wish to scope to
68
96
  */
69
- declare const SlotContent: Component;
97
+ declare const SlotContent: vue_demi.DefineComponent<{
98
+ name: {
99
+ type: PropType<string | undefined>;
100
+ };
101
+ resolveRenderer: {
102
+ type: PropType<ResolveRenderer | undefined>;
103
+ };
104
+ }, () => (ConcreteComponent<any, any, any, vue_demi.ComputedOptions, vue_demi.MethodOptions> | vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
105
+ [key: string]: any;
106
+ }>[])[], unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, Record<string, any>, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
107
+ name: {
108
+ type: PropType<string | undefined>;
109
+ };
110
+ resolveRenderer: {
111
+ type: PropType<ResolveRenderer | undefined>;
112
+ };
113
+ }>>, {}>;
70
114
 
71
115
  declare type DefaultNotImplementedComponentProps = {
72
116
  component: ComponentInstance;
73
117
  };
74
- declare const DefaultNotImplementedComponent: Component;
75
-
76
- /**
77
- * Finds the data for the provide slot name
78
- * @param {Object} slots - Array<MapSlotDataResolve> e.g. [{ name: 'string', components: [{ ... }]}]
79
- * @param {string} name - Name of the slot that you want find within the array of slots
80
- * @returns {Object} - Object of found slot
81
- */
82
- declare const getDataForSlot: (slots: Array<MapComponentNameProps>, name: string) => MapComponentNameProps | undefined;
83
- /**
84
- * Converts the Uniform Canvas data into an array
85
- * @param {Object} slots -
86
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
87
- */
88
- declare const mapSlotsData: (slots: SlotDataProps) => MapSlotDataResolve;
89
- /**
90
- *
91
- * @param {Object} slotData - Takes an object with name and components as key value pair
92
- * @returns {Array} - An array with key value pairs [{ name: 'string', components: [{ ... }], intentTag: {}}]
93
- */
94
- declare const mapPzSlotToVariants: (slotData: MapComponentNameProps) => {
95
- component: string;
96
- intentTag: any;
97
- }[];
98
- /**
99
- *
100
- * @param {Object} slotData - Takes an object with name and components as key value pair
101
- * @returns - An array with key value pairs [{ name: 'string', components: [{ ... }]}]
102
- */
103
- declare const mapTestSlotToVariants: (slotData: MapComponentNameProps) => {
104
- component: string;
105
- }[];
118
+ declare const DefaultNotImplementedComponent: vue_demi.DefineComponent<{
119
+ component: {
120
+ type: PropType<ComponentInstance>;
121
+ required: true;
122
+ };
123
+ }, () => vue_demi.VNode<vue_demi.RendererNode, vue_demi.RendererElement, {
124
+ [key: string]: any;
125
+ }>, unknown, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, Record<string, any>, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<vue_demi.ExtractPropTypes<{
126
+ component: {
127
+ type: PropType<ComponentInstance>;
128
+ required: true;
129
+ };
130
+ }>>, {}>;
106
131
 
107
132
  /**
108
- * Converts a raw Canvas component instance to React component props format.
133
+ * Converts a raw Canvas component instance to Vue component props format.
109
134
  * This merges each parameter moved to the root object and removes the 'value' node,
110
135
  * hugely simplifying rendering code. For example if the raw object has parameters.foo.value,
111
136
  * then the final props have props.foo === raw.parameters.foo.value.
@@ -124,7 +149,7 @@ declare function useCompositionEventEffect({ enabled, projectId, compositionIdRe
124
149
  declare const CANVAS_COMPOSITION_TYPE = "Composition";
125
150
  /** Public ID of Canvas slot component component type */
126
151
  declare const CANVAS_SLOT_CONTENT_TYPE = "SlotContent";
127
- declare const compositionInjectionKey: InjectionKey<Ref<ComponentInstance>>;
128
- declare const resolveRendererInjectionKey: InjectionKey<ResolveRenderer>;
152
+ declare const compositionInjectionKey = "uniformComposition";
153
+ declare const resolveRendererInjectionKey = "uniformResolveRenderer";
129
154
 
130
- export { CANVAS_COMPOSITION_TYPE, CANVAS_SLOT_CONTENT_TYPE, ComponentProps, Composition, CompositionProps, DefaultNotImplementedComponent, DefaultNotImplementedComponentProps, MapComponentNameProps, MapSlotDataResolve, PersonalizeComponent, ResolveRenderer, SlotComponentProps, SlotContent, SlotDataProps, TestComponent, UseCompositionEventEffectOptions, compositionInjectionKey, convertComponentToProps, getDataForSlot, mapPzSlotToVariants, mapSlotsData, mapTestSlotToVariants, resolveRendererInjectionKey, useCompositionEventEffect };
155
+ export { CANVAS_COMPOSITION_TYPE, CANVAS_SLOT_CONTENT_TYPE, ComponentProps, Composition, CompositionProps, DefaultNotImplementedComponent, DefaultNotImplementedComponentProps, PersonalizeComponent, ResolveRenderer, SlotComponentProps, SlotContent, TestComponent, UseCompositionEventEffectOptions, compositionInjectionKey, convertComponentToProps, resolveRendererInjectionKey, useCompositionEventEffect };
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- "use strict";import{defineComponent as A,computed as v,h as O,provide as I,inject as N,resolveComponent as _}from"vue-demi";var R="Composition",b="SlotContent",f=Symbol("uniformComposition"),C=Symbol("uniformResolveRenderer");import{CANVAS_ENRICHMENT_TAG_PARAM as V}from"@uniformdev/canvas";import{Track as k,TrackSlot as D,isUsingUniformContext as j}from"@uniformdev/context-vue";var g=A({name:R,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>_(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var d,y,S;let o=v(()=>{var l,c;return(c=e.data)!=null?c:(l=N(f))==null?void 0:l.value}),n=(d=e.resolveRenderer)!=null?d:N(C);I(f,o),I(C,n);let s=v(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.slots)!=null?c:{}}),p=v(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.parameters)!=null?c:{}}),i=v(()=>JSON.stringify(o.value)),r=(S=(y=o.value.parameters)==null?void 0:y[V])==null?void 0:S.value,a=e.behaviorTracking==="onLoad"?D:k,m=()=>{var l,c;return(c=(l=t.slots).default)==null?void 0:c.call(l,{slots:s.value,parameters:p.value})};return j()?()=>O(a,{behavior:r,key:i.value},m):m}});import{defineComponent as z,computed as K,h as T,inject as h}from"vue-demi";import{CANVAS_PERSONALIZE_TYPE as M,CANVAS_TEST_TYPE as U,mapSlotToPersonalizedVariations as L,mapSlotToTestVariations as Y}from"@uniformdev/canvas";import{Personalize as $,Test as F}from"@uniformdev/context-vue";function x(e){var s;let t=(s=e.parameters)!=null?s:{};return{...Object.entries(t).reduce((p,[i,{value:r}])=>({...p,[w(i)]:r}),{}),...e.data,component:e}}function w(e){return e.replace("$","")}function q(e,t){var p,i,r,a,m,d;let o=e==null?void 0:e.parameters,n=L((p=e.slots)==null?void 0:p.pz),s=(a=(r=(i=e.parameters)==null?void 0:i.trackingEventName)==null?void 0:r.value)!=null?a:"Untitled Personalization";return T($,{name:s,component:y=>t(y),variations:n,count:Number((d=(m=o==null?void 0:o.count)==null?void 0:m.value)!=null?d:1)})}function B(e,t){var p,i,r,a,m;let o=(i=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?i:[],n=(m=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?m:"Untitled Test",s=Y(o);return T(F,{variations:s,name:n,component:d=>t(d)})}function P({component:e,resolveRenderer:t}){let o=t==null?void 0:t(e);if(e.type===U)return B(e,n=>P({component:n,resolveRenderer:t}));if(e.type===M)return q(e,n=>P({component:n,resolveRenderer:t}));if(o){let n=x(e);return T(g,{data:e,resolveRenderer:t},()=>T(o,n))}console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e)}var Ce=z({name:b,inheritAttrs:!1,props:{name:{type:String,required:!0},resolveRenderer:{type:Function}},setup(e,t){var i;let o=h(f),n=(i=e.resolveRenderer)!=null?i:h(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=K(()=>{var r,a,m;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((m=o==null?void 0:o.value.slots)!=null?m:{}).flat()}).value.map(r=>{let a=P({component:r,resolveRenderer:n});return t.slots.default?t.slots.default({child:a,component:r}):a});return()=>p}});import{defineComponent as J,h as u}from"vue-demi";var G={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},H={margin:"0 0 1rem"},Pe=J({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>u("div",{key:"content",style:{...G}},[u("h2",{style:{...H}},`Component: ${o}`),u("p",[u("strong",`${o} has no Vue implementation. It may need to be added to your `),u("code",{},"resolveRenderer()"),u("strong",{}," function.")]),u("details",{},[u("summary",{},"props/attributes"),u("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});import{pascalCase as E}from"pascal-case";var be=(e,t)=>e.find(o=>o.name===t),Ie=e=>{let t=[];for(let o in e)t.push({name:o,components:e[o]});return t},Ne=e=>{let t=o=>(delete o.parameters.intentTag,o);return e.components.map(o=>{var n;return{component:E(o.type),intentTag:((n=o.parameters.intentTag)==null?void 0:n.value)||{intents:{}},...t(o)}})},ge=e=>{let t=o=>o;return e.components.map(o=>({component:E(o.type),...t(o)}))};import{CANVAS_DRAFT_STATE as X,createEventBus as Z,subscribeToComposition as Q}from"@uniformdev/canvas";import{watch as W}from"vue-demi";async function ee({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let s;W([()=>e,()=>o.value,()=>t],async()=>{if(s==null||s(),!e||!o.value||!t)return;let p=await Z();p&&(s=Q({eventBus:p,compositionId:o.value,compositionState:X,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}export{R as CANVAS_COMPOSITION_TYPE,b as CANVAS_SLOT_CONTENT_TYPE,g as Composition,Pe as DefaultNotImplementedComponent,Ce as SlotContent,f as compositionInjectionKey,x as convertComponentToProps,be as getDataForSlot,Ne as mapPzSlotToVariants,Ie as mapSlotsData,ge as mapTestSlotToVariants,C as resolveRendererInjectionKey,ee as useCompositionEventEffect};
1
+ import{defineComponent as x,computed as T,h as A,provide as b,inject as I,resolveComponent as g}from"vue-demi";var R="Composition",S="SlotContent",f="uniformComposition",C="uniformResolveRenderer";import{CANVAS_ENRICHMENT_TAG_PARAM as O}from"@uniformdev/canvas";import{Track as _,TrackSlot as k,isUsingUniformContext as w}from"@uniformdev/context-vue";var E=x({name:R,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>g(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var l,d,y;let o=T(()=>{var i,c;return(c=e.data)!=null?c:(i=I(f))==null?void 0:i.value}),n=(l=e.resolveRenderer)!=null?l:I(C);b(f,o),b(C,n);let s=T(()=>{var i,c;return(c=(i=o.value)==null?void 0:i.slots)!=null?c:{}}),p=T(()=>{var i,c;return(c=(i=o.value)==null?void 0:i.parameters)!=null?c:{}}),m=T(()=>JSON.stringify(o.value)),r=(y=(d=o.value.parameters)==null?void 0:d[O])==null?void 0:y.value,a=()=>{var i,c;return(c=(i=t.slots).default)==null?void 0:c.call(i,{slots:s.value,parameters:p.value})};if(w()){let i=e.behaviorTracking==="onLoad"?k:_;return()=>A(i,{behavior:r,key:m.value},a)}return a}});import{defineComponent as j,computed as z,h as v,inject as N}from"vue-demi";import{CANVAS_PERSONALIZE_TYPE as U,CANVAS_TEST_TYPE as K,mapSlotToPersonalizedVariations as L,mapSlotToTestVariations as Y}from"@uniformdev/canvas";import{Personalize as $,Test as D}from"@uniformdev/context-vue";function h(e){var s;let t=(s=e.parameters)!=null?s:{};return{...Object.entries(t).reduce((p,[m,{value:r}])=>({...p,[V(m)]:r}),{}),...e.data,component:e}}function V(e){return e.replace("$","")}var de=j({name:S,inheritAttrs:!1,props:{name:{type:String},resolveRenderer:{type:Function}},setup(e,t){var m;let o=N(f),n=(m=e.resolveRenderer)!=null?m:N(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=z(()=>{var r,a,l;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((l=o==null?void 0:o.value.slots)!=null?l:{}).flat()}).value.map(r=>{let a=P({component:r,resolveRenderer:n});return t.slots.default?t.slots.default({child:a,component:r}):a});return()=>p}});function M(e,t){var p,m,r,a,l,d;let o=e==null?void 0:e.parameters,n=L((p=e.slots)==null?void 0:p.pz),s=(a=(r=(m=e.parameters)==null?void 0:m.trackingEventName)==null?void 0:r.value)!=null?a:"Untitled Personalization";return v($,{name:s,component:y=>t(y),variations:n,count:Number((d=(l=o==null?void 0:o.count)==null?void 0:l.value)!=null?d:1)})}function F(e,t){var p,m,r,a,l;let o=(m=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?m:[],n=(l=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?l:"Untitled Test",s=Y(o);return v(D,{variations:s,name:n,component:d=>t(d)})}function P({component:e,resolveRenderer:t}){if(e.type===K)return F(e,n=>P({component:n,resolveRenderer:t}));if(e.type===U)return M(e,n=>P({component:n,resolveRenderer:t}));let o=t==null?void 0:t(e);if(o){let n=h(e);return v(E,{data:e,resolveRenderer:t},()=>v(o,n))}return console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e),v("")}import{defineComponent as q,h as u}from"vue-demi";var B={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},J={margin:"0 0 1rem"},ve=q({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>u("div",{key:"content",style:{...B}},[u("h2",{style:{...J}},`Component: ${o}`),u("p",[u("strong",`${o} has no Vue implementation. It may need to be added to your `),u("code",{},"resolveRenderer()"),u("strong",{}," function.")]),u("details",{},[u("summary",{},"props/attributes"),u("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});import{CANVAS_DRAFT_STATE as G,createEventBus as H,subscribeToComposition as X}from"@uniformdev/canvas";import{watch as Z}from"vue-demi";async function Q({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let s;Z([()=>e,()=>o.value,()=>t],async()=>{if(s==null||s(),!e||!o.value||!t)return;let p=await H();p&&(s=X({eventBus:p,compositionId:o.value,compositionState:G,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}export{R as CANVAS_COMPOSITION_TYPE,S as CANVAS_SLOT_CONTENT_TYPE,E as Composition,ve as DefaultNotImplementedComponent,de as SlotContent,f as compositionInjectionKey,h as convertComponentToProps,C as resolveRendererInjectionKey,Q as useCompositionEventEffect};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var I=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var o in t)I(e,o,{get:t[o],enumerable:!0})},K=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!w.call(e,r)&&r!==o&&I(e,r,{get:()=>t[r],enumerable:!(n=D(t,r))||n.enumerable});return e};var M=e=>K(I({},"__esModule",{value:!0}),e);var Z={};z(Z,{CANVAS_COMPOSITION_TYPE:()=>N,CANVAS_SLOT_CONTENT_TYPE:()=>g,Composition:()=>x,DefaultNotImplementedComponent:()=>B,SlotContent:()=>$,compositionInjectionKey:()=>v,convertComponentToProps:()=>h,getDataForSlot:()=>J,mapPzSlotToVariants:()=>H,mapSlotsData:()=>G,mapTestSlotToVariants:()=>X,resolveRendererInjectionKey:()=>T,useCompositionEventEffect:()=>k});module.exports=M(Z);var s=require("vue-demi");var N="Composition",g="SlotContent",v=Symbol("uniformComposition"),T=Symbol("uniformResolveRenderer");var _=require("@uniformdev/canvas"),P=require("@uniformdev/context-vue");var x=(0,s.defineComponent)({name:N,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>(0,s.resolveComponent)(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var y,R,O;let o=(0,s.computed)(()=>{var d,f;return(f=e.data)!=null?f:(d=(0,s.inject)(v))==null?void 0:d.value}),n=(y=e.resolveRenderer)!=null?y:(0,s.inject)(T);(0,s.provide)(v,o),(0,s.provide)(T,n);let r=(0,s.computed)(()=>{var d,f;return(f=(d=o.value)==null?void 0:d.slots)!=null?f:{}}),a=(0,s.computed)(()=>{var d,f;return(f=(d=o.value)==null?void 0:d.parameters)!=null?f:{}}),m=(0,s.computed)(()=>JSON.stringify(o.value)),p=(O=(R=o.value.parameters)==null?void 0:R[_.CANVAS_ENRICHMENT_TAG_PARAM])==null?void 0:O.value,i=e.behaviorTracking==="onLoad"?P.TrackSlot:P.Track,u=()=>{var d,f;return(f=(d=t.slots).default)==null?void 0:f.call(d,{slots:r.value,parameters:a.value})};return(0,P.isUsingUniformContext)()?()=>(0,s.h)(i,{behavior:p,key:m.value},u):u}});var l=require("vue-demi"),C=require("@uniformdev/canvas"),b=require("@uniformdev/context-vue");function h(e){var r;let t=(r=e.parameters)!=null?r:{};return{...Object.entries(t).reduce((a,[m,{value:p}])=>({...a,[U(m)]:p}),{}),...e.data,component:e}}function U(e){return e.replace("$","")}function L(e,t){var a,m,p,i,u,y;let o=e==null?void 0:e.parameters,n=(0,C.mapSlotToPersonalizedVariations)((a=e.slots)==null?void 0:a.pz),r=(i=(p=(m=e.parameters)==null?void 0:m.trackingEventName)==null?void 0:p.value)!=null?i:"Untitled Personalization";return(0,l.h)(b.Personalize,{name:r,component:R=>t(R),variations:n,count:Number((y=(u=o==null?void 0:o.count)==null?void 0:u.value)!=null?y:1)})}function Y(e,t){var a,m,p,i,u;let o=(m=(a=e==null?void 0:e.slots)==null?void 0:a.test)!=null?m:[],n=(u=(i=(p=e==null?void 0:e.parameters)==null?void 0:p.test)==null?void 0:i.value)!=null?u:"Untitled Test",r=(0,C.mapSlotToTestVariations)(o);return(0,l.h)(b.Test,{variations:r,name:n,component:y=>t(y)})}function E({component:e,resolveRenderer:t}){let o=t==null?void 0:t(e);if(e.type===C.CANVAS_TEST_TYPE)return Y(e,n=>E({component:n,resolveRenderer:t}));if(e.type===C.CANVAS_PERSONALIZE_TYPE)return L(e,n=>E({component:n,resolveRenderer:t}));if(o){let n=h(e);return(0,l.h)(x,{data:e,resolveRenderer:t},()=>(0,l.h)(o,n))}console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e)}var $=(0,l.defineComponent)({name:g,inheritAttrs:!1,props:{name:{type:String,required:!0},resolveRenderer:{type:Function}},setup(e,t){var m;let o=(0,l.inject)(v),n=(m=e.resolveRenderer)!=null?m:(0,l.inject)(T);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let a=(0,l.computed)(()=>{var p,i,u;return e.name?(i=(p=o==null?void 0:o.value.slots)==null?void 0:p[e.name])!=null?i:[]:Object.values((u=o==null?void 0:o.value.slots)!=null?u:{}).flat()}).value.map(p=>{let i=E({component:p,resolveRenderer:n});return t.slots.default?t.slots.default({child:i,component:p}):i});return()=>a}});var c=require("vue-demi"),F={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},q={margin:"0 0 1rem"},B=(0,c.defineComponent)({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>(0,c.h)("div",{key:"content",style:{...F}},[(0,c.h)("h2",{style:{...q}},`Component: ${o}`),(0,c.h)("p",[(0,c.h)("strong",`${o} has no Vue implementation. It may need to be added to your `),(0,c.h)("code",{},"resolveRenderer()"),(0,c.h)("strong",{}," function.")]),(0,c.h)("details",{},[(0,c.h)("summary",{},"props/attributes"),(0,c.h)("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});var A=require("pascal-case"),J=(e,t)=>e.find(o=>o.name===t),G=e=>{let t=[];for(let o in e)t.push({name:o,components:e[o]});return t},H=e=>{let t=o=>(delete o.parameters.intentTag,o);return e.components.map(o=>{var n;return{component:(0,A.pascalCase)(o.type),intentTag:((n=o.parameters.intentTag)==null?void 0:n.value)||{intents:{}},...t(o)}})},X=e=>{let t=o=>o;return e.components.map(o=>({component:(0,A.pascalCase)(o.type),...t(o)}))};var S=require("@uniformdev/canvas"),V=require("vue-demi");async function k({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let r;(0,V.watch)([()=>e,()=>o.value,()=>t],async()=>{if(r==null||r(),!e||!o.value||!t)return;let a=await(0,S.createEventBus)();a&&(r=(0,S.subscribeToComposition)({eventBus:a,compositionId:o.value,compositionState:S.CANVAS_DRAFT_STATE,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}0&&(module.exports={CANVAS_COMPOSITION_TYPE,CANVAS_SLOT_CONTENT_TYPE,Composition,DefaultNotImplementedComponent,SlotContent,compositionInjectionKey,convertComponentToProps,getDataForSlot,mapPzSlotToVariants,mapSlotsData,mapTestSlotToVariants,resolveRendererInjectionKey,useCompositionEventEffect});
1
+ "use strict";var I=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var j=(e,t)=>{for(var o in t)I(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of w(t))!V.call(e,r)&&r!==o&&I(e,r,{get:()=>t[r],enumerable:!(n=k(t,r))||n.enumerable});return e};var U=e=>z(I({},"__esModule",{value:!0}),e);var q={};j(q,{CANVAS_COMPOSITION_TYPE:()=>E,CANVAS_SLOT_CONTENT_TYPE:()=>h,Composition:()=>N,DefaultNotImplementedComponent:()=>F,SlotContent:()=>L,compositionInjectionKey:()=>y,convertComponentToProps:()=>x,resolveRendererInjectionKey:()=>T,useCompositionEventEffect:()=>_});module.exports=U(q);var s=require("vue-demi");var E="Composition",h="SlotContent",y="uniformComposition",T="uniformResolveRenderer";var g=require("@uniformdev/canvas"),P=require("@uniformdev/context-vue");var N=(0,s.defineComponent)({name:E,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>(0,s.resolveComponent)(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var d,v,S;let o=(0,s.computed)(()=>{var m,f;return(f=e.data)!=null?f:(m=(0,s.inject)(y))==null?void 0:m.value}),n=(d=e.resolveRenderer)!=null?d:(0,s.inject)(T);(0,s.provide)(y,o),(0,s.provide)(T,n);let r=(0,s.computed)(()=>{var m,f;return(f=(m=o.value)==null?void 0:m.slots)!=null?f:{}}),a=(0,s.computed)(()=>{var m,f;return(f=(m=o.value)==null?void 0:m.parameters)!=null?f:{}}),c=(0,s.computed)(()=>JSON.stringify(o.value)),p=(S=(v=o.value.parameters)==null?void 0:v[g.CANVAS_ENRICHMENT_TAG_PARAM])==null?void 0:S.value,i=()=>{var m,f;return(f=(m=t.slots).default)==null?void 0:f.call(m,{slots:r.value,parameters:a.value})};if((0,P.isUsingUniformContext)()){let m=e.behaviorTracking==="onLoad"?P.TrackSlot:P.Track;return()=>(0,s.h)(m,{behavior:p,key:c.value},i)}return i}});var l=require("vue-demi"),C=require("@uniformdev/canvas"),b=require("@uniformdev/context-vue");function x(e){var r;let t=(r=e.parameters)!=null?r:{};return{...Object.entries(t).reduce((a,[c,{value:p}])=>({...a,[K(c)]:p}),{}),...e.data,component:e}}function K(e){return e.replace("$","")}var L=(0,l.defineComponent)({name:h,inheritAttrs:!1,props:{name:{type:String},resolveRenderer:{type:Function}},setup(e,t){var c;let o=(0,l.inject)(y),n=(c=e.resolveRenderer)!=null?c:(0,l.inject)(T);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let a=(0,l.computed)(()=>{var p,i,d;return e.name?(i=(p=o==null?void 0:o.value.slots)==null?void 0:p[e.name])!=null?i:[]:Object.values((d=o==null?void 0:o.value.slots)!=null?d:{}).flat()}).value.map(p=>{let i=A({component:p,resolveRenderer:n});return t.slots.default?t.slots.default({child:i,component:p}):i});return()=>a}});function Y(e,t){var a,c,p,i,d,v;let o=e==null?void 0:e.parameters,n=(0,C.mapSlotToPersonalizedVariations)((a=e.slots)==null?void 0:a.pz),r=(i=(p=(c=e.parameters)==null?void 0:c.trackingEventName)==null?void 0:p.value)!=null?i:"Untitled Personalization";return(0,l.h)(b.Personalize,{name:r,component:S=>t(S),variations:n,count:Number((v=(d=o==null?void 0:o.count)==null?void 0:d.value)!=null?v:1)})}function $(e,t){var a,c,p,i,d;let o=(c=(a=e==null?void 0:e.slots)==null?void 0:a.test)!=null?c:[],n=(d=(i=(p=e==null?void 0:e.parameters)==null?void 0:p.test)==null?void 0:i.value)!=null?d:"Untitled Test",r=(0,C.mapSlotToTestVariations)(o);return(0,l.h)(b.Test,{variations:r,name:n,component:v=>t(v)})}function A({component:e,resolveRenderer:t}){if(e.type===C.CANVAS_TEST_TYPE)return $(e,n=>A({component:n,resolveRenderer:t}));if(e.type===C.CANVAS_PERSONALIZE_TYPE)return Y(e,n=>A({component:n,resolveRenderer:t}));let o=t==null?void 0:t(e);if(o){let n=x(e);return(0,l.h)(N,{data:e,resolveRenderer:t},()=>(0,l.h)(o,n))}return console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e),(0,l.h)("")}var u=require("vue-demi"),D={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},M={margin:"0 0 1rem"},F=(0,u.defineComponent)({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>(0,u.h)("div",{key:"content",style:{...D}},[(0,u.h)("h2",{style:{...M}},`Component: ${o}`),(0,u.h)("p",[(0,u.h)("strong",`${o} has no Vue implementation. It may need to be added to your `),(0,u.h)("code",{},"resolveRenderer()"),(0,u.h)("strong",{}," function.")]),(0,u.h)("details",{},[(0,u.h)("summary",{},"props/attributes"),(0,u.h)("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});var R=require("@uniformdev/canvas"),O=require("vue-demi");async function _({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let r;(0,O.watch)([()=>e,()=>o.value,()=>t],async()=>{if(r==null||r(),!e||!o.value||!t)return;let a=await(0,R.createEventBus)();a&&(r=(0,R.subscribeToComposition)({eventBus:a,compositionId:o.value,compositionState:R.CANVAS_DRAFT_STATE,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}0&&(module.exports={CANVAS_COMPOSITION_TYPE,CANVAS_SLOT_CONTENT_TYPE,Composition,DefaultNotImplementedComponent,SlotContent,compositionInjectionKey,convertComponentToProps,resolveRendererInjectionKey,useCompositionEventEffect});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use strict";import{defineComponent as A,computed as v,h as O,provide as I,inject as N,resolveComponent as _}from"vue-demi";var R="Composition",b="SlotContent",f=Symbol("uniformComposition"),C=Symbol("uniformResolveRenderer");import{CANVAS_ENRICHMENT_TAG_PARAM as V}from"@uniformdev/canvas";import{Track as k,TrackSlot as D,isUsingUniformContext as j}from"@uniformdev/context-vue";var g=A({name:R,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>_(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var d,y,S;let o=v(()=>{var l,c;return(c=e.data)!=null?c:(l=N(f))==null?void 0:l.value}),n=(d=e.resolveRenderer)!=null?d:N(C);I(f,o),I(C,n);let s=v(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.slots)!=null?c:{}}),p=v(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.parameters)!=null?c:{}}),i=v(()=>JSON.stringify(o.value)),r=(S=(y=o.value.parameters)==null?void 0:y[V])==null?void 0:S.value,a=e.behaviorTracking==="onLoad"?D:k,m=()=>{var l,c;return(c=(l=t.slots).default)==null?void 0:c.call(l,{slots:s.value,parameters:p.value})};return j()?()=>O(a,{behavior:r,key:i.value},m):m}});import{defineComponent as z,computed as K,h as T,inject as h}from"vue-demi";import{CANVAS_PERSONALIZE_TYPE as M,CANVAS_TEST_TYPE as U,mapSlotToPersonalizedVariations as L,mapSlotToTestVariations as Y}from"@uniformdev/canvas";import{Personalize as $,Test as F}from"@uniformdev/context-vue";function x(e){var s;let t=(s=e.parameters)!=null?s:{};return{...Object.entries(t).reduce((p,[i,{value:r}])=>({...p,[w(i)]:r}),{}),...e.data,component:e}}function w(e){return e.replace("$","")}function q(e,t){var p,i,r,a,m,d;let o=e==null?void 0:e.parameters,n=L((p=e.slots)==null?void 0:p.pz),s=(a=(r=(i=e.parameters)==null?void 0:i.trackingEventName)==null?void 0:r.value)!=null?a:"Untitled Personalization";return T($,{name:s,component:y=>t(y),variations:n,count:Number((d=(m=o==null?void 0:o.count)==null?void 0:m.value)!=null?d:1)})}function B(e,t){var p,i,r,a,m;let o=(i=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?i:[],n=(m=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?m:"Untitled Test",s=Y(o);return T(F,{variations:s,name:n,component:d=>t(d)})}function P({component:e,resolveRenderer:t}){let o=t==null?void 0:t(e);if(e.type===U)return B(e,n=>P({component:n,resolveRenderer:t}));if(e.type===M)return q(e,n=>P({component:n,resolveRenderer:t}));if(o){let n=x(e);return T(g,{data:e,resolveRenderer:t},()=>T(o,n))}console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e)}var Ce=z({name:b,inheritAttrs:!1,props:{name:{type:String,required:!0},resolveRenderer:{type:Function}},setup(e,t){var i;let o=h(f),n=(i=e.resolveRenderer)!=null?i:h(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=K(()=>{var r,a,m;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((m=o==null?void 0:o.value.slots)!=null?m:{}).flat()}).value.map(r=>{let a=P({component:r,resolveRenderer:n});return t.slots.default?t.slots.default({child:a,component:r}):a});return()=>p}});import{defineComponent as J,h as u}from"vue-demi";var G={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},H={margin:"0 0 1rem"},Pe=J({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>u("div",{key:"content",style:{...G}},[u("h2",{style:{...H}},`Component: ${o}`),u("p",[u("strong",`${o} has no Vue implementation. It may need to be added to your `),u("code",{},"resolveRenderer()"),u("strong",{}," function.")]),u("details",{},[u("summary",{},"props/attributes"),u("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});import{pascalCase as E}from"pascal-case";var be=(e,t)=>e.find(o=>o.name===t),Ie=e=>{let t=[];for(let o in e)t.push({name:o,components:e[o]});return t},Ne=e=>{let t=o=>(delete o.parameters.intentTag,o);return e.components.map(o=>{var n;return{component:E(o.type),intentTag:((n=o.parameters.intentTag)==null?void 0:n.value)||{intents:{}},...t(o)}})},ge=e=>{let t=o=>o;return e.components.map(o=>({component:E(o.type),...t(o)}))};import{CANVAS_DRAFT_STATE as X,createEventBus as Z,subscribeToComposition as Q}from"@uniformdev/canvas";import{watch as W}from"vue-demi";async function ee({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let s;W([()=>e,()=>o.value,()=>t],async()=>{if(s==null||s(),!e||!o.value||!t)return;let p=await Z();p&&(s=Q({eventBus:p,compositionId:o.value,compositionState:X,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}export{R as CANVAS_COMPOSITION_TYPE,b as CANVAS_SLOT_CONTENT_TYPE,g as Composition,Pe as DefaultNotImplementedComponent,Ce as SlotContent,f as compositionInjectionKey,x as convertComponentToProps,be as getDataForSlot,Ne as mapPzSlotToVariants,Ie as mapSlotsData,ge as mapTestSlotToVariants,C as resolveRendererInjectionKey,ee as useCompositionEventEffect};
1
+ import{defineComponent as x,computed as T,h as A,provide as b,inject as I,resolveComponent as g}from"vue-demi";var R="Composition",S="SlotContent",f="uniformComposition",C="uniformResolveRenderer";import{CANVAS_ENRICHMENT_TAG_PARAM as O}from"@uniformdev/canvas";import{Track as _,TrackSlot as k,isUsingUniformContext as w}from"@uniformdev/context-vue";var E=x({name:R,inheritAttrs:!1,props:{data:{type:Object,required:!0},resolveRenderer:{type:Function,default:()=>({type:e})=>g(e)},behaviorTracking:{type:String,default:"onView"}},setup(e,t){var l,d,y;let o=T(()=>{var i,c;return(c=e.data)!=null?c:(i=I(f))==null?void 0:i.value}),n=(l=e.resolveRenderer)!=null?l:I(C);b(f,o),b(C,n);let s=T(()=>{var i,c;return(c=(i=o.value)==null?void 0:i.slots)!=null?c:{}}),p=T(()=>{var i,c;return(c=(i=o.value)==null?void 0:i.parameters)!=null?c:{}}),m=T(()=>JSON.stringify(o.value)),r=(y=(d=o.value.parameters)==null?void 0:d[O])==null?void 0:y.value,a=()=>{var i,c;return(c=(i=t.slots).default)==null?void 0:c.call(i,{slots:s.value,parameters:p.value})};if(w()){let i=e.behaviorTracking==="onLoad"?k:_;return()=>A(i,{behavior:r,key:m.value},a)}return a}});import{defineComponent as j,computed as z,h as v,inject as N}from"vue-demi";import{CANVAS_PERSONALIZE_TYPE as U,CANVAS_TEST_TYPE as K,mapSlotToPersonalizedVariations as L,mapSlotToTestVariations as Y}from"@uniformdev/canvas";import{Personalize as $,Test as D}from"@uniformdev/context-vue";function h(e){var s;let t=(s=e.parameters)!=null?s:{};return{...Object.entries(t).reduce((p,[m,{value:r}])=>({...p,[V(m)]:r}),{}),...e.data,component:e}}function V(e){return e.replace("$","")}var de=j({name:S,inheritAttrs:!1,props:{name:{type:String},resolveRenderer:{type:Function}},setup(e,t){var m;let o=N(f),n=(m=e.resolveRenderer)!=null?m:N(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=z(()=>{var r,a,l;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((l=o==null?void 0:o.value.slots)!=null?l:{}).flat()}).value.map(r=>{let a=P({component:r,resolveRenderer:n});return t.slots.default?t.slots.default({child:a,component:r}):a});return()=>p}});function M(e,t){var p,m,r,a,l,d;let o=e==null?void 0:e.parameters,n=L((p=e.slots)==null?void 0:p.pz),s=(a=(r=(m=e.parameters)==null?void 0:m.trackingEventName)==null?void 0:r.value)!=null?a:"Untitled Personalization";return v($,{name:s,component:y=>t(y),variations:n,count:Number((d=(l=o==null?void 0:o.count)==null?void 0:l.value)!=null?d:1)})}function F(e,t){var p,m,r,a,l;let o=(m=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?m:[],n=(l=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?l:"Untitled Test",s=Y(o);return v(D,{variations:s,name:n,component:d=>t(d)})}function P({component:e,resolveRenderer:t}){if(e.type===K)return F(e,n=>P({component:n,resolveRenderer:t}));if(e.type===U)return M(e,n=>P({component:n,resolveRenderer:t}));let o=t==null?void 0:t(e);if(o){let n=h(e);return v(E,{data:e,resolveRenderer:t},()=>v(o,n))}return console.warn(`[canvas] found component of type '${e.type}' which the 'resolveRenderer' prop returned no component for. Nothing will be rendered. The resolveRenderer function may need to be extended to handle the new type.`,e),v("")}import{defineComponent as q,h as u}from"vue-demi";var B={borderLeft:"10px solid #e42535",background:"rgba(122, 215, 218, 0.3)",color:"#1d3557",padding:"1rem",textAlign:"left",margin:"1rem 5vw"},J={margin:"0 0 1rem"},ve=q({name:"DefaultNotImplementedComponent",props:{component:{type:Object,required:!0}},setup(e,{attrs:t}){var n;let o=(n=e.component)==null?void 0:n.type;return()=>u("div",{key:"content",style:{...B}},[u("h2",{style:{...J}},`Component: ${o}`),u("p",[u("strong",`${o} has no Vue implementation. It may need to be added to your `),u("code",{},"resolveRenderer()"),u("strong",{}," function.")]),u("details",{},[u("summary",{},"props/attributes"),u("pre",{style:{overflowX:"auto"}},`${JSON.stringify(t)}`)])])}});import{CANVAS_DRAFT_STATE as G,createEventBus as H,subscribeToComposition as X}from"@uniformdev/canvas";import{watch as Z}from"vue-demi";async function Q({enabled:e,projectId:t,compositionIdRef:o,effect:n}){let s;Z([()=>e,()=>o.value,()=>t],async()=>{if(s==null||s(),!e||!o.value||!t)return;let p=await H();p&&(s=X({eventBus:p,compositionId:o.value,compositionState:G,projectId:t,callback:n,event:"updated"}))},{immediate:!0})}export{R as CANVAS_COMPOSITION_TYPE,S as CANVAS_SLOT_CONTENT_TYPE,E as Composition,ve as DefaultNotImplementedComponent,de as SlotContent,f as compositionInjectionKey,h as convertComponentToProps,C as resolveRendererInjectionKey,Q as useCompositionEventEffect};
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-vue",
3
- "version": "16.2.0",
3
+ "version": "16.2.1-nuxt.274+0a8a48855",
4
4
  "description": "Vue SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.esm.js",
8
8
  "exports": {
9
- "import": {
10
- "node": "./dist/index.mjs",
11
- "default": "./dist/index.esm.js"
12
- },
13
- "require": "./dist/index.js"
9
+ ".": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.js"
12
+ }
14
13
  },
15
14
  "types": "./dist/index.d.ts",
16
15
  "sideEffects": false,
@@ -23,14 +22,12 @@
23
22
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
24
23
  },
25
24
  "dependencies": {
26
- "@uniformdev/canvas": "^16.2.0",
27
- "@uniformdev/context-vue": "^16.2.0",
28
- "@vue/test-utils": "1.3.0",
29
- "pascal-case": "3.1.2",
30
- "uuid": "8.3.2",
31
- "vue-demi": "^0.12.5"
25
+ "@uniformdev/canvas": "^16.2.1-nuxt.274+0a8a48855",
26
+ "@vue/test-utils": "2.0.2",
27
+ "vue-demi": "^0.13.0"
32
28
  },
33
29
  "peerDependencies": {
30
+ "@uniformdev/context-vue": "^16.2.4",
34
31
  "@vue/composition-api": "^1.0.0-rc.1",
35
32
  "vue": "^2.0.0 || >=3.0.0"
36
33
  },
@@ -40,12 +37,13 @@
40
37
  }
41
38
  },
42
39
  "devDependencies": {
43
- "@testing-library/vue": "6.6.0",
40
+ "@testing-library/vue": "6.6.1",
44
41
  "@types/uuid": "8.3.4",
42
+ "@uniformdev/context-vue": "^16.2.1-nuxt.274+0a8a48855",
45
43
  "@vue/server-test-utils": "1.3.0",
46
- "vue": "3.2.25",
47
- "vue-server-renderer": "2.6.14",
48
- "vue-template-compiler": "2.6.14"
44
+ "vue": "3.2.37",
45
+ "vue-server-renderer": "2.7.7",
46
+ "vue-template-compiler": "2.7.7"
49
47
  },
50
48
  "files": [
51
49
  "dist",
@@ -63,5 +61,6 @@
63
61
  "> 1%",
64
62
  "last 2 versions",
65
63
  "not dead"
66
- ]
64
+ ],
65
+ "gitHead": "0a8a48855ef532336761a3872c3d515ab6b9113e"
67
66
  }
package/CHANGELOG.md DELETED
@@ -1,65 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [16.2.0](https://github.com/uniformdev/platform/compare/v16.1.0...v16.2.0) (2022-06-30)
7
-
8
- **Note:** Version bump only for package @uniformdev/canvas-vue
9
-
10
- ## [16.1.0](https://github.com/uniformdev/platform/compare/v16.0.0...v16.1.0) (2022-06-02)
11
-
12
- **Note:** Version bump only for package @uniformdev/canvas-vue
13
-
14
- ## [16.0.0](https://github.com/uniformdev/platform/compare/v15.0.0...v16.0.0) (2022-04-26)
15
-
16
- **Note:** Version bump only for package @uniformdev/canvas-vue
17
-
18
- ## [15.0.0](https://github.com/uniformdev/optimize/compare/v14.2.0...v15.0.0) (2022-03-28)
19
-
20
- **Note:** Version bump only for package @uniformdev/canvas-vue
21
-
22
- ### [14.1.1](https://github.com/uniformdev/optimize-sdk-internal/compare/v14.1.0...v14.1.1) (2022-02-02)
23
-
24
- **Note:** Version bump only for package @uniformdev/canvas-vue
25
-
26
- ## [14.1.0](https://github.com/uniformdev/optimize-sdk-internal/compare/v14.0.0...v14.1.0) (2022-02-02)
27
-
28
- **Note:** Version bump only for package @uniformdev/canvas-vue
29
-
30
- ## [14.0.0](https://github.com/uniformdev/optimize-sdk-internal/compare/v13.0.0...v14.0.0) (2021-12-21)
31
-
32
- ### Bug Fixes
33
-
34
- - **deps:** upgrade dependency versions ([2ed0022](https://github.com/uniformdev/optimize-sdk-internal/commit/2ed002274b06f06e13e0be1f3024a9b93a2f6d14))
35
-
36
- ## [13.0.0](https://github.com/uniformdev/optimize-sdk-internal/compare/v12.2.0...v13.0.0) (2021-11-24)
37
-
38
- ### ⚠ BREAKING CHANGES
39
-
40
- - **npm:** Bundled ESM exports from npm packages have changed internal package structure
41
- - **npm:** npm package files are now transpiled to target ES2018 instead of ES5, significantly reducing their size
42
-
43
- ### Features
44
-
45
- - **npm:** update package build system for better ESM compatibility ([d66f998](https://github.com/uniformdev/optimize-sdk-internal/commit/d66f998e30e186dbe7886a9d4197c49a8b25b89c))
46
-
47
- ## [12.2.0](https://github.com/uniformdev/optimize-sdk-internal/compare/v12.0.0...v12.2.0) (2021-10-28)
48
-
49
- ### Features
50
-
51
- - **canvas-vue:** add vetur support to canvas-vue package ([f4d6a28](https://github.com/uniformdev/optimize-sdk-internal/commit/f4d6a2831b436de432904b154555c27802e88731))
52
-
53
- ### Bug Fixes
54
-
55
- - add conditional check for uniformOptimizeContext to prevent application error if the module was not installed ([0e91900](https://github.com/uniformdev/optimize-sdk-internal/commit/0e919002048c66ee5cb038c05f299ca46e0c4436))
56
-
57
- ## [12.0.0](https://github.com/uniformdev/optimize-sdk-internal/compare/v11.0.0...v12.0.0) (2021-10-05)
58
-
59
- ### ⚠ BREAKING CHANGES
60
-
61
- - **canvas:** everything that was named 'UPM' at all is now equivalently titled 'Canvas' or 'CANVAS' depending on the context. Literally everything.
62
-
63
- ### Features
64
-
65
- - **canvas:** farewell UPM, we hardly knew ye ([00997ae](https://github.com/uniformdev/optimize-sdk-internal/commit/00997aecd388403a0b98d0a919750b994d3794c1))