@knapsack/types 4.70.0--canary.3797.b249674.0 → 4.70.0--canary.4821.56b0218.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,157 +1,1959 @@
1
- 'use strict';
2
-
3
- var t = require('superstruct');
4
- var Ae = require('color-string');
5
- var utils = require('@knapsack/utils');
6
- var immer = require('immer');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
-
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule) return e;
12
- var n = Object.create(null);
13
- if (e) {
14
- Object.keys(e).forEach(function (k) {
15
- if (k !== 'default') {
16
- var d = Object.getOwnPropertyDescriptor(e, k);
17
- Object.defineProperty(n, k, d.get ? d : {
18
- enumerable: true,
19
- get: function () { return e[k]; }
20
- });
21
- }
22
- });
23
- }
24
- n.default = e;
25
- return Object.freeze(n);
26
- }
27
-
28
- var t__namespace = /*#__PURE__*/_interopNamespace(t);
29
- var Ae__default = /*#__PURE__*/_interopDefault(Ae);
30
-
31
- var ce=Object.defineProperty;var n=(e,r)=>ce(e,"name",{value:r,configurable:!0});var ge=(e,r)=>{for(var i in r)ce(e,i,{get:r[i],enumerable:!0});};function Fe(e){if(typeof e!="string")return !1;try{return !!Ae__default.default.get(e)}catch{return !1}}n(Fe,"isColor");var F=t.define("ColorStringStruct",e=>typeof e=="string"&&Fe(e)),p=t.union([t.type({type:t.literal("value"),colorValue:F}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),go=t.type({type:t.literal("design-token"),tokenName:t.string()});var So=["h1","h2","h3","h4","h5","h6"],me=t.object({unit:t.enums(["rem","px"]),value:t.number()}),ye=t.union([t.string(),t.number()]),We=(i=>(i.woff2="woff2",i.woff="woff",i))(We||{}),_e=t.enums(["woff2","woff"]),Le=t.type({format:_e,type:t.literal("url"),path:t.string()}),N=t.type({family:t.optional(t.string()),weight:t.optional(t.union([ye,t.size(t.array(ye),2)])),src:t.optional(t.array(Le)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),Ge=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(Ge||{}),$e=(g=>(g["ultra-condensed"]="Ultra-condensed",g["extra-condensed"]="Extra-condensed",g.condensed="Condensed",g["semi-condensed"]="Semi-condensed",g.normal="Normal",g["semi-expanded"]="Semi-expanded",g.expanded="Expanded",g["extra-expanded"]="Extra-expanded",g["ultra-expanded"]="Ultra-expanded",g))($e||{}),w=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(p),hoverColor:t.optional(p),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),He=t.type({min:me,max:t.optional(me)}),a=t.type({fontSize:t.optional(He),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(p),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},de={},Co={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:de},xo={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:de};var I=t.union([a,t.type({accentColor:t.optional(p)})]),j=t.union([I,t.type({hoverColor:t.optional(p),backgroundColor:t.optional(p)})]),W=t.union([I,t.type({backgroundColor:t.optional(p)})]),qe={},Je={},Ye={},Ro={primaryNav:Ye,secondaryNav:Je,tabs:qe};var jo=t.object({version:t.literal(1),oldSillySidebarBgColor:F}),Wo=t.object({version:t.literal(2),anotherSillySidebarBgColor:F}),_o=t.object({version:t.literal(3),sidebarBgColor:F}),Lo=t.object({version:t.literal(4),primaryColor:p,darkColor:p,lightColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),Go=t.object({version:t.literal(5),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0))}),$o=t.object({version:t.literal(6),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Ho=t.object({version:t.literal(7),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),!0)),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),qo=t.object({version:t.literal(8),primaryColor:p,darkColor:p,lightColor:p,linkColor:p,appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Jo=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Xe=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(N)),navigation:t.optional(t.type({primaryNav:t.optional(j),secondaryNav:t.optional(W),tabs:t.optional(I)})),pageElements:t.type({pageTitle:t.optional(a),pageDescription:t.optional(a),headingXLarge:t.optional(a),headingLarge:t.optional(a),headingMedium:t.optional(a),headingSmall:t.optional(a),headingXSmall:t.optional(a),bodyText:t.optional(a),link:t.optional(w)})})}),Yo=Xe;var en=["large","medium","small"],tn=["large","medium","small"];var nn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var an=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Qe(e){return typeof e!="string"?!1:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Qe,"isTokenReference");function b(e){return typeof e=="string"&&e.includes("{")}n(b,"hasTokenReferences");function Ze(e){return !Qe(e)}n(Ze,"isNotTokenReference");var l=t__namespace.define("Token Reference",e=>typeof e!="string"?!1:Ze(e)?"Must start and end with curly braces":!0),et={border:"border",shadow:"shadow",transition:"transition"},tt=Object.values(et),ot={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},nt=Object.values(ot);function q(e){return tt.includes(e)}n(q,"isTokenTypeComposite");function Te(e){return nt.includes(e)}n(Te,"isTokenTypeSingular");utils.expectType([{inset:!1,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:!0}]);var c=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function Tn(e){return q(e.type)}n(Tn,"isTokenDataComposite");utils.expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:!1},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:!0,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function it(e){return typeof e=="string"&&!b(e)}n(it,"isTokenValueColor");var A=t__namespace.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":b(e)?"Value must not contain {} (token references)":!0),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),c),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function J(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!b(e)}n(J,"isTokenValueDimension");var D=t__namespace.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":!0),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("static"),originalValue:D}),c),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:D,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function Sn(e){return typeof e=="string"&&e.endsWith("ms")&&!b(e)}n(Sn,"isTokenValueDuration");var R=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":b(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?!0:'Value must be a number followed by "ms" (e.g., "100ms")'),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("static"),originalValue:R}),c),gt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function Cn(e){return (typeof e=="string"||typeof e=="number")&&!b(e)}n(Cn,"isTokenValueFontWeight");var ae=t__namespace.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":b(e)?"Value must not contain {} (token references)":!0),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("static"),originalValue:ae}),c),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:ae,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),L=t__namespace.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":!0:"Value must be an array"),mt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("static"),originalValue:L}),c),yt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:L,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function dt(e){return utils.isObject(e)&&it(e.color)&&J(e.offsetX)&&J(e.offsetY)&&J(e.blur)&&J(e.spread)}n(dt,"isTokenValueShadow");var Se=t__namespace.define("Shadow Value",e=>dt(e)?!0:`Expected a shadow value, got ${JSON.stringify(e)}`),kt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:Se,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),offsetX:t__namespace.union([D,l]),offsetY:t__namespace.union([D,l]),blur:t__namespace.union([D,l]),spread:t__namespace.union([D,l]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),l])})}),c),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:Se,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),O=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function St(e){return utils.isObject(e)&&A.is(e.color)&&O.is(e.style)&&D.is(e.width)}n(St,"isTokenValueBorder");var Ce=t__namespace.define("Border Value",St),Ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,l]),style:t__namespace.union([O,l]),width:t__namespace.union([D,l])})}),c),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c);function bt(e){return utils.isObject(e)&&L.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}n(bt,"isTokenValueTransition");var xe=t__namespace.define("Transition Value",bt),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([L,l]),duration:t__namespace.union([R,l]),delay:t__namespace.union([R,l])})}),c),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),c),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:O,kind:t__namespace.literal("static"),originalValue:O}),c),It=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:O,kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:O}),c),Rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),c),Bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),Et=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),c),Nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:l,referencedTokenId:t__namespace.string()}),c),xn=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,i=e.kind;try{switch(r){case"boolean":i==="ref"?Nt.assert(e):Et.assert(e);return;case"border":i==="ref"?xt.assert(e):Ct.assert(e);return;case"color":i==="ref"?st.assert(e):at.assert(e);return;case"cubicBezier":i==="ref"?yt.assert(e):mt.assert(e);return;case"dimension":i==="ref"?lt.assert(e):pt.assert(e);return;case"duration":i==="ref"?gt.assert(e):ct.assert(e);return;case"fontWeight":i==="ref"?ft.assert(e):ut.assert(e);return;case"number":i==="ref"?Bt.assert(e):Rt.assert(e);return;case"shadow":i==="ref"?Tt.assert(e):kt.assert(e);return;case"string":i==="ref"?vt.assert(e):Vt.assert(e);return;case"strokeStyle":i==="ref"?It.assert(e):Pt.assert(e);return;case"transition":i==="ref"?ht.assert(e):Dt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(g){throw g instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${g.message}. Received this data: "${JSON.stringify(e)}"`):g}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);utils.expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Bn(e){return Te(e?.type)}n(Bn,"isTokenSrcValueInfoSingular");function En(e){return q(e?.type)}n(En,"isTokenSrcValueInfoComposite");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function At(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(At,"isTokenSrcExtensions");utils.expectType(["#ddd",!0,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:!0,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Kn(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(Kn,"isTokenSrc");function Ot(e){return utils.isObject(e)&&!At(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(Ot,"isTokenGroup");function Fn(e){if(Ot(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return !0}return !1}n(Fn,"isTokenTypeVarRef");function jn(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(jn,"getPrimitiveValue");var Wn=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function _n(e){let{value:r,unit:i}=utils.parseNumberWithUnit(e);if(!i)return {value:r};if(i!=="px"&&i!=="rem"&&i!=="em"&&i!=="%")throw new Error(`Invalid unit "${i}" for value: ${r}`);return {value:r,unit:i}}n(_n,"parseTokenDimensionValue");var Hn=n(e=>utils.isObject(e)&&e.type==="text","isSlottedText");function qn(e){return utils.isObject(e)&&e.type==="template-demo"}n(qn,"isSlottedTemplateDemo");function Jn(e){return utils.isObject(e)&&e.type==="template-reference"}n(Jn,"isSlottedTemplateReference");var Ft=(i=>(i.portrait="portrait",i.landscape="landscape",i))(Ft||{});function Yn(e){return e?.type==="data"}n(Yn,"isDataDemo");function Xn(e){return e?.type==="template"}n(Xn,"isTemplateDemo");var be=(d=>(d.auto="auto",d.small="small",d.medium="medium",d.large="large",d.full="full",d))(be||{});function zt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}n(zt,"isKsAppClientDataNoMeta");var rr=t.define("KsAppClientDataNoMeta",zt);function Mt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(i=>utils.isObjKey(i,e)):!1}n(Mt,"isKsAppClientDataAndMeta");var ir=t.define("KsAppClientDataAndMeta",Mt),jt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),ar=jt.is;function _t(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(i=>utils.isObjKey(i,e))?!1:!utils.isObjKey("metaState",e)}n(_t,"isKsAppClientDataNoMetaV3");var br=t.define("KsAppClientDataNoMeta",_t);function Lt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(i=>utils.isObjKey(i,e)):!1}n(Lt,"isKsAppClientDataAndMetaV3");var Dr=t.define("KsAppClientDataAndMeta",Lt),Gt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),hr=Gt.is;var Pe={version:"4.1.7",checkIfNeeded:n(e=>!0,"checkIfNeeded"),migrate:n(e=>{if(!immer.isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([i,g])=>{r.data.slots[i]=g.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:i,templates:g=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:d=[]}of g)if(d.includes(r.id)){r.patternId=i,r.templateId=f;return}})());});},"migrate")};var Er=[Pe];var Ht=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.unknown="unknown",k))(Ht||{}),wr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),Ar=n(e=>"type"in e&&e.type==="number","isNumberProp"),Or=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Kr=n(e=>"enum"in e,"isOptionsProp"),Fr=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Ur=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),zr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),Mr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),jr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp");var Ie=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),qt=Ie,Lr=n(e=>qt.is(e),"isPatch"),le=t__namespace.array(Ie),Jt=le,Gr=n(e=>Jt.is(e),"isPatches"),Re=t__namespace.type({patches:le,inversePatches:t__namespace.optional(le),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Yt=Re,$r=n(e=>Yt.is(e),"isKsRemoteChange"),Xt=t__namespace.array(Re),Qt=Xt,Hr=n(e=>Qt.is(e),"isKsRemoteChanges");var Yr={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"};var Zt=(r=>(r.ready="ready",r))(Zt||{}),Qr="ks-meta";var ei={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var eo=(d=>(d.GitHub="GitHub",d.GitLab="GitLab",d.GitLabRest="GitLabRest",d.Bitbucket="Bitbucket",d.Azure="Azure",d))(eo||{}),to=(g=>(g.Conflicting="CONFLICTING",g.Mergeable="MERGEABLE",g.Unknown="UNKNOWN",g))(to||{}),oo=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(oo||{}),no=(i=>(i.Base64="BASE64",i.Text="TEXT",i))(no||{});var Ee={};ge(Ee,{ACTIONS:()=>Be,endpoint:()=>ro});var ro="/plugins",Be=(r=>(r.getContent="getContent",r))(Be||{});var we={};ge(we,{ACTIONS:()=>Ne,endpoint:()=>io});var io="/files",Ne=(r=>(r.verify="verify",r))(Ne||{});var ao={ADMIN:"ADMIN",ANONYMOUS:"ANONYMOUS",CONTRIBUTOR:"CONTRIBUTOR",EDITOR:"EDITOR",MANAGER:"MANAGER",VIEWER:"VIEWER"},ri=Object.values(ao);
32
-
33
- Object.defineProperty(exports, "isObjKey", {
34
- enumerable: true,
35
- get: function () { return utils.isObjKey; }
36
- });
37
- Object.defineProperty(exports, "isObject", {
38
- enumerable: true,
39
- get: function () { return utils.isObject; }
40
- });
41
- exports.BlockSizes = en;
42
- exports.BlockSpacings = tn;
43
- exports.ColorConfigStruct = p;
44
- exports.ColorStringStruct = F;
45
- exports.ColorTokenConfigStruct = go;
46
- exports.FilesApi = we;
47
- exports.FontFaceConfigStruct = N;
48
- exports.FontFaceFormatsEnumStruct = _e;
49
- exports.FontFaceSourceFormats = We;
50
- exports.FontFaceSourceStruct = Le;
51
- exports.FontFaceWeightStruct = ye;
52
- exports.FontSizeConfigStruct = He;
53
- exports.FontSizeConfigValStruct = me;
54
- exports.FontStretches = $e;
55
- exports.GitProviderType = eo;
56
- exports.HeadingLevels = So;
57
- exports.KsAppClientDataAndMetaStruct = ir;
58
- exports.KsAppClientDataAndMetaStructV3 = Dr;
59
- exports.KsAppClientDataNoMetaStruct = rr;
60
- exports.KsAppClientDataNoMetaStructV3 = br;
61
- exports.KsMetaStateStruct = jt;
62
- exports.KsMetaStateStructV3 = Gt;
63
- exports.KsRemoteChangesStruct = Qt;
64
- exports.KsRendererClientEvents = Zt;
65
- exports.MergeableState = to;
66
- exports.NavCustomizationConfigStruct = I;
67
- exports.PageHeaderSizes = be;
68
- exports.PluginsApi = Ee;
69
- exports.PrimaryNavCustomizationConfigStruct = j;
70
- exports.PropTypeNames = Ht;
71
- exports.RestActions = oo;
72
- exports.SecondaryNavCustomizationConfigStruct = W;
73
- exports.StageLayouts = Ft;
74
- exports.TextEncoding = no;
75
- exports.TextTransforms = Ge;
76
- exports.TokenReferenceStruct = l;
77
- exports.TokenValueColorStruct = A;
78
- exports.TokenValueCubicBezierStruct = L;
79
- exports.TokenValueDimensionStruct = D;
80
- exports.TokenValueDurationStruct = R;
81
- exports.TokenValueFontWeightStruct = ae;
82
- exports.TokenValueStrokeStyleStruct = O;
83
- exports.TypographyConfigStruct = a;
84
- exports.TypographyLinkConfigStruct = w;
85
- exports.UiConfigStruct = Yo;
86
- exports.UiConfigV10Struct = Xe;
87
- exports.UiConfigV1Struct = jo;
88
- exports.UiConfigV2Struct = Wo;
89
- exports.UiConfigV3Struct = _o;
90
- exports.UiConfigV4Struct = Lo;
91
- exports.UiConfigV5Struct = Go;
92
- exports.UiConfigV6Struct = $o;
93
- exports.UiConfigV7Struct = Ho;
94
- exports.UiConfigV8Struct = qo;
95
- exports.UiConfigV9Struct = Jo;
96
- exports.WS_EVENTS = ei;
97
- exports.assertTokenData = xn;
98
- exports.customizableNavElements = Ro;
99
- exports.getPrimitiveValue = jn;
100
- exports.hasTokenReferences = b;
101
- exports.isArrayOfObjectsProp = zr;
102
- exports.isArrayOfStringsProp = jr;
103
- exports.isBooleanProp = Or;
104
- exports.isCustomTypeScriptProp = Ur;
105
- exports.isDataDemo = Yn;
106
- exports.isDimensionString = Wn;
107
- exports.isFunctionProp = Fr;
108
- exports.isKsAppClientDataAndMeta = Mt;
109
- exports.isKsAppClientDataAndMetaV3 = Lt;
110
- exports.isKsAppClientDataNoMeta = zt;
111
- exports.isKsAppClientDataNoMetaV3 = _t;
112
- exports.isKsMetaState = ar;
113
- exports.isKsMetaStateV3 = hr;
114
- exports.isKsRemoteChange = $r;
115
- exports.isKsRemoteChanges = Hr;
116
- exports.isNotTokenReference = Ze;
117
- exports.isNumberProp = Ar;
118
- exports.isObjectProp = Mr;
119
- exports.isOptionsProp = Kr;
120
- exports.isPatch = Lr;
121
- exports.isPatches = Gr;
122
- exports.isSlottedTemplateDemo = qn;
123
- exports.isSlottedTemplateReference = Jn;
124
- exports.isSlottedText = Hn;
125
- exports.isStringProp = wr;
126
- exports.isTemplateDemo = Xn;
127
- exports.isTokenDataComposite = Tn;
128
- exports.isTokenGroup = Ot;
129
- exports.isTokenReference = Qe;
130
- exports.isTokenSrc = Kn;
131
- exports.isTokenSrcExtensions = At;
132
- exports.isTokenSrcValueInfoComposite = En;
133
- exports.isTokenSrcValueInfoSingular = Bn;
134
- exports.isTokenTypeComposite = q;
135
- exports.isTokenTypeSingular = Te;
136
- exports.isTokenTypeVarRef = Fn;
137
- exports.isTokenValueBorder = St;
138
- exports.isTokenValueColor = it;
139
- exports.isTokenValueDimension = J;
140
- exports.isTokenValueDuration = Sn;
141
- exports.isTokenValueFontWeight = Cn;
142
- exports.isTokenValueShadow = dt;
143
- exports.isTokenValueTransition = bt;
144
- exports.ksRendererClientMetaId = Qr;
145
- exports.migrations = Er;
146
- exports.pageElements = Co;
147
- exports.pageElementsV2 = xo;
148
- exports.parseTokenDimensionValue = _n;
149
- exports.rendererIds = Yr;
150
- exports.roles = ri;
151
- exports.rolesById = ao;
152
- exports.strokeStyleValues = an;
153
- exports.tokenNameDisplayFormats = nn;
154
- exports.tokenTypeComposites = tt;
155
- exports.tokenTypeSingulars = nt;
156
- //# sourceMappingURL=index.js.map
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ BlockSizes: () => BlockSizes,
34
+ BlockSpacings: () => BlockSpacings,
35
+ ColorConfigStruct: () => ColorConfigStruct,
36
+ ColorStringStruct: () => ColorStringStruct,
37
+ ColorTokenConfigStruct: () => ColorTokenConfigStruct,
38
+ FilesApi: () => files_exports,
39
+ FontFaceConfigStruct: () => FontFaceConfigStruct,
40
+ FontFaceFormatsEnumStruct: () => FontFaceFormatsEnumStruct,
41
+ FontFaceSourceFormats: () => FontFaceSourceFormats,
42
+ FontFaceSourceStruct: () => FontFaceSourceStruct,
43
+ FontFaceWeightStruct: () => FontFaceWeightStruct,
44
+ FontSizeConfigStruct: () => FontSizeConfigStruct,
45
+ FontSizeConfigValStruct: () => FontSizeConfigValStruct,
46
+ FontStretches: () => FontStretches,
47
+ GitProviderType: () => GitProviderType,
48
+ HeadingLevels: () => HeadingLevels,
49
+ KsAppClientDataAndMetaStruct: () => KsAppClientDataAndMetaStruct,
50
+ KsAppClientDataAndMetaStructV3: () => KsAppClientDataAndMetaStructV3,
51
+ KsAppClientDataNoMetaStruct: () => KsAppClientDataNoMetaStruct,
52
+ KsAppClientDataNoMetaStructV3: () => KsAppClientDataNoMetaStructV3,
53
+ KsMetaStateStruct: () => KsMetaStateStruct,
54
+ KsMetaStateStructV3: () => KsMetaStateStructV3,
55
+ KsRemoteChangesStruct: () => KsRemoteChangesStruct,
56
+ KsRendererClientEvents: () => KsRendererClientEvents,
57
+ MergeableState: () => MergeableState,
58
+ NavCustomizationConfigStruct: () => NavCustomizationConfigStruct,
59
+ PageHeaderSizes: () => PageHeaderSizes,
60
+ PluginsApi: () => plugins_exports,
61
+ PrimaryNavCustomizationConfigStruct: () => PrimaryNavCustomizationConfigStruct,
62
+ PropTypeNames: () => PropTypeNames,
63
+ RestActions: () => RestActions,
64
+ SecondaryNavCustomizationConfigStruct: () => SecondaryNavCustomizationConfigStruct,
65
+ StageLayouts: () => StageLayouts,
66
+ TextEncoding: () => TextEncoding,
67
+ TextTransforms: () => TextTransforms,
68
+ TokenReferenceStruct: () => TokenReferenceStruct,
69
+ TokenValueColorStruct: () => TokenValueColorStruct,
70
+ TokenValueCubicBezierStruct: () => TokenValueCubicBezierStruct,
71
+ TokenValueDimensionStruct: () => TokenValueDimensionStruct,
72
+ TokenValueDurationStruct: () => TokenValueDurationStruct,
73
+ TokenValueFontWeightStruct: () => TokenValueFontWeightStruct,
74
+ TokenValueStrokeStyleStruct: () => TokenValueStrokeStyleStruct,
75
+ TypographyConfigStruct: () => TypographyConfigStruct,
76
+ TypographyLinkConfigStruct: () => TypographyLinkConfigStruct,
77
+ UiConfigStruct: () => UiConfigStruct,
78
+ UiConfigV10Struct: () => UiConfigV10Struct,
79
+ UiConfigV1Struct: () => UiConfigV1Struct,
80
+ UiConfigV2Struct: () => UiConfigV2Struct,
81
+ UiConfigV3Struct: () => UiConfigV3Struct,
82
+ UiConfigV4Struct: () => UiConfigV4Struct,
83
+ UiConfigV5Struct: () => UiConfigV5Struct,
84
+ UiConfigV6Struct: () => UiConfigV6Struct,
85
+ UiConfigV7Struct: () => UiConfigV7Struct,
86
+ UiConfigV8Struct: () => UiConfigV8Struct,
87
+ UiConfigV9Struct: () => UiConfigV9Struct,
88
+ WS_EVENTS: () => WS_EVENTS,
89
+ assertTokenData: () => assertTokenData,
90
+ customizableNavElements: () => customizableNavElements,
91
+ getPrimitiveValue: () => getPrimitiveValue,
92
+ hasTokenReferences: () => hasTokenReferences,
93
+ isArrayOfObjectsProp: () => isArrayOfObjectsProp,
94
+ isArrayOfStringsProp: () => isArrayOfStringsProp,
95
+ isBooleanProp: () => isBooleanProp,
96
+ isCustomTypeScriptProp: () => isCustomTypeScriptProp,
97
+ isDataDemo: () => isDataDemo,
98
+ isDimensionString: () => isDimensionString,
99
+ isFunctionProp: () => isFunctionProp,
100
+ isKsAppClientDataAndMeta: () => isKsAppClientDataAndMeta,
101
+ isKsAppClientDataAndMetaV3: () => isKsAppClientDataAndMetaV3,
102
+ isKsAppClientDataNoMeta: () => isKsAppClientDataNoMeta,
103
+ isKsAppClientDataNoMetaV3: () => isKsAppClientDataNoMetaV3,
104
+ isKsMetaState: () => isKsMetaState,
105
+ isKsMetaStateV3: () => isKsMetaStateV3,
106
+ isKsRemoteChange: () => isKsRemoteChange,
107
+ isKsRemoteChanges: () => isKsRemoteChanges,
108
+ isNotTokenReference: () => isNotTokenReference,
109
+ isNumberProp: () => isNumberProp,
110
+ isObjKey: () => import_utils.isObjKey,
111
+ isObject: () => import_utils.isObject,
112
+ isObjectProp: () => isObjectProp,
113
+ isOptionsProp: () => isOptionsProp,
114
+ isPatch: () => isPatch,
115
+ isPatches: () => isPatches,
116
+ isSlottedTemplateDemo: () => isSlottedTemplateDemo,
117
+ isSlottedTemplateReference: () => isSlottedTemplateReference,
118
+ isSlottedText: () => isSlottedText,
119
+ isStringProp: () => isStringProp,
120
+ isTemplateDemo: () => isTemplateDemo,
121
+ isTokenDataComposite: () => isTokenDataComposite,
122
+ isTokenGroup: () => isTokenGroup,
123
+ isTokenReference: () => isTokenReference,
124
+ isTokenSrc: () => isTokenSrc,
125
+ isTokenSrcExtensions: () => isTokenSrcExtensions,
126
+ isTokenSrcValueInfoComposite: () => isTokenSrcValueInfoComposite,
127
+ isTokenSrcValueInfoSingular: () => isTokenSrcValueInfoSingular,
128
+ isTokenTypeComposite: () => isTokenTypeComposite,
129
+ isTokenTypeSingular: () => isTokenTypeSingular,
130
+ isTokenTypeVarRef: () => isTokenTypeVarRef,
131
+ isTokenValueBorder: () => isTokenValueBorder,
132
+ isTokenValueColor: () => isTokenValueColor,
133
+ isTokenValueDimension: () => isTokenValueDimension,
134
+ isTokenValueDuration: () => isTokenValueDuration,
135
+ isTokenValueFontWeight: () => isTokenValueFontWeight,
136
+ isTokenValueShadow: () => isTokenValueShadow,
137
+ isTokenValueTransition: () => isTokenValueTransition,
138
+ ksRendererClientMetaId: () => ksRendererClientMetaId,
139
+ migrations: () => migrations,
140
+ pageElements: () => pageElements,
141
+ pageElementsV2: () => pageElementsV2,
142
+ parseTokenDimensionValue: () => parseTokenDimensionValue,
143
+ rendererIds: () => rendererIds,
144
+ roles: () => roles,
145
+ rolesById: () => rolesById,
146
+ strokeStyleValues: () => strokeStyleValues,
147
+ tokenNameDisplayFormats: () => tokenNameDisplayFormats,
148
+ tokenTypeComposites: () => tokenTypeComposites,
149
+ tokenTypeSingulars: () => tokenTypeSingulars
150
+ });
151
+ module.exports = __toCommonJS(src_exports);
152
+
153
+ // src/ui-config.ts
154
+ var import_superstruct4 = require("superstruct");
155
+
156
+ // src/color-config.ts
157
+ var import_color_string = __toESM(require("color-string"));
158
+ var import_superstruct = require("superstruct");
159
+ function isColor(color) {
160
+ if (typeof color !== "string") return false;
161
+ try {
162
+ return !!import_color_string.default.get(color);
163
+ } catch (e) {
164
+ return false;
165
+ }
166
+ }
167
+ __name(isColor, "isColor");
168
+ var ColorStringStruct = (0, import_superstruct.define)(
169
+ "ColorStringStruct",
170
+ (value) => typeof value === "string" && isColor(value)
171
+ );
172
+ var ColorConfigStruct = (0, import_superstruct.union)([
173
+ (0, import_superstruct.type)({
174
+ type: (0, import_superstruct.literal)("value"),
175
+ colorValue: ColorStringStruct
176
+ }),
177
+ (0, import_superstruct.type)({
178
+ type: (0, import_superstruct.literal)("design-token"),
179
+ tokenName: (0, import_superstruct.string)()
180
+ })
181
+ ]);
182
+ var ColorTokenConfigStruct = (0, import_superstruct.type)({
183
+ type: (0, import_superstruct.literal)("design-token"),
184
+ tokenName: (0, import_superstruct.string)()
185
+ });
186
+
187
+ // src/typography-config.ts
188
+ var import_superstruct2 = require("superstruct");
189
+ var HeadingLevels = ["h1", "h2", "h3", "h4", "h5", "h6"];
190
+ var FontSizeConfigValStruct = (0, import_superstruct2.object)({
191
+ unit: (0, import_superstruct2.enums)(["rem", "px"]),
192
+ value: (0, import_superstruct2.number)()
193
+ });
194
+ var FontFaceWeightStruct = (0, import_superstruct2.union)([
195
+ (0, import_superstruct2.string)(),
196
+ (0, import_superstruct2.number)()
197
+ ]);
198
+ var FontFaceSourceFormats = /* @__PURE__ */ ((FontFaceSourceFormats2) => {
199
+ FontFaceSourceFormats2["woff2"] = "woff2";
200
+ FontFaceSourceFormats2["woff"] = "woff";
201
+ return FontFaceSourceFormats2;
202
+ })(FontFaceSourceFormats || {});
203
+ var FontFaceFormatsEnumStruct = (0, import_superstruct2.enums)(["woff2", "woff"]);
204
+ var FontFaceSourceStruct = (0, import_superstruct2.type)({
205
+ format: FontFaceFormatsEnumStruct,
206
+ type: (0, import_superstruct2.literal)("url"),
207
+ path: (0, import_superstruct2.string)()
208
+ });
209
+ var FontFaceConfigStruct = (0, import_superstruct2.type)({
210
+ family: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
211
+ weight: (0, import_superstruct2.optional)(
212
+ (0, import_superstruct2.union)([FontFaceWeightStruct, (0, import_superstruct2.size)((0, import_superstruct2.array)(FontFaceWeightStruct), 2)])
213
+ ),
214
+ src: (0, import_superstruct2.optional)((0, import_superstruct2.array)(FontFaceSourceStruct)),
215
+ style: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
216
+ display: (0, import_superstruct2.optional)((0, import_superstruct2.enums)(["auto", "block", "swap", "fallback", "optional"])),
217
+ variationSettings: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
218
+ unicodeRange: (0, import_superstruct2.optional)((0, import_superstruct2.string)())
219
+ });
220
+ var TextTransforms = /* @__PURE__ */ ((TextTransforms2) => {
221
+ TextTransforms2["inherit"] = "As typed";
222
+ TextTransforms2["capitalize"] = "Capitalize";
223
+ TextTransforms2["lowercase"] = "Lowercase";
224
+ TextTransforms2["uppercase"] = "Uppercase";
225
+ return TextTransforms2;
226
+ })(TextTransforms || {});
227
+ var FontStretches = /* @__PURE__ */ ((FontStretches2) => {
228
+ FontStretches2["ultra-condensed"] = "Ultra-condensed";
229
+ FontStretches2["extra-condensed"] = "Extra-condensed";
230
+ FontStretches2["condensed"] = "Condensed";
231
+ FontStretches2["semi-condensed"] = "Semi-condensed";
232
+ FontStretches2["normal"] = "Normal";
233
+ FontStretches2["semi-expanded"] = "Semi-expanded";
234
+ FontStretches2["expanded"] = "Expanded";
235
+ FontStretches2["extra-expanded"] = "Extra-expanded";
236
+ FontStretches2["ultra-expanded"] = "Ultra-expanded";
237
+ return FontStretches2;
238
+ })(FontStretches || {});
239
+ var TypographyLinkConfigStruct = (0, import_superstruct2.type)({
240
+ fontWeight: (0, import_superstruct2.optional)((0, import_superstruct2.union)([(0, import_superstruct2.string)(), (0, import_superstruct2.number)()])),
241
+ textColor: (0, import_superstruct2.optional)(ColorConfigStruct),
242
+ hoverColor: (0, import_superstruct2.optional)(ColorConfigStruct),
243
+ underline: (0, import_superstruct2.optional)((0, import_superstruct2.boolean)()),
244
+ textTransform: (0, import_superstruct2.optional)(
245
+ (0, import_superstruct2.enums)(["inherit", "capitalize", "lowercase", "uppercase"])
246
+ ),
247
+ fontStretch: (0, import_superstruct2.optional)(
248
+ (0, import_superstruct2.enums)([
249
+ "ultra-condensed",
250
+ "extra-condensed",
251
+ "condensed",
252
+ "semi-condensed",
253
+ "normal",
254
+ "semi-expanded",
255
+ "expanded",
256
+ "extra-expanded",
257
+ "ultra-expanded"
258
+ ])
259
+ )
260
+ });
261
+ var FontSizeConfigStruct = (0, import_superstruct2.type)({
262
+ min: FontSizeConfigValStruct,
263
+ max: (0, import_superstruct2.optional)(FontSizeConfigValStruct)
264
+ });
265
+ var TypographyConfigStruct = (0, import_superstruct2.type)({
266
+ fontSize: (0, import_superstruct2.optional)(FontSizeConfigStruct),
267
+ lineHeight: (0, import_superstruct2.optional)((0, import_superstruct2.union)([(0, import_superstruct2.string)(), (0, import_superstruct2.number)()])),
268
+ fontWeight: (0, import_superstruct2.optional)((0, import_superstruct2.union)([(0, import_superstruct2.string)(), (0, import_superstruct2.number)()])),
269
+ letterSpacing: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
270
+ fontFamily: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
271
+ textColor: (0, import_superstruct2.optional)(ColorConfigStruct),
272
+ textTransform: (0, import_superstruct2.optional)(
273
+ (0, import_superstruct2.enums)(["inherit", "capitalize", "lowercase", "uppercase"])
274
+ ),
275
+ fontStretch: (0, import_superstruct2.optional)(
276
+ (0, import_superstruct2.enums)([
277
+ "ultra-condensed",
278
+ "extra-condensed",
279
+ "condensed",
280
+ "semi-condensed",
281
+ "normal",
282
+ "semi-expanded",
283
+ "expanded",
284
+ "extra-expanded",
285
+ "ultra-expanded"
286
+ ])
287
+ )
288
+ });
289
+ var pageElementConfig = {};
290
+ var pageLinkElementConfig = {};
291
+ var pageElements = {
292
+ pageTitle: pageElementConfig,
293
+ pageDescription: pageElementConfig,
294
+ headingLarge: pageElementConfig,
295
+ headingMedium: pageElementConfig,
296
+ headingSmall: pageElementConfig,
297
+ bodyText: pageElementConfig,
298
+ link: pageLinkElementConfig
299
+ };
300
+ var pageElementsV2 = {
301
+ pageTitle: pageElementConfig,
302
+ pageDescription: pageElementConfig,
303
+ headingXLarge: pageElementConfig,
304
+ headingLarge: pageElementConfig,
305
+ headingMedium: pageElementConfig,
306
+ headingSmall: pageElementConfig,
307
+ headingXSmall: pageElementConfig,
308
+ bodyText: pageElementConfig,
309
+ link: pageLinkElementConfig
310
+ };
311
+
312
+ // src/nav-customization-config.ts
313
+ var import_superstruct3 = require("superstruct");
314
+ var NavCustomizationConfigStruct = (0, import_superstruct3.union)([
315
+ TypographyConfigStruct,
316
+ (0, import_superstruct3.type)({
317
+ accentColor: (0, import_superstruct3.optional)(ColorConfigStruct)
318
+ })
319
+ ]);
320
+ var PrimaryNavCustomizationConfigStruct = (0, import_superstruct3.union)([
321
+ NavCustomizationConfigStruct,
322
+ (0, import_superstruct3.type)({
323
+ hoverColor: (0, import_superstruct3.optional)(ColorConfigStruct),
324
+ backgroundColor: (0, import_superstruct3.optional)(ColorConfigStruct)
325
+ })
326
+ ]);
327
+ var SecondaryNavCustomizationConfigStruct = (0, import_superstruct3.union)([
328
+ NavCustomizationConfigStruct,
329
+ (0, import_superstruct3.type)({
330
+ backgroundColor: (0, import_superstruct3.optional)(ColorConfigStruct)
331
+ })
332
+ ]);
333
+ var navCustomizationConfig = {};
334
+ var secondaryNavCustomizationConfig = {};
335
+ var primaryNavCustomizationConfig = {};
336
+ var customizableNavElements = {
337
+ primaryNav: primaryNavCustomizationConfig,
338
+ secondaryNav: secondaryNavCustomizationConfig,
339
+ tabs: navCustomizationConfig
340
+ };
341
+
342
+ // src/ui-config.ts
343
+ var UiConfigV1Struct = (0, import_superstruct4.object)({
344
+ version: (0, import_superstruct4.literal)(1),
345
+ oldSillySidebarBgColor: ColorStringStruct
346
+ });
347
+ var UiConfigV2Struct = (0, import_superstruct4.object)({
348
+ version: (0, import_superstruct4.literal)(2),
349
+ anotherSillySidebarBgColor: ColorStringStruct
350
+ });
351
+ var UiConfigV3Struct = (0, import_superstruct4.object)({
352
+ version: (0, import_superstruct4.literal)(3),
353
+ sidebarBgColor: ColorStringStruct
354
+ });
355
+ var UiConfigV4Struct = (0, import_superstruct4.object)({
356
+ version: (0, import_superstruct4.literal)(4),
357
+ primaryColor: ColorConfigStruct,
358
+ darkColor: ColorConfigStruct,
359
+ lightColor: ColorConfigStruct,
360
+ enableSidebarIcons: (0, import_superstruct4.optional)((0, import_superstruct4.defaulted)((0, import_superstruct4.boolean)(), true))
361
+ });
362
+ var UiConfigV5Struct = (0, import_superstruct4.object)({
363
+ version: (0, import_superstruct4.literal)(5),
364
+ primaryColor: ColorConfigStruct,
365
+ darkColor: ColorConfigStruct,
366
+ lightColor: ColorConfigStruct,
367
+ linkColor: ColorConfigStruct,
368
+ enableSidebarIcons: (0, import_superstruct4.optional)((0, import_superstruct4.defaulted)((0, import_superstruct4.boolean)(), true))
369
+ });
370
+ var UiConfigV6Struct = (0, import_superstruct4.object)({
371
+ version: (0, import_superstruct4.literal)(6),
372
+ primaryColor: ColorConfigStruct,
373
+ darkColor: ColorConfigStruct,
374
+ lightColor: ColorConfigStruct,
375
+ linkColor: ColorConfigStruct,
376
+ enableSidebarIcons: (0, import_superstruct4.optional)((0, import_superstruct4.defaulted)((0, import_superstruct4.boolean)(), true)),
377
+ appearance: (0, import_superstruct4.type)({
378
+ customFonts: (0, import_superstruct4.optional)((0, import_superstruct4.array)(FontFaceConfigStruct)),
379
+ pageElements: (0, import_superstruct4.type)({
380
+ pageTitle: (0, import_superstruct4.optional)(TypographyConfigStruct),
381
+ pageDescription: (0, import_superstruct4.optional)(TypographyConfigStruct),
382
+ headingLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
383
+ headingMedium: (0, import_superstruct4.optional)(TypographyConfigStruct),
384
+ headingSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
385
+ bodyText: (0, import_superstruct4.optional)(TypographyConfigStruct),
386
+ link: (0, import_superstruct4.optional)(TypographyLinkConfigStruct)
387
+ })
388
+ })
389
+ });
390
+ var UiConfigV7Struct = (0, import_superstruct4.object)({
391
+ version: (0, import_superstruct4.literal)(7),
392
+ primaryColor: ColorConfigStruct,
393
+ darkColor: ColorConfigStruct,
394
+ lightColor: ColorConfigStruct,
395
+ linkColor: ColorConfigStruct,
396
+ enableSidebarIcons: (0, import_superstruct4.optional)((0, import_superstruct4.defaulted)((0, import_superstruct4.boolean)(), true)),
397
+ appearance: (0, import_superstruct4.type)({
398
+ customFonts: (0, import_superstruct4.optional)((0, import_superstruct4.array)(FontFaceConfigStruct)),
399
+ navigation: (0, import_superstruct4.optional)(
400
+ (0, import_superstruct4.type)({
401
+ primaryNav: (0, import_superstruct4.optional)(PrimaryNavCustomizationConfigStruct),
402
+ secondaryNav: (0, import_superstruct4.optional)(SecondaryNavCustomizationConfigStruct),
403
+ tabs: (0, import_superstruct4.optional)(NavCustomizationConfigStruct)
404
+ })
405
+ ),
406
+ pageElements: (0, import_superstruct4.type)({
407
+ pageTitle: (0, import_superstruct4.optional)(TypographyConfigStruct),
408
+ pageDescription: (0, import_superstruct4.optional)(TypographyConfigStruct),
409
+ headingLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
410
+ headingMedium: (0, import_superstruct4.optional)(TypographyConfigStruct),
411
+ headingSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
412
+ bodyText: (0, import_superstruct4.optional)(TypographyConfigStruct),
413
+ link: (0, import_superstruct4.optional)(TypographyLinkConfigStruct)
414
+ })
415
+ })
416
+ });
417
+ var UiConfigV8Struct = (0, import_superstruct4.object)({
418
+ version: (0, import_superstruct4.literal)(8),
419
+ primaryColor: ColorConfigStruct,
420
+ darkColor: ColorConfigStruct,
421
+ lightColor: ColorConfigStruct,
422
+ linkColor: ColorConfigStruct,
423
+ appearance: (0, import_superstruct4.type)({
424
+ customFonts: (0, import_superstruct4.optional)((0, import_superstruct4.array)(FontFaceConfigStruct)),
425
+ navigation: (0, import_superstruct4.optional)(
426
+ (0, import_superstruct4.type)({
427
+ primaryNav: (0, import_superstruct4.optional)(PrimaryNavCustomizationConfigStruct),
428
+ secondaryNav: (0, import_superstruct4.optional)(SecondaryNavCustomizationConfigStruct),
429
+ tabs: (0, import_superstruct4.optional)(NavCustomizationConfigStruct)
430
+ })
431
+ ),
432
+ pageElements: (0, import_superstruct4.type)({
433
+ pageTitle: (0, import_superstruct4.optional)(TypographyConfigStruct),
434
+ pageDescription: (0, import_superstruct4.optional)(TypographyConfigStruct),
435
+ headingLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
436
+ headingMedium: (0, import_superstruct4.optional)(TypographyConfigStruct),
437
+ headingSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
438
+ bodyText: (0, import_superstruct4.optional)(TypographyConfigStruct),
439
+ link: (0, import_superstruct4.optional)(TypographyLinkConfigStruct)
440
+ })
441
+ })
442
+ });
443
+ var UiConfigV9Struct = (0, import_superstruct4.object)({
444
+ version: (0, import_superstruct4.literal)(9),
445
+ appearance: (0, import_superstruct4.type)({
446
+ customFonts: (0, import_superstruct4.optional)((0, import_superstruct4.array)(FontFaceConfigStruct)),
447
+ navigation: (0, import_superstruct4.optional)(
448
+ (0, import_superstruct4.type)({
449
+ primaryNav: (0, import_superstruct4.optional)(PrimaryNavCustomizationConfigStruct),
450
+ secondaryNav: (0, import_superstruct4.optional)(SecondaryNavCustomizationConfigStruct),
451
+ tabs: (0, import_superstruct4.optional)(NavCustomizationConfigStruct)
452
+ })
453
+ ),
454
+ pageElements: (0, import_superstruct4.type)({
455
+ pageTitle: (0, import_superstruct4.optional)(TypographyConfigStruct),
456
+ pageDescription: (0, import_superstruct4.optional)(TypographyConfigStruct),
457
+ headingLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
458
+ headingMedium: (0, import_superstruct4.optional)(TypographyConfigStruct),
459
+ headingSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
460
+ bodyText: (0, import_superstruct4.optional)(TypographyConfigStruct),
461
+ link: (0, import_superstruct4.optional)(TypographyLinkConfigStruct)
462
+ })
463
+ })
464
+ });
465
+ var UiConfigV10Struct = (0, import_superstruct4.object)({
466
+ version: (0, import_superstruct4.literal)(10),
467
+ appearance: (0, import_superstruct4.type)({
468
+ customFonts: (0, import_superstruct4.optional)((0, import_superstruct4.array)(FontFaceConfigStruct)),
469
+ navigation: (0, import_superstruct4.optional)(
470
+ (0, import_superstruct4.type)({
471
+ primaryNav: (0, import_superstruct4.optional)(PrimaryNavCustomizationConfigStruct),
472
+ secondaryNav: (0, import_superstruct4.optional)(SecondaryNavCustomizationConfigStruct),
473
+ tabs: (0, import_superstruct4.optional)(NavCustomizationConfigStruct)
474
+ })
475
+ ),
476
+ pageElements: (0, import_superstruct4.type)({
477
+ pageTitle: (0, import_superstruct4.optional)(TypographyConfigStruct),
478
+ pageDescription: (0, import_superstruct4.optional)(TypographyConfigStruct),
479
+ headingXLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
480
+ headingLarge: (0, import_superstruct4.optional)(TypographyConfigStruct),
481
+ headingMedium: (0, import_superstruct4.optional)(TypographyConfigStruct),
482
+ headingSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
483
+ headingXSmall: (0, import_superstruct4.optional)(TypographyConfigStruct),
484
+ bodyText: (0, import_superstruct4.optional)(TypographyConfigStruct),
485
+ link: (0, import_superstruct4.optional)(TypographyLinkConfigStruct)
486
+ })
487
+ })
488
+ });
489
+ var UiConfigStruct = UiConfigV10Struct;
490
+
491
+ // src/app-client-data/index.ts
492
+ var import_superstruct5 = require("superstruct");
493
+
494
+ // src/type-utils.ts
495
+ var import_utils = require("@knapsack/utils");
496
+
497
+ // src/app-client-data/blocks.ts
498
+ var BlockSizes = ["large", "medium", "small"];
499
+ var BlockSpacings = ["large", "medium", "small"];
500
+
501
+ // src/app-client-data/design-tokens.ts
502
+ var tokenNameDisplayFormats = {
503
+ default: "Default",
504
+ android: "Android",
505
+ cssVar: "CSS Var",
506
+ json: "JSON",
507
+ less: "Less",
508
+ scss: "SCSS",
509
+ swift: "Swift"
510
+ };
511
+
512
+ // src/app-client-data/design-tokens-types/token-data.ts
513
+ var import_utils2 = require("@knapsack/utils");
514
+ var s2 = __toESM(require("superstruct"));
515
+
516
+ // src/app-client-data/design-tokens-types/token-definitions.ts
517
+ var s = __toESM(require("superstruct"));
518
+ var strokeStyleValues = [
519
+ "solid",
520
+ "dashed",
521
+ "dotted",
522
+ "double",
523
+ "groove",
524
+ "ridge",
525
+ "outset",
526
+ "inset"
527
+ ];
528
+ function isTokenReference(val) {
529
+ if (typeof val !== "string") return false;
530
+ const totalOpenBrackets = val.split("{").length - 1;
531
+ return totalOpenBrackets === 1 && val.startsWith("{") && val.endsWith("}");
532
+ }
533
+ __name(isTokenReference, "isTokenReference");
534
+ function hasTokenReferences(val) {
535
+ return typeof val === "string" && val.includes("{");
536
+ }
537
+ __name(hasTokenReferences, "hasTokenReferences");
538
+ function isNotTokenReference(value) {
539
+ return !isTokenReference(value);
540
+ }
541
+ __name(isNotTokenReference, "isNotTokenReference");
542
+ var TokenReferenceStruct = s.define(
543
+ "Token Reference",
544
+ (value) => {
545
+ if (typeof value !== "string") return false;
546
+ if (isNotTokenReference(value)) {
547
+ return "Must start and end with curly braces";
548
+ }
549
+ return true;
550
+ }
551
+ );
552
+ var compositeTypesRecord = {
553
+ border: "border",
554
+ shadow: "shadow",
555
+ transition: "transition"
556
+ };
557
+ var tokenTypeComposites = Object.values(compositeTypesRecord);
558
+ var singularTypesRecord = {
559
+ string: "string",
560
+ number: "number",
561
+ boolean: "boolean",
562
+ color: "color",
563
+ dimension: "dimension",
564
+ duration: "duration",
565
+ // fontFamily: 'fontFamily',
566
+ fontWeight: "fontWeight",
567
+ strokeStyle: "strokeStyle",
568
+ cubicBezier: "cubicBezier"
569
+ };
570
+ var tokenTypeSingulars = Object.values(singularTypesRecord);
571
+ function isTokenTypeComposite(type9) {
572
+ return tokenTypeComposites.includes(type9);
573
+ }
574
+ __name(isTokenTypeComposite, "isTokenTypeComposite");
575
+ function isTokenTypeSingular(type9) {
576
+ return tokenTypeSingulars.includes(type9);
577
+ }
578
+ __name(isTokenTypeSingular, "isTokenTypeSingular");
579
+
580
+ // src/app-client-data/design-tokens-types/token-data.ts
581
+ (0, import_utils2.expectType)([
582
+ {
583
+ inset: false,
584
+ color: "#000",
585
+ offsetX: "0px",
586
+ offsetY: "0px",
587
+ spread: "0px",
588
+ blur: "0px"
589
+ },
590
+ {
591
+ color: "#000",
592
+ offsetX: "0px",
593
+ offsetY: "0px",
594
+ spread: "0px",
595
+ blur: "0px",
596
+ inset: true
597
+ }
598
+ ]);
599
+ var TokenDataBaseStruct = s2.type({
600
+ id: s2.string(),
601
+ description: s2.optional(s2.string()),
602
+ references: s2.optional(s2.array(s2.array(s2.string()))),
603
+ tokenConfig: s2.optional(
604
+ s2.type({
605
+ purpose: s2.optional(s2.string())
606
+ })
607
+ )
608
+ });
609
+ (0, import_utils2.expectType)([
610
+ {
611
+ type: "duration",
612
+ value: "1ms",
613
+ originalValue: "1ms",
614
+ id: "1",
615
+ kind: "static"
616
+ },
617
+ {
618
+ type: "duration",
619
+ value: "1ms",
620
+ kind: "ref",
621
+ id: "1",
622
+ originalValue: "{a.b}",
623
+ referencedTokenId: "1"
624
+ },
625
+ // @ts-expect-error - kind is wrong
626
+ {
627
+ type: "duration",
628
+ value: "1ms",
629
+ originalValue: "1ms",
630
+ id: "1",
631
+ kind: "ref"
632
+ },
633
+ // @ts-expect-error - kind is wrong
634
+ {
635
+ type: "duration",
636
+ value: "1ms",
637
+ kind: "static",
638
+ id: "1",
639
+ originalValue: "{a.b}",
640
+ referencedTokenId: "1"
641
+ },
642
+ {
643
+ type: "color",
644
+ value: "#000",
645
+ kind: "static",
646
+ id: "1",
647
+ originalValue: "#000"
648
+ },
649
+ {
650
+ type: "color",
651
+ value: "#000",
652
+ kind: "ref",
653
+ id: "1",
654
+ originalValue: "{c.b}",
655
+ referencedTokenId: "c.b"
656
+ },
657
+ {
658
+ type: "cubicBezier",
659
+ kind: "static",
660
+ value: [0, 0, 0, 1],
661
+ originalValue: [0, 0, 0, 1],
662
+ id: "1"
663
+ }
664
+ ]);
665
+ function isTokenDataComposite(tokenData) {
666
+ return isTokenTypeComposite(tokenData.type);
667
+ }
668
+ __name(isTokenDataComposite, "isTokenDataComposite");
669
+ (0, import_utils2.expectType)([
670
+ {
671
+ type: "border",
672
+ kind: "static",
673
+ id: "1",
674
+ value: {
675
+ color: "#000",
676
+ style: "solid",
677
+ width: "1px"
678
+ },
679
+ originalValue: {
680
+ color: "#000",
681
+ style: "solid",
682
+ width: "1px"
683
+ }
684
+ },
685
+ {
686
+ type: "border",
687
+ kind: "ref",
688
+ referencedTokenId: "a.b",
689
+ id: "1",
690
+ value: {
691
+ color: "red",
692
+ style: "dashed",
693
+ width: "2px"
694
+ },
695
+ originalValue: "{a.b}"
696
+ },
697
+ {
698
+ type: "shadow",
699
+ value: {
700
+ color: "#000",
701
+ offsetX: "1px",
702
+ offsetY: "1px",
703
+ blur: "1px",
704
+ spread: "1px",
705
+ inset: false
706
+ },
707
+ originalValue: {
708
+ color: "#000",
709
+ offsetX: "{a.a}",
710
+ offsetY: "1px",
711
+ blur: "1px",
712
+ spread: "1px",
713
+ inset: false
714
+ },
715
+ id: "1",
716
+ kind: "static"
717
+ },
718
+ {
719
+ type: "shadow",
720
+ kind: "ref",
721
+ referencedTokenId: "a.b",
722
+ value: {
723
+ inset: true,
724
+ color: "red",
725
+ offsetX: "1px",
726
+ blur: "2px",
727
+ offsetY: "3px",
728
+ spread: "4px"
729
+ },
730
+ originalValue: "{a.b}",
731
+ id: "1"
732
+ },
733
+ {
734
+ type: "transition",
735
+ value: {
736
+ duration: "100ms",
737
+ delay: "200ms",
738
+ timingFunction: [0, 0, 0, 0]
739
+ },
740
+ originalValue: "{a.b}",
741
+ kind: "ref",
742
+ referencedTokenId: "a.b",
743
+ id: "1"
744
+ },
745
+ {
746
+ type: "transition",
747
+ kind: "static",
748
+ value: {
749
+ duration: "100ms",
750
+ delay: "200ms",
751
+ timingFunction: [0, 0, 0, 0]
752
+ },
753
+ originalValue: {
754
+ duration: "100ms",
755
+ delay: "{a.c}",
756
+ timingFunction: "{a.c}"
757
+ },
758
+ id: "1"
759
+ },
760
+ {
761
+ type: "transition",
762
+ kind: "static",
763
+ value: {
764
+ duration: "100ms",
765
+ delay: "200ms",
766
+ timingFunction: [0, 0, 0, 0]
767
+ },
768
+ originalValue: {
769
+ duration: "100ms",
770
+ delay: "200ms",
771
+ timingFunction: [0, 0, 0, 0]
772
+ },
773
+ id: "1"
774
+ }
775
+ ]);
776
+ function isTokenValueColor(value) {
777
+ return typeof value === "string" && !hasTokenReferences(value);
778
+ }
779
+ __name(isTokenValueColor, "isTokenValueColor");
780
+ var TokenValueColorStruct = s2.define(
781
+ "Color Value",
782
+ (value) => {
783
+ if (typeof value !== "string") {
784
+ return "Value must be a string";
785
+ }
786
+ if (value === "") {
787
+ return "Value must not be empty";
788
+ }
789
+ if (hasTokenReferences(value)) {
790
+ return "Value must not contain {} (token references)";
791
+ }
792
+ return true;
793
+ }
794
+ );
795
+ var TokenDataColorNonRefStruct = s2.assign(
796
+ s2.type({
797
+ type: s2.literal("color"),
798
+ value: TokenValueColorStruct,
799
+ kind: s2.literal("static"),
800
+ originalValue: TokenValueColorStruct
801
+ }),
802
+ TokenDataBaseStruct
803
+ );
804
+ var TokenDataColorRefStruct = s2.assign(
805
+ s2.type({
806
+ type: s2.literal("color"),
807
+ value: TokenValueColorStruct,
808
+ kind: s2.literal("ref"),
809
+ originalValue: TokenReferenceStruct,
810
+ referencedTokenId: s2.string()
811
+ }),
812
+ TokenDataBaseStruct
813
+ );
814
+ function isTokenValueDimension(value) {
815
+ return typeof value === "string" && (value.endsWith("px") || value.endsWith("rem")) && !hasTokenReferences(value);
816
+ }
817
+ __name(isTokenValueDimension, "isTokenValueDimension");
818
+ var TokenValueDimensionStruct = s2.define("Dimension Value", (value) => {
819
+ if (typeof value !== "string") {
820
+ return "Value must be a string";
821
+ }
822
+ if (hasTokenReferences(value)) {
823
+ return "Value must not contain {} (token references)";
824
+ }
825
+ if (!value.endsWith("px") && !value.endsWith("rem") && !value.endsWith("em") && !value.endsWith("%")) {
826
+ return "Value must end with px, rem, em or %";
827
+ }
828
+ return true;
829
+ });
830
+ var TokenDataDimensionNonRefStruct = s2.assign(
831
+ s2.type({
832
+ type: s2.literal("dimension"),
833
+ value: TokenValueDimensionStruct,
834
+ kind: s2.literal("static"),
835
+ originalValue: TokenValueDimensionStruct
836
+ }),
837
+ TokenDataBaseStruct
838
+ );
839
+ var TokenDataDimensionRefStruct = s2.assign(
840
+ s2.type({
841
+ type: s2.literal("dimension"),
842
+ value: TokenValueDimensionStruct,
843
+ kind: s2.literal("ref"),
844
+ originalValue: TokenReferenceStruct,
845
+ referencedTokenId: s2.string()
846
+ }),
847
+ TokenDataBaseStruct
848
+ );
849
+ function isTokenValueDuration(value) {
850
+ return typeof value === "string" && value.endsWith("ms") && !hasTokenReferences(value);
851
+ }
852
+ __name(isTokenValueDuration, "isTokenValueDuration");
853
+ var TokenValueDurationStruct = s2.define("Duration Value", (value) => {
854
+ if (typeof value !== "string") {
855
+ return "Value must be a string";
856
+ }
857
+ if (hasTokenReferences(value)) {
858
+ return "Value must not contain {} (token references)";
859
+ }
860
+ const durationRegex = /^\d+ms$/;
861
+ if (!durationRegex.test(value)) {
862
+ return 'Value must be a number followed by "ms" (e.g., "100ms")';
863
+ }
864
+ return true;
865
+ });
866
+ var TokenDataDurationNonRefStruct = s2.assign(
867
+ s2.type({
868
+ type: s2.literal("duration"),
869
+ value: TokenValueDurationStruct,
870
+ kind: s2.literal("static"),
871
+ originalValue: TokenValueDurationStruct
872
+ }),
873
+ TokenDataBaseStruct
874
+ );
875
+ var TokenDataDurationRefStruct = s2.assign(
876
+ s2.type({
877
+ type: s2.literal("duration"),
878
+ value: TokenValueDurationStruct,
879
+ kind: s2.literal("ref"),
880
+ originalValue: TokenReferenceStruct,
881
+ referencedTokenId: s2.string()
882
+ }),
883
+ TokenDataBaseStruct
884
+ );
885
+ function isTokenValueFontWeight(value) {
886
+ return (typeof value === "string" || typeof value === "number") && !hasTokenReferences(value);
887
+ }
888
+ __name(isTokenValueFontWeight, "isTokenValueFontWeight");
889
+ var TokenValueFontWeightStruct = s2.define("Font Weight Value", (value) => {
890
+ if (typeof value !== "string" && typeof value !== "number") {
891
+ return "Value must be a string or number";
892
+ }
893
+ if (hasTokenReferences(value)) {
894
+ return "Value must not contain {} (token references)";
895
+ }
896
+ return true;
897
+ });
898
+ var TokenDataFontWeightNonRefStruct = s2.assign(
899
+ s2.type({
900
+ type: s2.literal("fontWeight"),
901
+ value: TokenValueFontWeightStruct,
902
+ kind: s2.literal("static"),
903
+ originalValue: TokenValueFontWeightStruct
904
+ }),
905
+ TokenDataBaseStruct
906
+ );
907
+ var TokenDataFontWeightRefStruct = s2.assign(
908
+ s2.type({
909
+ type: s2.literal("fontWeight"),
910
+ value: TokenValueFontWeightStruct,
911
+ kind: s2.literal("ref"),
912
+ originalValue: TokenReferenceStruct,
913
+ referencedTokenId: s2.string()
914
+ }),
915
+ TokenDataBaseStruct
916
+ );
917
+ var TokenValueCubicBezierStruct = s2.define("Cubic Bezier Value", (value) => {
918
+ if (!Array.isArray(value)) {
919
+ return "Value must be an array";
920
+ }
921
+ if (value.length !== 4) {
922
+ return "Value must be an array of 4 numbers";
923
+ }
924
+ if (!value.every((v) => typeof v === "number")) {
925
+ return "Value must be an array of 4 numbers";
926
+ }
927
+ if (value[0] < 0 || value[0] > 1 || value[2] < 0 || value[2] > 1) {
928
+ return "The first and third cubicBezier values must be between 0 and 1";
929
+ }
930
+ return true;
931
+ });
932
+ var TokenDataCubicBezierNonRefStruct = s2.assign(
933
+ s2.type({
934
+ type: s2.literal("cubicBezier"),
935
+ value: TokenValueCubicBezierStruct,
936
+ kind: s2.literal("static"),
937
+ originalValue: TokenValueCubicBezierStruct
938
+ }),
939
+ TokenDataBaseStruct
940
+ );
941
+ var TokenDataCubicBezierRefStruct = s2.assign(
942
+ s2.type({
943
+ type: s2.literal("cubicBezier"),
944
+ value: TokenValueCubicBezierStruct,
945
+ kind: s2.literal("ref"),
946
+ originalValue: TokenReferenceStruct,
947
+ referencedTokenId: s2.string()
948
+ }),
949
+ TokenDataBaseStruct
950
+ );
951
+ function isTokenValueShadow(value) {
952
+ return (0, import_utils2.isObject)(value) && isTokenValueColor(value.color) && isTokenValueDimension(value.offsetX) && isTokenValueDimension(value.offsetY) && isTokenValueDimension(value.blur) && isTokenValueDimension(value.spread);
953
+ }
954
+ __name(isTokenValueShadow, "isTokenValueShadow");
955
+ var TokenValueShadowStruct = s2.define(
956
+ "Shadow Value",
957
+ (value) => {
958
+ if (isTokenValueShadow(value)) return true;
959
+ return `Expected a shadow value, got ${JSON.stringify(value)}`;
960
+ }
961
+ );
962
+ var TokenDataShadowNonRefStruct = s2.assign(
963
+ s2.type({
964
+ type: s2.literal("shadow"),
965
+ value: TokenValueShadowStruct,
966
+ kind: s2.literal("static"),
967
+ originalValue: s2.type({
968
+ color: s2.union([TokenValueColorStruct, TokenReferenceStruct]),
969
+ offsetX: s2.union([TokenValueDimensionStruct, TokenReferenceStruct]),
970
+ offsetY: s2.union([TokenValueDimensionStruct, TokenReferenceStruct]),
971
+ blur: s2.union([TokenValueDimensionStruct, TokenReferenceStruct]),
972
+ spread: s2.union([TokenValueDimensionStruct, TokenReferenceStruct]),
973
+ inset: s2.union([
974
+ // marking this as optional b/c it could be `undefined` instead of `false`
975
+ s2.optional(s2.boolean()),
976
+ TokenReferenceStruct
977
+ ])
978
+ })
979
+ }),
980
+ TokenDataBaseStruct
981
+ );
982
+ var TokenDataShadowRefStruct = s2.assign(
983
+ s2.type({
984
+ type: s2.literal("shadow"),
985
+ value: TokenValueShadowStruct,
986
+ kind: s2.literal("ref"),
987
+ originalValue: TokenReferenceStruct,
988
+ referencedTokenId: s2.string()
989
+ }),
990
+ TokenDataBaseStruct
991
+ );
992
+ var TokenValueStrokeStyleStruct = s2.union([
993
+ s2.literal("solid"),
994
+ s2.literal("dashed"),
995
+ s2.literal("dotted"),
996
+ s2.literal("double"),
997
+ s2.literal("groove"),
998
+ s2.literal("ridge"),
999
+ s2.literal("outset"),
1000
+ s2.literal("inset")
1001
+ ]);
1002
+ function isTokenValueBorder(value) {
1003
+ return (0, import_utils2.isObject)(value) && TokenValueColorStruct.is(value.color) && TokenValueStrokeStyleStruct.is(value.style) && TokenValueDimensionStruct.is(value.width);
1004
+ }
1005
+ __name(isTokenValueBorder, "isTokenValueBorder");
1006
+ var TokenValueBorderStruct = s2.define(
1007
+ "Border Value",
1008
+ isTokenValueBorder
1009
+ );
1010
+ var TokenDataBorderNonRefStruct = s2.assign(
1011
+ s2.type({
1012
+ type: s2.literal("border"),
1013
+ value: TokenValueBorderStruct,
1014
+ kind: s2.literal("static"),
1015
+ originalValue: s2.type({
1016
+ color: s2.union([TokenValueColorStruct, TokenReferenceStruct]),
1017
+ style: s2.union([TokenValueStrokeStyleStruct, TokenReferenceStruct]),
1018
+ width: s2.union([TokenValueDimensionStruct, TokenReferenceStruct])
1019
+ })
1020
+ }),
1021
+ TokenDataBaseStruct
1022
+ );
1023
+ var TokenDataBorderRefStruct = s2.assign(
1024
+ s2.type({
1025
+ type: s2.literal("border"),
1026
+ value: TokenValueBorderStruct,
1027
+ kind: s2.literal("ref"),
1028
+ originalValue: TokenReferenceStruct,
1029
+ referencedTokenId: s2.string()
1030
+ }),
1031
+ TokenDataBaseStruct
1032
+ );
1033
+ function isTokenValueTransition(value) {
1034
+ return (0, import_utils2.isObject)(value) && TokenValueCubicBezierStruct.is(value.timingFunction) && TokenValueDurationStruct.is(value.duration) && TokenValueDurationStruct.is(value.delay);
1035
+ }
1036
+ __name(isTokenValueTransition, "isTokenValueTransition");
1037
+ var TokenValueTransitionStruct = s2.define(
1038
+ "Transition Value",
1039
+ isTokenValueTransition
1040
+ );
1041
+ var TokenDataTransitionNonRefStruct = s2.assign(
1042
+ s2.type({
1043
+ type: s2.literal("transition"),
1044
+ value: TokenValueTransitionStruct,
1045
+ kind: s2.literal("static"),
1046
+ originalValue: s2.type({
1047
+ timingFunction: s2.union([
1048
+ TokenValueCubicBezierStruct,
1049
+ TokenReferenceStruct
1050
+ ]),
1051
+ duration: s2.union([TokenValueDurationStruct, TokenReferenceStruct]),
1052
+ delay: s2.union([TokenValueDurationStruct, TokenReferenceStruct])
1053
+ })
1054
+ }),
1055
+ TokenDataBaseStruct
1056
+ );
1057
+ var TokenDataTransitionRefStruct = s2.assign(
1058
+ s2.type({
1059
+ type: s2.literal("transition"),
1060
+ value: TokenValueTransitionStruct,
1061
+ kind: s2.literal("ref"),
1062
+ originalValue: TokenReferenceStruct,
1063
+ referencedTokenId: s2.string()
1064
+ }),
1065
+ TokenDataBaseStruct
1066
+ );
1067
+ var TokenDataStringNonRefStruct = s2.assign(
1068
+ s2.type({
1069
+ type: s2.literal("string"),
1070
+ value: s2.string(),
1071
+ kind: s2.literal("static"),
1072
+ originalValue: s2.string()
1073
+ }),
1074
+ TokenDataBaseStruct
1075
+ );
1076
+ var TokenDataStringRefStruct = s2.assign(
1077
+ s2.type({
1078
+ type: s2.literal("string"),
1079
+ value: s2.string(),
1080
+ kind: s2.literal("ref"),
1081
+ originalValue: TokenReferenceStruct,
1082
+ referencedTokenId: s2.string()
1083
+ }),
1084
+ TokenDataBaseStruct
1085
+ );
1086
+ var TokenDataStrokeStyleNonRefStruct = s2.assign(
1087
+ s2.type({
1088
+ type: s2.literal("strokeStyle"),
1089
+ value: TokenValueStrokeStyleStruct,
1090
+ kind: s2.literal("static"),
1091
+ originalValue: TokenValueStrokeStyleStruct
1092
+ }),
1093
+ TokenDataBaseStruct
1094
+ );
1095
+ var TokenDataStrokeStyleRefStruct = s2.assign(
1096
+ s2.type({
1097
+ type: s2.literal("strokeStyle"),
1098
+ value: TokenValueStrokeStyleStruct,
1099
+ kind: s2.literal("ref"),
1100
+ originalValue: TokenReferenceStruct,
1101
+ referencedTokenId: TokenValueStrokeStyleStruct
1102
+ }),
1103
+ TokenDataBaseStruct
1104
+ );
1105
+ var TokenDataNumberNonRefStruct = s2.assign(
1106
+ s2.type({
1107
+ type: s2.literal("number"),
1108
+ value: s2.number(),
1109
+ kind: s2.literal("static"),
1110
+ originalValue: s2.number()
1111
+ }),
1112
+ TokenDataBaseStruct
1113
+ );
1114
+ var TokenDataNumberRefStruct = s2.assign(
1115
+ s2.type({
1116
+ type: s2.literal("number"),
1117
+ value: s2.number(),
1118
+ kind: s2.literal("ref"),
1119
+ originalValue: TokenReferenceStruct,
1120
+ referencedTokenId: s2.string()
1121
+ }),
1122
+ TokenDataBaseStruct
1123
+ );
1124
+ var TokenDataBooleanNonRefStruct = s2.assign(
1125
+ s2.type({
1126
+ type: s2.literal("boolean"),
1127
+ value: s2.boolean(),
1128
+ kind: s2.literal("static"),
1129
+ originalValue: s2.boolean()
1130
+ }),
1131
+ TokenDataBaseStruct
1132
+ );
1133
+ var TokenDataBooleanRefStruct = s2.assign(
1134
+ s2.type({
1135
+ type: s2.literal("boolean"),
1136
+ value: s2.boolean(),
1137
+ kind: s2.literal("ref"),
1138
+ originalValue: TokenReferenceStruct,
1139
+ referencedTokenId: s2.string()
1140
+ }),
1141
+ TokenDataBaseStruct
1142
+ );
1143
+ var assertTokenData = /* @__PURE__ */ __name((data) => {
1144
+ if (!(0, import_utils2.isObject)(data)) {
1145
+ throw new Error(
1146
+ `Expected token data to be an object, got ${JSON.stringify(data)}`
1147
+ );
1148
+ }
1149
+ if (!(0, import_utils2.isObjKey)("type", data)) {
1150
+ throw new Error(
1151
+ `Expected token data to have a "type" property, got ${JSON.stringify(
1152
+ data
1153
+ )}`
1154
+ );
1155
+ }
1156
+ if (typeof data.type !== "string") {
1157
+ throw new Error(
1158
+ `Expected token data "type" property to be a string, got ${JSON.stringify(
1159
+ data
1160
+ )}`
1161
+ );
1162
+ }
1163
+ const type9 = data.type;
1164
+ const kind = data.kind;
1165
+ try {
1166
+ switch (type9) {
1167
+ case "boolean":
1168
+ if (kind === "ref") {
1169
+ TokenDataBooleanRefStruct.assert(data);
1170
+ } else {
1171
+ TokenDataBooleanNonRefStruct.assert(data);
1172
+ }
1173
+ return;
1174
+ case "border":
1175
+ if (kind === "ref") {
1176
+ TokenDataBorderRefStruct.assert(data);
1177
+ } else {
1178
+ TokenDataBorderNonRefStruct.assert(data);
1179
+ }
1180
+ return;
1181
+ case "color":
1182
+ if (kind === "ref") {
1183
+ TokenDataColorRefStruct.assert(data);
1184
+ } else {
1185
+ TokenDataColorNonRefStruct.assert(data);
1186
+ }
1187
+ return;
1188
+ case "cubicBezier":
1189
+ if (kind === "ref") {
1190
+ TokenDataCubicBezierRefStruct.assert(data);
1191
+ } else {
1192
+ TokenDataCubicBezierNonRefStruct.assert(data);
1193
+ }
1194
+ return;
1195
+ case "dimension":
1196
+ if (kind === "ref") {
1197
+ TokenDataDimensionRefStruct.assert(data);
1198
+ } else {
1199
+ TokenDataDimensionNonRefStruct.assert(data);
1200
+ }
1201
+ return;
1202
+ case "duration":
1203
+ if (kind === "ref") {
1204
+ TokenDataDurationRefStruct.assert(data);
1205
+ } else {
1206
+ TokenDataDurationNonRefStruct.assert(data);
1207
+ }
1208
+ return;
1209
+ case "fontWeight":
1210
+ if (kind === "ref") {
1211
+ TokenDataFontWeightRefStruct.assert(data);
1212
+ } else {
1213
+ TokenDataFontWeightNonRefStruct.assert(data);
1214
+ }
1215
+ return;
1216
+ case "number":
1217
+ if (kind === "ref") {
1218
+ TokenDataNumberRefStruct.assert(data);
1219
+ } else {
1220
+ TokenDataNumberNonRefStruct.assert(data);
1221
+ }
1222
+ return;
1223
+ case "shadow":
1224
+ if (kind === "ref") {
1225
+ TokenDataShadowRefStruct.assert(data);
1226
+ } else {
1227
+ TokenDataShadowNonRefStruct.assert(data);
1228
+ }
1229
+ return;
1230
+ case "string":
1231
+ if (kind === "ref") {
1232
+ TokenDataStringRefStruct.assert(data);
1233
+ } else {
1234
+ TokenDataStringNonRefStruct.assert(data);
1235
+ }
1236
+ return;
1237
+ case "strokeStyle":
1238
+ if (kind === "ref") {
1239
+ TokenDataStrokeStyleRefStruct.assert(data);
1240
+ } else {
1241
+ TokenDataStrokeStyleNonRefStruct.assert(data);
1242
+ }
1243
+ return;
1244
+ case "transition":
1245
+ if (kind === "ref") {
1246
+ TokenDataTransitionRefStruct.assert(data);
1247
+ } else {
1248
+ TokenDataTransitionNonRefStruct.assert(data);
1249
+ }
1250
+ return;
1251
+ default: {
1252
+ const _exhaustiveCheck = type9;
1253
+ throw new Error(`Unknown token data type: ${type9}`);
1254
+ }
1255
+ }
1256
+ } catch (error) {
1257
+ if (!(error instanceof s2.StructError)) throw error;
1258
+ throw new Error(
1259
+ `Invalid token data for type "${type9}": ${error.message}. Received this data: "${JSON.stringify(data)}"`
1260
+ );
1261
+ }
1262
+ }, "assertTokenData");
1263
+
1264
+ // src/app-client-data/design-tokens-types/token-src-value-info.ts
1265
+ var import_utils3 = require("@knapsack/utils");
1266
+ (0, import_utils3.expectType)([
1267
+ {
1268
+ type: "dimension",
1269
+ kind: "static",
1270
+ value: "1px"
1271
+ },
1272
+ {
1273
+ type: "dimension",
1274
+ kind: "ref",
1275
+ referencedTokenId: "a.b"
1276
+ }
1277
+ ]);
1278
+ (0, import_utils3.expectType)([
1279
+ {
1280
+ type: "border",
1281
+ kind: "ref",
1282
+ referencedTokenId: "a.b"
1283
+ },
1284
+ {
1285
+ type: "border",
1286
+ kind: "static",
1287
+ value: {
1288
+ color: {
1289
+ kind: "static",
1290
+ type: "color",
1291
+ value: "red"
1292
+ },
1293
+ style: {
1294
+ kind: "ref",
1295
+ type: "strokeStyle",
1296
+ referencedTokenId: ""
1297
+ // FIX
1298
+ },
1299
+ width: {
1300
+ kind: "static",
1301
+ type: "dimension",
1302
+ value: "2px"
1303
+ }
1304
+ }
1305
+ }
1306
+ ]);
1307
+ (0, import_utils3.expectType)([
1308
+ {
1309
+ type: "transition",
1310
+ kind: "ref",
1311
+ referencedTokenId: "a.b"
1312
+ },
1313
+ {
1314
+ type: "transition",
1315
+ kind: "static",
1316
+ value: {
1317
+ delay: {
1318
+ kind: "static",
1319
+ type: "duration",
1320
+ value: "1ms"
1321
+ },
1322
+ duration: {
1323
+ kind: "ref",
1324
+ type: "duration",
1325
+ referencedTokenId: "animation.slow"
1326
+ },
1327
+ timingFunction: {
1328
+ kind: "static",
1329
+ type: "cubicBezier",
1330
+ value: [0.4, 0, 0.2, 1]
1331
+ }
1332
+ }
1333
+ }
1334
+ ]);
1335
+ function isTokenSrcValueInfoSingular(tokenSrcValueInfo) {
1336
+ return isTokenTypeSingular(tokenSrcValueInfo?.type);
1337
+ }
1338
+ __name(isTokenSrcValueInfoSingular, "isTokenSrcValueInfoSingular");
1339
+ function isTokenSrcValueInfoComposite(tokenSrcValueInfo) {
1340
+ return isTokenTypeComposite(tokenSrcValueInfo?.type);
1341
+ }
1342
+ __name(isTokenSrcValueInfoComposite, "isTokenSrcValueInfoComposite");
1343
+ (0, import_utils3.expectType)([
1344
+ {
1345
+ type: "dimension",
1346
+ kind: "static",
1347
+ value: "1px"
1348
+ },
1349
+ {
1350
+ type: "transition",
1351
+ kind: "ref",
1352
+ referencedTokenId: "a.b"
1353
+ },
1354
+ {
1355
+ type: "transition",
1356
+ kind: "ref",
1357
+ // @ts-expect-error - with `kind: 'ref'`, `value` is not allowed
1358
+ value: "1px"
1359
+ },
1360
+ {
1361
+ kind: "ref",
1362
+ type: "duration",
1363
+ referencedTokenId: "animation.slow"
1364
+ },
1365
+ {
1366
+ kind: "static",
1367
+ type: "cubicBezier",
1368
+ value: [0.4, 0, 0.2, 1]
1369
+ },
1370
+ {
1371
+ type: "transition",
1372
+ kind: "static",
1373
+ value: {
1374
+ delay: {
1375
+ kind: "static",
1376
+ type: "duration",
1377
+ value: "1ms"
1378
+ },
1379
+ duration: {
1380
+ kind: "ref",
1381
+ type: "duration",
1382
+ referencedTokenId: "animation.slow"
1383
+ },
1384
+ timingFunction: {
1385
+ kind: "static",
1386
+ type: "cubicBezier",
1387
+ value: [0.4, 0, 0.2, 1]
1388
+ }
1389
+ }
1390
+ }
1391
+ ]);
1392
+
1393
+ // src/app-client-data/design-tokens-types/token-src.ts
1394
+ var import_utils4 = require("@knapsack/utils");
1395
+ function isTokenSrcExtensions(extensionsObj) {
1396
+ return (0, import_utils4.isObject)(extensionsObj) && (0, import_utils4.isObjKey)("cloud.knapsack", extensionsObj);
1397
+ }
1398
+ __name(isTokenSrcExtensions, "isTokenSrcExtensions");
1399
+ (0, import_utils4.expectType)([
1400
+ "#ddd",
1401
+ true,
1402
+ [83, 1, 1, 1],
1403
+ {
1404
+ color: "#000",
1405
+ style: "solid",
1406
+ width: "1px"
1407
+ },
1408
+ {
1409
+ inset: true,
1410
+ color: "#000",
1411
+ offsetX: "0px",
1412
+ offsetY: "{spacing.medium}",
1413
+ spread: "0px",
1414
+ blur: "0px"
1415
+ },
1416
+ {
1417
+ timingFunction: "{timing.ease}",
1418
+ duration: "{timing.duration.medium}",
1419
+ delay: "7ms",
1420
+ color: "#000"
1421
+ }
1422
+ ]);
1423
+ function isTokenSrc(tokenObject) {
1424
+ if ((0, import_utils4.isObject)(tokenObject) && (0, import_utils4.isObjKey)("$value", tokenObject)) return true;
1425
+ return false;
1426
+ }
1427
+ __name(isTokenSrc, "isTokenSrc");
1428
+ function isTokenGroup(tokenObject) {
1429
+ return (0, import_utils4.isObject)(tokenObject) && !isTokenSrcExtensions(tokenObject) && !(0, import_utils4.isObjKey)("$value", tokenObject) && // ensuring we are not in `$extensions` object
1430
+ !(0, import_utils4.isObjKey)("cloud.knapsack", tokenObject);
1431
+ }
1432
+ __name(isTokenGroup, "isTokenGroup");
1433
+ function isTokenTypeVarRef(tokenObject) {
1434
+ if (isTokenGroup(tokenObject)) {
1435
+ const varRefCollectionInfo = tokenObject.$extensions["cloud.knapsack"].group.collectionInfo;
1436
+ if ((0, import_utils4.isObjKey)("type", varRefCollectionInfo) && (0, import_utils4.isObjKey)("referenceId", varRefCollectionInfo)) {
1437
+ return true;
1438
+ }
1439
+ }
1440
+ return false;
1441
+ }
1442
+ __name(isTokenTypeVarRef, "isTokenTypeVarRef");
1443
+
1444
+ // src/app-client-data/design-tokens-types/token-utils.ts
1445
+ var import_utils5 = require("@knapsack/utils");
1446
+ function getPrimitiveValue(tokenValue) {
1447
+ const type9 = typeof tokenValue;
1448
+ if (type9 === "string" || type9 === "number" || type9 === "boolean") {
1449
+ return type9;
1450
+ }
1451
+ throw new Error(
1452
+ `Invalid token value type: ${JSON.stringify(
1453
+ type9
1454
+ )}. Token value is: ${JSON.stringify(tokenValue)}`
1455
+ );
1456
+ }
1457
+ __name(getPrimitiveValue, "getPrimitiveValue");
1458
+ var isDimensionString = /* @__PURE__ */ __name((value) => value.includes("px") || value.includes("rem") || value.includes("em") || value.includes("%"), "isDimensionString");
1459
+ function parseTokenDimensionValue(valueToParse) {
1460
+ const { value, unit } = (0, import_utils5.parseNumberWithUnit)(valueToParse);
1461
+ if (!unit) {
1462
+ return { value };
1463
+ }
1464
+ if (unit !== "px" && unit !== "rem" && unit !== "em" && unit !== "%") {
1465
+ throw new Error(`Invalid unit "${unit}" for value: ${value}`);
1466
+ }
1467
+ return { value, unit };
1468
+ }
1469
+ __name(parseTokenDimensionValue, "parseTokenDimensionValue");
1470
+
1471
+ // src/app-client-data/patterns.ts
1472
+ var isSlottedText = /* @__PURE__ */ __name((slottedData) => (0, import_utils.isObject)(slottedData) && slottedData.type === "text", "isSlottedText");
1473
+ function isSlottedTemplateDemo(slottedData) {
1474
+ return (0, import_utils.isObject)(slottedData) && slottedData.type === "template-demo";
1475
+ }
1476
+ __name(isSlottedTemplateDemo, "isSlottedTemplateDemo");
1477
+ function isSlottedTemplateReference(slottedData) {
1478
+ return (0, import_utils.isObject)(slottedData) && slottedData.type === "template-reference";
1479
+ }
1480
+ __name(isSlottedTemplateReference, "isSlottedTemplateReference");
1481
+ var StageLayouts = /* @__PURE__ */ ((StageLayouts2) => {
1482
+ StageLayouts2["portrait"] = "portrait";
1483
+ StageLayouts2["landscape"] = "landscape";
1484
+ return StageLayouts2;
1485
+ })(StageLayouts || {});
1486
+ function isDataDemo(demo) {
1487
+ return demo?.type === "data";
1488
+ }
1489
+ __name(isDataDemo, "isDataDemo");
1490
+ function isTemplateDemo(demo) {
1491
+ return demo?.type === "template";
1492
+ }
1493
+ __name(isTemplateDemo, "isTemplateDemo");
1494
+
1495
+ // src/app-client-data/page.header.ts
1496
+ var PageHeaderSizes = /* @__PURE__ */ ((PageHeaderSizes2) => {
1497
+ PageHeaderSizes2["auto"] = "auto";
1498
+ PageHeaderSizes2["small"] = "small";
1499
+ PageHeaderSizes2["medium"] = "medium";
1500
+ PageHeaderSizes2["large"] = "large";
1501
+ PageHeaderSizes2["full"] = "full";
1502
+ return PageHeaderSizes2;
1503
+ })(PageHeaderSizes || {});
1504
+
1505
+ // src/app-client-data/index.ts
1506
+ function isKsAppClientDataNoMeta(data) {
1507
+ if (!(0, import_utils.isObject)(data)) return false;
1508
+ const requiredKeys = [
1509
+ "assetSetsState",
1510
+ "customPagesState",
1511
+ "navsState",
1512
+ "patternsState",
1513
+ "tokensSrc",
1514
+ "db"
1515
+ ];
1516
+ if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data))) return false;
1517
+ if (!(0, import_utils.isObjKey)("metaState", data)) return true;
1518
+ return false;
1519
+ }
1520
+ __name(isKsAppClientDataNoMeta, "isKsAppClientDataNoMeta");
1521
+ var KsAppClientDataNoMetaStruct = (0, import_superstruct5.define)(
1522
+ "KsAppClientDataNoMeta",
1523
+ isKsAppClientDataNoMeta
1524
+ );
1525
+ function isKsAppClientDataAndMeta(data) {
1526
+ if (!(0, import_utils.isObject)(data)) return false;
1527
+ const requiredKeys = [
1528
+ "assetSetsState",
1529
+ "customPagesState",
1530
+ "navsState",
1531
+ "patternsState",
1532
+ "tokensSrc",
1533
+ "metaState",
1534
+ "db"
1535
+ ];
1536
+ return requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data));
1537
+ }
1538
+ __name(isKsAppClientDataAndMeta, "isKsAppClientDataAndMeta");
1539
+ var KsAppClientDataAndMetaStruct = (0, import_superstruct5.define)(
1540
+ "KsAppClientDataAndMeta",
1541
+ isKsAppClientDataAndMeta
1542
+ );
1543
+ var KsMetaStateStruct = (0, import_superstruct5.type)({
1544
+ isLocalDev: (0, import_superstruct5.boolean)(),
1545
+ plugins: (0, import_superstruct5.array)(
1546
+ (0, import_superstruct5.type)({
1547
+ id: (0, import_superstruct5.string)(),
1548
+ hasContent: (0, import_superstruct5.boolean)(),
1549
+ clientPluginPath: (0, import_superstruct5.optional)((0, import_superstruct5.string)()),
1550
+ cssPath: (0, import_superstruct5.optional)((0, import_superstruct5.string)())
1551
+ })
1552
+ ),
1553
+ meta: (0, import_superstruct5.optional)(
1554
+ (0, import_superstruct5.type)({
1555
+ version: (0, import_superstruct5.optional)((0, import_superstruct5.string)()),
1556
+ hasKnapsackCloud: (0, import_superstruct5.boolean)(),
1557
+ knapsackCloudSiteId: (0, import_superstruct5.optional)((0, import_superstruct5.string)()),
1558
+ serverPort: (0, import_superstruct5.optional)((0, import_superstruct5.number)()),
1559
+ websocketsPort: (0, import_superstruct5.optional)((0, import_superstruct5.number)()),
1560
+ https: (0, import_superstruct5.optional)((0, import_superstruct5.boolean)()),
1561
+ cacheDir: (0, import_superstruct5.optional)((0, import_superstruct5.string)()),
1562
+ ksVersions: (0, import_superstruct5.type)({
1563
+ app: (0, import_superstruct5.string)()
1564
+ })
1565
+ })
1566
+ )
1567
+ });
1568
+ var isKsMetaState = KsMetaStateStruct.is;
1569
+
1570
+ // src/app-client-data-v3/index.ts
1571
+ var import_superstruct6 = require("superstruct");
1572
+ function isKsAppClientDataNoMetaV3(data) {
1573
+ if (!(0, import_utils.isObject)(data)) return false;
1574
+ const requiredKeys = [
1575
+ "assetSetsState",
1576
+ "customPagesState",
1577
+ "navsState",
1578
+ "patternsState",
1579
+ "settingsState",
1580
+ "tokensState"
1581
+ ];
1582
+ if (!requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data))) return false;
1583
+ if (!(0, import_utils.isObjKey)("metaState", data)) return true;
1584
+ return false;
1585
+ }
1586
+ __name(isKsAppClientDataNoMetaV3, "isKsAppClientDataNoMetaV3");
1587
+ var KsAppClientDataNoMetaStructV3 = (0, import_superstruct6.define)(
1588
+ "KsAppClientDataNoMeta",
1589
+ isKsAppClientDataNoMetaV3
1590
+ );
1591
+ function isKsAppClientDataAndMetaV3(data) {
1592
+ if (!(0, import_utils.isObject)(data)) return false;
1593
+ const requiredKeys = [
1594
+ "assetSetsState",
1595
+ "customPagesState",
1596
+ "navsState",
1597
+ "patternsState",
1598
+ "settingsState",
1599
+ "tokensState",
1600
+ "metaState"
1601
+ ];
1602
+ return requiredKeys.every((key) => (0, import_utils.isObjKey)(key, data));
1603
+ }
1604
+ __name(isKsAppClientDataAndMetaV3, "isKsAppClientDataAndMetaV3");
1605
+ var KsAppClientDataAndMetaStructV3 = (0, import_superstruct6.define)(
1606
+ "KsAppClientDataAndMeta",
1607
+ isKsAppClientDataAndMetaV3
1608
+ );
1609
+ var KsMetaStateStructV3 = (0, import_superstruct6.type)({
1610
+ isLocalDev: (0, import_superstruct6.boolean)(),
1611
+ plugins: (0, import_superstruct6.array)(
1612
+ (0, import_superstruct6.type)({
1613
+ id: (0, import_superstruct6.string)(),
1614
+ hasContent: (0, import_superstruct6.boolean)(),
1615
+ clientPluginPath: (0, import_superstruct6.optional)((0, import_superstruct6.string)()),
1616
+ cssPath: (0, import_superstruct6.optional)((0, import_superstruct6.string)())
1617
+ })
1618
+ ),
1619
+ meta: (0, import_superstruct6.optional)(
1620
+ (0, import_superstruct6.type)({
1621
+ version: (0, import_superstruct6.optional)((0, import_superstruct6.string)()),
1622
+ hasKnapsackCloud: (0, import_superstruct6.boolean)(),
1623
+ knapsackCloudSiteId: (0, import_superstruct6.optional)((0, import_superstruct6.string)()),
1624
+ serverPort: (0, import_superstruct6.optional)((0, import_superstruct6.number)()),
1625
+ websocketsPort: (0, import_superstruct6.optional)((0, import_superstruct6.number)()),
1626
+ https: (0, import_superstruct6.optional)((0, import_superstruct6.boolean)()),
1627
+ cacheDir: (0, import_superstruct6.optional)((0, import_superstruct6.string)()),
1628
+ ksVersions: (0, import_superstruct6.type)({
1629
+ app: (0, import_superstruct6.string)()
1630
+ })
1631
+ })
1632
+ )
1633
+ });
1634
+ var isKsMetaStateV3 = KsMetaStateStructV3.is;
1635
+
1636
+ // src/app-client-data-migrations/4.1.7-demos.ts
1637
+ var import_immer = require("immer");
1638
+ var migration417Demos = {
1639
+ version: "4.1.7",
1640
+ checkIfNeeded: /* @__PURE__ */ __name((appClientData) => {
1641
+ return true;
1642
+ }, "checkIfNeeded"),
1643
+ // note that `appClientData` is mutable since we're already in Immer
1644
+ migrate: /* @__PURE__ */ __name((appClientData) => {
1645
+ if (!(0, import_immer.isDraft)(appClientData)) {
1646
+ throw new Error(
1647
+ `Tried to run migrations on appClientData but it is not an Immer Draft`
1648
+ );
1649
+ }
1650
+ Object.values(appClientData.patternsState.patterns).forEach(
1651
+ (pattern) => {
1652
+ delete pattern.demoSize;
1653
+ }
1654
+ );
1655
+ Object.values(appClientData.db.demos.byId).forEach((demo) => {
1656
+ if (demo.type !== "data") return;
1657
+ Object.entries(demo.data.slots ?? {}).forEach(([slotName, slotData]) => {
1658
+ demo.data.slots[slotName] = slotData.map(
1659
+ (slottedData) => {
1660
+ if (typeof slottedData === "string") {
1661
+ return {
1662
+ type: "text",
1663
+ text: slottedData
1664
+ };
1665
+ }
1666
+ if (
1667
+ // not doing anything with these
1668
+ slottedData.type === "template-reference" || // these already were migrated or made by the new editor
1669
+ slottedData.type === "text"
1670
+ ) {
1671
+ return slottedData;
1672
+ }
1673
+ slottedData.type = "template-demo";
1674
+ return slottedData;
1675
+ }
1676
+ );
1677
+ });
1678
+ if (demo.patternId && demo.templateId) return;
1679
+ (() => {
1680
+ for (const { id: pId, templates = [] } of Object.values(
1681
+ appClientData.patternsState.patterns
1682
+ )) {
1683
+ for (const { id: tId, demoIds = [] } of templates) {
1684
+ if (demoIds.includes(demo.id)) {
1685
+ demo.patternId = pId;
1686
+ demo.templateId = tId;
1687
+ return;
1688
+ }
1689
+ }
1690
+ }
1691
+ })();
1692
+ });
1693
+ }, "migrate")
1694
+ };
1695
+
1696
+ // src/app-client-data-migrations/index.ts
1697
+ var migrations = [migration417Demos];
1698
+
1699
+ // src/json-schema.ts
1700
+ var PropTypeNames = /* @__PURE__ */ ((PropTypeNames2) => {
1701
+ PropTypeNames2["string"] = "string";
1702
+ PropTypeNames2["boolean"] = "boolean";
1703
+ PropTypeNames2["number"] = "number";
1704
+ PropTypeNames2["object"] = "object";
1705
+ PropTypeNames2["options"] = "options";
1706
+ PropTypeNames2["function"] = "function";
1707
+ PropTypeNames2["customTypeScript"] = "customTypeScript";
1708
+ PropTypeNames2["array"] = "array";
1709
+ PropTypeNames2["arrayOfObjects"] = "arrayOfObjects";
1710
+ PropTypeNames2["arrayOfStrings"] = "arrayOfStrings";
1711
+ PropTypeNames2["unknown"] = "unknown";
1712
+ return PropTypeNames2;
1713
+ })(PropTypeNames || {});
1714
+ var isStringProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "string" && !("enum" in prop), "isStringProp");
1715
+ var isNumberProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "number", "isNumberProp");
1716
+ var isBooleanProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "boolean", "isBooleanProp");
1717
+ var isOptionsProp = /* @__PURE__ */ __name((prop) => "enum" in prop, "isOptionsProp");
1718
+ var isFunctionProp = /* @__PURE__ */ __name((prop) => "typeof" in prop && prop?.typeof === "function", "isFunctionProp");
1719
+ var isCustomTypeScriptProp = /* @__PURE__ */ __name((prop) => !("typeof" in prop) && "tsType" in prop, "isCustomTypeScriptProp");
1720
+ var isArrayOfObjectsProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "array" && "items" in prop && prop.items.type === "object", "isArrayOfObjectsProp");
1721
+ var isObjectProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "object" && "properties" in prop && Object.keys(prop.properties).length > 0, "isObjectProp");
1722
+ var isArrayOfStringsProp = /* @__PURE__ */ __name((prop) => "type" in prop && prop.type === "array" && "items" in prop && prop.items.type === "string", "isArrayOfStringsProp");
1723
+
1724
+ // src/changes.ts
1725
+ var s3 = __toESM(require("superstruct"));
1726
+ var PatchStructRuntime = s3.object({
1727
+ op: s3.union([s3.literal("replace"), s3.literal("remove"), s3.literal("add")]),
1728
+ path: s3.array(s3.union([s3.string(), s3.number()])),
1729
+ value: s3.optional(s3.any())
1730
+ });
1731
+ var PatchStruct = PatchStructRuntime;
1732
+ var isPatch = /* @__PURE__ */ __name((patch) => PatchStruct.is(patch), "isPatch");
1733
+ var PatchesStructRuntime = s3.array(PatchStructRuntime);
1734
+ var PatchesStruct = PatchesStructRuntime;
1735
+ var isPatches = /* @__PURE__ */ __name((patches) => PatchesStruct.is(patches), "isPatches");
1736
+ var KsRemoteChangeRuntime = s3.type({
1737
+ patches: PatchesStructRuntime,
1738
+ inversePatches: s3.optional(PatchesStructRuntime),
1739
+ event: s3.optional(s3.object({ type: s3.string() })),
1740
+ id: s3.string(),
1741
+ date: s3.string(),
1742
+ userId: s3.optional(s3.string())
1743
+ });
1744
+ var KsRemoteChangeStruct = KsRemoteChangeRuntime;
1745
+ var isKsRemoteChange = /* @__PURE__ */ __name((change) => KsRemoteChangeStruct.is(change), "isKsRemoteChange");
1746
+ var KsRemoteChangesStructRuntime = s3.array(KsRemoteChangeRuntime);
1747
+ var KsRemoteChangesStruct = KsRemoteChangesStructRuntime;
1748
+ var isKsRemoteChanges = /* @__PURE__ */ __name((changes) => KsRemoteChangesStruct.is(changes), "isKsRemoteChanges");
1749
+
1750
+ // src/renderers.ts
1751
+ var rendererIds = {
1752
+ react: "react",
1753
+ vue: "vue",
1754
+ "web-components": "web-components",
1755
+ twig: "twig",
1756
+ hbs: "hbs",
1757
+ angular: "angular",
1758
+ html: "html"
1759
+ };
1760
+
1761
+ // src/renderer-client-types.ts
1762
+ var KsRendererClientEvents = /* @__PURE__ */ ((KsRendererClientEvents2) => {
1763
+ KsRendererClientEvents2["ready"] = "ready";
1764
+ return KsRendererClientEvents2;
1765
+ })(KsRendererClientEvents || {});
1766
+ var ksRendererClientMetaId = "ks-meta";
1767
+
1768
+ // src/web-sockets.ts
1769
+ var WS_EVENTS = {
1770
+ PATTERN_TEMPLATE_CHANGED: "PATTERN_TEMPLATE_CHANGED",
1771
+ PATTERN_ASSET_CHANGED: "PATTERN_ASSET_CHANGED",
1772
+ DESIGN_TOKENS_CHANGED: "DESIGN_TOKENS_CHANGED",
1773
+ RENDERER_CLIENT_RELOAD: "RENDERER_CLIENT_RELOAD",
1774
+ APP_CLIENT_DATA_CHANGED: "APP_CLIENT_DATA_CHANGED"
1775
+ };
1776
+
1777
+ // src/git-providers.ts
1778
+ var GitProviderType = /* @__PURE__ */ ((GitProviderType2) => {
1779
+ GitProviderType2["GitHub"] = "GitHub";
1780
+ GitProviderType2["GitLab"] = "GitLab";
1781
+ GitProviderType2["GitLabRest"] = "GitLabRest";
1782
+ GitProviderType2["Bitbucket"] = "Bitbucket";
1783
+ GitProviderType2["Azure"] = "Azure";
1784
+ return GitProviderType2;
1785
+ })(GitProviderType || {});
1786
+ var MergeableState = /* @__PURE__ */ ((MergeableState2) => {
1787
+ MergeableState2["Conflicting"] = "CONFLICTING";
1788
+ MergeableState2["Mergeable"] = "MERGEABLE";
1789
+ MergeableState2["Unknown"] = "UNKNOWN";
1790
+ return MergeableState2;
1791
+ })(MergeableState || {});
1792
+ var RestActions = /* @__PURE__ */ ((RestActions2) => {
1793
+ RestActions2["Create"] = "CREATE";
1794
+ RestActions2["Move"] = "MOVE";
1795
+ RestActions2["Update"] = "UPDATE";
1796
+ RestActions2["Chmod"] = "CHMOD";
1797
+ return RestActions2;
1798
+ })(RestActions || {});
1799
+ var TextEncoding = /* @__PURE__ */ ((TextEncoding2) => {
1800
+ TextEncoding2["Base64"] = "BASE64";
1801
+ TextEncoding2["Text"] = "TEXT";
1802
+ return TextEncoding2;
1803
+ })(TextEncoding || {});
1804
+
1805
+ // src/api/plugins.ts
1806
+ var plugins_exports = {};
1807
+ __export(plugins_exports, {
1808
+ ACTIONS: () => ACTIONS,
1809
+ endpoint: () => endpoint
1810
+ });
1811
+ var endpoint = `/plugins`;
1812
+ var ACTIONS = /* @__PURE__ */ ((ACTIONS3) => {
1813
+ ACTIONS3["getContent"] = "getContent";
1814
+ return ACTIONS3;
1815
+ })(ACTIONS || {});
1816
+
1817
+ // src/api/files.ts
1818
+ var files_exports = {};
1819
+ __export(files_exports, {
1820
+ ACTIONS: () => ACTIONS2,
1821
+ endpoint: () => endpoint2
1822
+ });
1823
+ var endpoint2 = `/files`;
1824
+ var ACTIONS2 = /* @__PURE__ */ ((ACTIONS3) => {
1825
+ ACTIONS3["verify"] = "verify";
1826
+ return ACTIONS3;
1827
+ })(ACTIONS2 || {});
1828
+
1829
+ // src/user-roles.ts
1830
+ var rolesById = {
1831
+ ADMIN: "ADMIN",
1832
+ ANONYMOUS: "ANONYMOUS",
1833
+ CONTRIBUTOR: "CONTRIBUTOR",
1834
+ EDITOR: "EDITOR",
1835
+ MANAGER: "MANAGER",
1836
+ VIEWER: "VIEWER"
1837
+ };
1838
+ var roles = Object.values(rolesById);
1839
+ // Annotate the CommonJS export names for ESM import in node:
1840
+ 0 && (module.exports = {
1841
+ BlockSizes,
1842
+ BlockSpacings,
1843
+ ColorConfigStruct,
1844
+ ColorStringStruct,
1845
+ ColorTokenConfigStruct,
1846
+ FilesApi,
1847
+ FontFaceConfigStruct,
1848
+ FontFaceFormatsEnumStruct,
1849
+ FontFaceSourceFormats,
1850
+ FontFaceSourceStruct,
1851
+ FontFaceWeightStruct,
1852
+ FontSizeConfigStruct,
1853
+ FontSizeConfigValStruct,
1854
+ FontStretches,
1855
+ GitProviderType,
1856
+ HeadingLevels,
1857
+ KsAppClientDataAndMetaStruct,
1858
+ KsAppClientDataAndMetaStructV3,
1859
+ KsAppClientDataNoMetaStruct,
1860
+ KsAppClientDataNoMetaStructV3,
1861
+ KsMetaStateStruct,
1862
+ KsMetaStateStructV3,
1863
+ KsRemoteChangesStruct,
1864
+ KsRendererClientEvents,
1865
+ MergeableState,
1866
+ NavCustomizationConfigStruct,
1867
+ PageHeaderSizes,
1868
+ PluginsApi,
1869
+ PrimaryNavCustomizationConfigStruct,
1870
+ PropTypeNames,
1871
+ RestActions,
1872
+ SecondaryNavCustomizationConfigStruct,
1873
+ StageLayouts,
1874
+ TextEncoding,
1875
+ TextTransforms,
1876
+ TokenReferenceStruct,
1877
+ TokenValueColorStruct,
1878
+ TokenValueCubicBezierStruct,
1879
+ TokenValueDimensionStruct,
1880
+ TokenValueDurationStruct,
1881
+ TokenValueFontWeightStruct,
1882
+ TokenValueStrokeStyleStruct,
1883
+ TypographyConfigStruct,
1884
+ TypographyLinkConfigStruct,
1885
+ UiConfigStruct,
1886
+ UiConfigV10Struct,
1887
+ UiConfigV1Struct,
1888
+ UiConfigV2Struct,
1889
+ UiConfigV3Struct,
1890
+ UiConfigV4Struct,
1891
+ UiConfigV5Struct,
1892
+ UiConfigV6Struct,
1893
+ UiConfigV7Struct,
1894
+ UiConfigV8Struct,
1895
+ UiConfigV9Struct,
1896
+ WS_EVENTS,
1897
+ assertTokenData,
1898
+ customizableNavElements,
1899
+ getPrimitiveValue,
1900
+ hasTokenReferences,
1901
+ isArrayOfObjectsProp,
1902
+ isArrayOfStringsProp,
1903
+ isBooleanProp,
1904
+ isCustomTypeScriptProp,
1905
+ isDataDemo,
1906
+ isDimensionString,
1907
+ isFunctionProp,
1908
+ isKsAppClientDataAndMeta,
1909
+ isKsAppClientDataAndMetaV3,
1910
+ isKsAppClientDataNoMeta,
1911
+ isKsAppClientDataNoMetaV3,
1912
+ isKsMetaState,
1913
+ isKsMetaStateV3,
1914
+ isKsRemoteChange,
1915
+ isKsRemoteChanges,
1916
+ isNotTokenReference,
1917
+ isNumberProp,
1918
+ isObjKey,
1919
+ isObject,
1920
+ isObjectProp,
1921
+ isOptionsProp,
1922
+ isPatch,
1923
+ isPatches,
1924
+ isSlottedTemplateDemo,
1925
+ isSlottedTemplateReference,
1926
+ isSlottedText,
1927
+ isStringProp,
1928
+ isTemplateDemo,
1929
+ isTokenDataComposite,
1930
+ isTokenGroup,
1931
+ isTokenReference,
1932
+ isTokenSrc,
1933
+ isTokenSrcExtensions,
1934
+ isTokenSrcValueInfoComposite,
1935
+ isTokenSrcValueInfoSingular,
1936
+ isTokenTypeComposite,
1937
+ isTokenTypeSingular,
1938
+ isTokenTypeVarRef,
1939
+ isTokenValueBorder,
1940
+ isTokenValueColor,
1941
+ isTokenValueDimension,
1942
+ isTokenValueDuration,
1943
+ isTokenValueFontWeight,
1944
+ isTokenValueShadow,
1945
+ isTokenValueTransition,
1946
+ ksRendererClientMetaId,
1947
+ migrations,
1948
+ pageElements,
1949
+ pageElementsV2,
1950
+ parseTokenDimensionValue,
1951
+ rendererIds,
1952
+ roles,
1953
+ rolesById,
1954
+ strokeStyleValues,
1955
+ tokenNameDisplayFormats,
1956
+ tokenTypeComposites,
1957
+ tokenTypeSingulars
1958
+ });
157
1959
  //# sourceMappingURL=index.js.map