@uniformdev/canvas-vue 16.0.1-alpha.143 → 16.0.1-nuxt.156
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 +1 -1
- package/dist/index.d.ts +44 -24
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/vetur/attributes.json +0 -26
- package/vetur/tags.json +0 -10
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConcreteComponent, Component, Ref, InjectionKey } from 'vue-demi';
|
|
2
2
|
import { ComponentInstance, ComponentParameter, SubscribeToCompositionOptions } from '@uniformdev/canvas';
|
|
3
3
|
|
|
4
|
-
declare type CompositionProps = {
|
|
5
|
-
/** A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject */
|
|
6
|
-
composition: ComponentInstance;
|
|
7
|
-
resolveRenderer?: typeof resolveComponent;
|
|
8
|
-
behaviorTracking?: 'onLoad' | 'onView';
|
|
9
|
-
};
|
|
10
|
-
declare const Composition: Component;
|
|
11
|
-
|
|
12
|
-
declare type SlotComponentProps = {
|
|
13
|
-
slotName?: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Generates a SlotContent Vue Component
|
|
17
|
-
* @vue-prop {String} slotName - name of the Uniform Canvas slot you wish to scope to
|
|
18
|
-
*/
|
|
19
|
-
declare const SlotContent: Component;
|
|
20
|
-
|
|
21
|
-
declare type DefaultNotImplementedComponentProps = {
|
|
22
|
-
component: ComponentInstance;
|
|
23
|
-
};
|
|
24
|
-
declare const DefaultNotImplementedComponent: Component;
|
|
25
|
-
|
|
26
4
|
declare type MapComponentNameProps = {
|
|
27
5
|
name: string;
|
|
28
6
|
components: Array<ComponentInstance>;
|
|
@@ -54,6 +32,46 @@ interface PersonalizeComponent {
|
|
|
54
32
|
declare type ComponentProps<TProps = unknown> = TProps & {
|
|
55
33
|
component: ComponentInstance;
|
|
56
34
|
};
|
|
35
|
+
declare type ResolveRenderer = (componentInstance: ComponentInstance) => ConcreteComponent | undefined;
|
|
36
|
+
|
|
37
|
+
declare type CompositionProps = {
|
|
38
|
+
/** A dynamic vue component that provides data to the Uniform Canvas SlotContent component via provide/inject */
|
|
39
|
+
data: ComponentInstance;
|
|
40
|
+
/** Resolves a Vue component to render a Canvas component, generally by inspecting type/variant */
|
|
41
|
+
resolveRenderer?: ResolveRenderer;
|
|
42
|
+
/**
|
|
43
|
+
* When to track behavior from enrichment tags on this composition
|
|
44
|
+
* onView: adds enrichment score when the visitor views the tagged component in the browser viewport.
|
|
45
|
+
* onLoad: adds enrichment score as soon as the composition mounts, regardless of viewport.
|
|
46
|
+
*
|
|
47
|
+
* NOTE: onView renders a <div> tag around components that have enrichment tags, to support IntersectionObserver.
|
|
48
|
+
* onLoad does not need to do this, and renders no wrapping tag.
|
|
49
|
+
*
|
|
50
|
+
* Default: onView
|
|
51
|
+
*/
|
|
52
|
+
behaviorTracking?: 'onLoad' | 'onView';
|
|
53
|
+
};
|
|
54
|
+
declare const Composition: Component;
|
|
55
|
+
|
|
56
|
+
declare type SlotComponentProps = {
|
|
57
|
+
/** Name of the slot to render */
|
|
58
|
+
name?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Function to resolve the Vue component to render for a given Canvas component type.
|
|
61
|
+
* If not specified, the resolveRenderer function on the nearest <Composition /> will be used, if any.
|
|
62
|
+
*/
|
|
63
|
+
resolveRenderer?: ResolveRenderer;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Renders the content of a Canvas composition's slot
|
|
67
|
+
* @vue-prop {String} name - name of the Uniform Canvas slot you wish to scope to
|
|
68
|
+
*/
|
|
69
|
+
declare const SlotContent: Component;
|
|
70
|
+
|
|
71
|
+
declare type DefaultNotImplementedComponentProps = {
|
|
72
|
+
component: ComponentInstance;
|
|
73
|
+
};
|
|
74
|
+
declare const DefaultNotImplementedComponent: Component;
|
|
57
75
|
|
|
58
76
|
/**
|
|
59
77
|
* Finds the data for the provide slot name
|
|
@@ -106,5 +124,7 @@ declare function useCompositionEventEffect({ enabled, projectId, compositionIdRe
|
|
|
106
124
|
declare const CANVAS_COMPOSITION_TYPE = "Composition";
|
|
107
125
|
/** Public ID of Canvas slot component component type */
|
|
108
126
|
declare const CANVAS_SLOT_CONTENT_TYPE = "SlotContent";
|
|
127
|
+
declare const compositionInjectionKey: InjectionKey<Ref<ComponentInstance>>;
|
|
128
|
+
declare const resolveRendererInjectionKey: InjectionKey<ResolveRenderer>;
|
|
109
129
|
|
|
110
|
-
export { CANVAS_COMPOSITION_TYPE, CANVAS_SLOT_CONTENT_TYPE, ComponentProps, Composition, CompositionProps, DefaultNotImplementedComponent, DefaultNotImplementedComponentProps, MapComponentNameProps, MapSlotDataResolve, PersonalizeComponent, SlotComponentProps, SlotContent, SlotDataProps, TestComponent, UseCompositionEventEffectOptions, convertComponentToProps, getDataForSlot, mapPzSlotToVariants, mapSlotsData, mapTestSlotToVariants, useCompositionEventEffect };
|
|
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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{defineComponent as
|
|
1
|
+
"use strict";import{defineComponent as A,computed as y,h as O,provide as I,inject as N,resolveComponent as _}from"vue-demi";var R="Composition",b="SlotContent",d=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 f,v,S;let o=y(()=>{var l,c;return(c=e.data)!=null?c:(l=N(d))==null?void 0:l.value}),n=(f=e.resolveRenderer)!=null?f:N(C);I(d,o),I(C,n);let s=y(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.slots)!=null?c:{}}),p=y(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.parameters)!=null?c:{}}),m=y(()=>JSON.stringify(o.value)),r=(S=(v=o.value.parameters)==null?void 0:v[V])==null?void 0:S.value,a=e.behaviorTracking==="onLoad"?D:k,i=()=>{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:m.value},i):i}});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,[m,{value:r}])=>({...p,[w(m)]:r}),{}),...e.data,component:e}}function w(e){return e.replace("$","")}function q(e,t){var p,m,r,a,i,f;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 T($,{name:s,component:v=>t(v),variations:n,count:Number((f=(i=o==null?void 0:o.count)==null?void 0:i.value)!=null?f:1)})}function B(e,t){var p,m,r,a,i;let o=(m=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?m:[],n=(i=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?i:"Untitled Test",s=Y(o);return T(F,{variations:s,name:n,component:f=>t(f)})}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 ye=z({name:b,inheritAttrs:!1,props:{name:{type:String,required:!0},resolveRenderer:{type:Function}},setup(e,t){var m;let o=h(d),n=(m=e.resolveRenderer)!=null?m:h(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=K(()=>{var r,a,i;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((i=o==null?void 0:o.value.slots)!=null?i:{}).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"},Re=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 Ne=(e,t)=>e.find(o=>o.name===t),ge=e=>{let t=[];for(let o in e)t.push({name:o,components:e[o]});return t},xe=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)}})},he=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,Re as DefaultNotImplementedComponent,ye as SlotContent,d as compositionInjectionKey,x as convertComponentToProps,Ne as getDataForSlot,xe as mapPzSlotToVariants,ge as mapSlotsData,he as mapTestSlotToVariants,C as resolveRendererInjectionKey,ee as useCompositionEventEffect};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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:()=>y,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",y=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 v,R,O;let o=(0,s.computed)(()=>{var f,d;return(d=e.data)!=null?d:(f=(0,s.inject)(y))==null?void 0:f.value}),n=(v=e.resolveRenderer)!=null?v:(0,s.inject)(T);(0,s.provide)(y,o),(0,s.provide)(T,n);let r=(0,s.computed)(()=>{var f,d;return(d=(f=o.value)==null?void 0:f.slots)!=null?d:{}}),a=(0,s.computed)(()=>{var f,d;return(d=(f=o.value)==null?void 0:f.parameters)!=null?d:{}}),i=(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,m=e.behaviorTracking==="onLoad"?P.TrackSlot:P.Track,u=()=>{var f,d;return(d=(f=t.slots).default)==null?void 0:d.call(f,{slots:r.value,parameters:a.value})};return(0,P.isUsingUniformContext)()?()=>(0,s.h)(m,{behavior:p,key:i.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,[i,{value:p}])=>({...a,[U(i)]:p}),{}),...e.data,component:e}}function U(e){return e.replace("$","")}function L(e,t){var a,i,p,m,u,v;let o=e==null?void 0:e.parameters,n=(0,C.mapSlotToPersonalizedVariations)((a=e.slots)==null?void 0:a.pz),r=(m=(p=(i=e.parameters)==null?void 0:i.trackingEventName)==null?void 0:p.value)!=null?m:"Untitled Personalization";return(0,l.h)(b.Personalize,{name:r,component:R=>t(R),variations:n,count:Number((v=(u=o==null?void 0:o.count)==null?void 0:u.value)!=null?v:1)})}function Y(e,t){var a,i,p,m,u;let o=(i=(a=e==null?void 0:e.slots)==null?void 0:a.test)!=null?i:[],n=(u=(m=(p=e==null?void 0:e.parameters)==null?void 0:p.test)==null?void 0:m.value)!=null?u:"Untitled Test",r=(0,C.mapSlotToTestVariations)(o);return(0,l.h)(b.Test,{variations:r,name:n,component:v=>t(v)})}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 i;let o=(0,l.inject)(y),n=(i=e.resolveRenderer)!=null?i:(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,m,u;return e.name?(m=(p=o==null?void 0:o.value.slots)==null?void 0:p[e.name])!=null?m:[]:Object.values((u=o==null?void 0:o.value.slots)!=null?u:{}).flat()}).value.map(p=>{let m=E({component:p,resolveRenderer:n});return t.slots.default?t.slots.default({child:m,component:p}):m});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});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{defineComponent as
|
|
1
|
+
"use strict";import{defineComponent as A,computed as y,h as O,provide as I,inject as N,resolveComponent as _}from"vue-demi";var R="Composition",b="SlotContent",d=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 f,v,S;let o=y(()=>{var l,c;return(c=e.data)!=null?c:(l=N(d))==null?void 0:l.value}),n=(f=e.resolveRenderer)!=null?f:N(C);I(d,o),I(C,n);let s=y(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.slots)!=null?c:{}}),p=y(()=>{var l,c;return(c=(l=o.value)==null?void 0:l.parameters)!=null?c:{}}),m=y(()=>JSON.stringify(o.value)),r=(S=(v=o.value.parameters)==null?void 0:v[V])==null?void 0:S.value,a=e.behaviorTracking==="onLoad"?D:k,i=()=>{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:m.value},i):i}});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,[m,{value:r}])=>({...p,[w(m)]:r}),{}),...e.data,component:e}}function w(e){return e.replace("$","")}function q(e,t){var p,m,r,a,i,f;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 T($,{name:s,component:v=>t(v),variations:n,count:Number((f=(i=o==null?void 0:o.count)==null?void 0:i.value)!=null?f:1)})}function B(e,t){var p,m,r,a,i;let o=(m=(p=e==null?void 0:e.slots)==null?void 0:p.test)!=null?m:[],n=(i=(a=(r=e==null?void 0:e.parameters)==null?void 0:r.test)==null?void 0:a.value)!=null?i:"Untitled Test",s=Y(o);return T(F,{variations:s,name:n,component:f=>t(f)})}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 ye=z({name:b,inheritAttrs:!1,props:{name:{type:String,required:!0},resolveRenderer:{type:Function}},setup(e,t){var m;let o=h(d),n=(m=e.resolveRenderer)!=null?m:h(C);if(!o||!n)throw new Error("<SlotContent /> can only be used inside a <Composition />");let p=K(()=>{var r,a,i;return e.name?(a=(r=o==null?void 0:o.value.slots)==null?void 0:r[e.name])!=null?a:[]:Object.values((i=o==null?void 0:o.value.slots)!=null?i:{}).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"},Re=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 Ne=(e,t)=>e.find(o=>o.name===t),ge=e=>{let t=[];for(let o in e)t.push({name:o,components:e[o]});return t},xe=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)}})},he=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,Re as DefaultNotImplementedComponent,ye as SlotContent,d as compositionInjectionKey,x as convertComponentToProps,Ne as getDataForSlot,xe as mapPzSlotToVariants,ge as mapSlotsData,he as mapTestSlotToVariants,C as resolveRendererInjectionKey,ee as useCompositionEventEffect};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-vue",
|
|
3
|
-
"version": "16.0.1-
|
|
3
|
+
"version": "16.0.1-nuxt.156+99cb5fbfb",
|
|
4
4
|
"description": "Vue SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\""
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@uniformdev/canvas": "^16.0.1-
|
|
27
|
-
"@uniformdev/context-vue": "^16.0.1-
|
|
26
|
+
"@uniformdev/canvas": "^16.0.1-nuxt.156+99cb5fbfb",
|
|
27
|
+
"@uniformdev/context-vue": "^16.0.1-nuxt.156+99cb5fbfb",
|
|
28
28
|
"@vue/test-utils": "1.3.0",
|
|
29
29
|
"pascal-case": "3.1.2",
|
|
30
30
|
"uuid": "8.3.2",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@testing-library/vue": "6.
|
|
43
|
+
"@testing-library/vue": "6.6.0",
|
|
44
44
|
"@types/uuid": "8.3.4",
|
|
45
45
|
"@vue/server-test-utils": "1.3.0",
|
|
46
46
|
"vue": "3.2.25",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"last 2 versions",
|
|
65
65
|
"not dead"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "99cb5fbfbf949ccfa2fa8403a9f62427c6f87de8"
|
|
68
68
|
}
|
package/vetur/attributes.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"composition/composition": {
|
|
3
|
-
"type": "object",
|
|
4
|
-
"description": "The Uniform canvas data to be used from a prop or via provide/inject using $__uniformData__"
|
|
5
|
-
},
|
|
6
|
-
"composition/page-meta": {
|
|
7
|
-
"type": "object",
|
|
8
|
-
"description": "Object includes id: string, name: string and slug: string, that is converted to page meta data"
|
|
9
|
-
},
|
|
10
|
-
"composition/wrapper": {
|
|
11
|
-
"type": "string | Component",
|
|
12
|
-
"description": "HTML tag name or a component. Defaults to `\"div\""
|
|
13
|
-
},
|
|
14
|
-
"slot-content/uniform-data": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"description": "Data that can be used as a named prop or provided by inject/provide from the Composition component"
|
|
17
|
-
},
|
|
18
|
-
"slot-content/slot-name": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The Uniform canvas slot name to render"
|
|
21
|
-
},
|
|
22
|
-
"slot-content/wrapper": {
|
|
23
|
-
"type": "string | Component",
|
|
24
|
-
"description": "HTML tag name or a component. Defaults to `\"div\""
|
|
25
|
-
}
|
|
26
|
-
}
|
package/vetur/tags.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"composition": {
|
|
3
|
-
"attributes": ["composition", "page-meta", "wrapper"],
|
|
4
|
-
"description": "Component that wraps around and provides uniformData to the SlotContent component"
|
|
5
|
-
},
|
|
6
|
-
"slot-content": {
|
|
7
|
-
"attributes": ["uniform-data", "slot-name", "wrapper"],
|
|
8
|
-
"description": "Component to render Uniform Canvas components"
|
|
9
|
-
}
|
|
10
|
-
}
|