@uniformdev/canvas-vue 16.0.1-nuxt.158 → 16.2.0
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/CHANGELOG.md +65 -0
- package/README.md +6 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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))
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
# Vue SDK for Uniform Canvas
|
|
2
2
|
|
|
3
|
+
**Supports only Vue 3, and uses Uniform Context SDK internally.**
|
|
4
|
+
|
|
5
|
+
⚠️ If you want Uniform Optimize with Vue 2 support, stick to the versions before v15.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
---
|
|
3
9
|
part of the [Uniform Platform](https://uniform.app). See our [documentation](https://docs.uniform.app) for more details.
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{defineComponent as A,computed as
|
|
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};
|
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:()=>
|
|
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});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{defineComponent as A,computed as
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas-vue",
|
|
3
|
-
"version": "16.0
|
|
3
|
+
"version": "16.2.0",
|
|
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
|
|
27
|
-
"@uniformdev/context-vue": "^16.0
|
|
26
|
+
"@uniformdev/canvas": "^16.2.0",
|
|
27
|
+
"@uniformdev/context-vue": "^16.2.0",
|
|
28
28
|
"@vue/test-utils": "1.3.0",
|
|
29
29
|
"pascal-case": "3.1.2",
|
|
30
30
|
"uuid": "8.3.2",
|
|
@@ -63,6 +63,5 @@
|
|
|
63
63
|
"> 1%",
|
|
64
64
|
"last 2 versions",
|
|
65
65
|
"not dead"
|
|
66
|
-
]
|
|
67
|
-
"gitHead": "fac0325bab53217a4c5a3c63d549812678f484f3"
|
|
66
|
+
]
|
|
68
67
|
}
|