@knapsack/types 4.70.6--canary.4981.331610e.0 → 4.70.6--canary.4969.2a7ea48.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ui-config.ts","../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts","../src/app-client-data/blocks.ts","../src/app-client-data/design-tokens.ts","../src/app-client-data/design-tokens-types/token-definitions.ts","../src/app-client-data/design-tokens-types/token-data.ts","../src/app-client-data/design-tokens-types/token-src-value-info.ts","../src/app-client-data/design-tokens-types/token-src.ts","../src/app-client-data/design-tokens-types/token-utils.ts","../src/app-client-data/patterns.ts","../src/app-client-data/page.header.ts","../src/app-client-data/index.ts","../src/app-client-data-v3/index.ts","../src/app-client-data-migrations/4.1.7-demos.ts","../src/app-client-data-migrations/index.ts","../src/json-schema.ts","../src/changes.ts","../src/renderers.ts","../src/renderer-client-types.ts","../src/web-sockets.ts","../src/git-providers.ts","../src/user-roles.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct","HeadingLevels","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceSourceFormats","FontFaceFormatsEnumStruct","FontFaceSourceStruct","FontFaceConfigStruct","optional","size","array","TextTransforms","FontStretches","TypographyLinkConfigStruct","boolean","FontSizeConfigStruct","TypographyConfigStruct","pageElementConfig","pageLinkElementConfig","pageElements","pageElementsV2","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements","UiConfigV1Struct","UiConfigV2Struct","UiConfigV3Struct","UiConfigV4Struct","defaulted","UiConfigV5Struct","UiConfigV6Struct","UiConfigV7Struct","UiConfigV8Struct","UiConfigV9Struct","UiConfigV10Struct","UiConfigStruct","BlockSizes","BlockSpacings","tokenNameDisplayFormats","strokeStyleValues","isTokenReference","val","hasTokenReferences","isNotTokenReference","TokenReferenceStruct","ye","compositeTypesRecord","tokenTypeComposites","singularTypesRecord","tokenTypeSingulars","isTokenTypeComposite","isTokenTypeSingular","expectType","TokenDataBaseStruct","t","isTokenDataComposite","tokenData","isTokenValueColor","TokenValueColorStruct","TokenDataColorNonRefStruct","TokenDataColorRefStruct","isTokenValueDimension","TokenValueDimensionStruct","TokenDataDimensionNonRefStruct","TokenDataDimensionRefStruct","isTokenValueDuration","TokenValueDurationStruct","TokenDataDurationNonRefStruct","TokenDataDurationRefStruct","isTokenValueFontWeight","TokenValueFontWeightStruct","TokenDataFontWeightNonRefStruct","TokenDataFontWeightRefStruct","TokenValueCubicBezierStruct","v","TokenDataCubicBezierNonRefStruct","TokenDataCubicBezierRefStruct","isTokenValueShadow","isObject","TokenValueShadowStruct","TokenDataShadowNonRefStruct","TokenDataShadowRefStruct","TokenValueStrokeStyleStruct","isTokenValueBorder","TokenValueBorderStruct","TokenDataBorderNonRefStruct","TokenDataBorderRefStruct","isTokenValueTransition","TokenValueTransitionStruct","TokenDataTransitionNonRefStruct","TokenDataTransitionRefStruct","TokenDataStringNonRefStruct","TokenDataStringRefStruct","TokenDataStrokeStyleNonRefStruct","TokenDataStrokeStyleRefStruct","TokenDataNumberNonRefStruct","TokenDataNumberRefStruct","TokenDataBooleanNonRefStruct","TokenDataBooleanRefStruct","assertTokenData","data","isObjKey","kind","error","isTokenSrcValueInfoSingular","tokenSrcValueInfo","isTokenSrcValueInfoComposite","isTokenSrcExtensions","extensionsObj","isTokenSrc","tokenObject","isTokenGroup","isTokenTypeVarRef","varRefCollectionInfo","getPrimitiveValue","tokenValue","isDimensionString","parseTokenDimensionValue","valueToParse","unit","parseNumberWithUnit","isSlottedText","slottedData","isSlottedTemplateDemo","isSlottedTemplateReference","StageLayouts","isDataDemo","demo","isTemplateDemo","PageHeaderSizes","isKsAppClientDataNoMeta","key","KsAppClientDataNoMetaStruct","isKsAppClientDataAndMeta","KsAppClientDataAndMetaStruct","KsMetaStateStruct","isKsMetaState","isKsAppClientDataNoMetaV3","KsAppClientDataNoMetaStructV3","isKsAppClientDataAndMetaV3","KsAppClientDataAndMetaStructV3","KsMetaStateStructV3","isKsMetaStateV3","migration417Demos","appClientData","isDraft","pattern","slotName","slotData","pId","templates","tId","demoIds","migrations","PropTypeNames","isStringProp","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp","PatchStructRuntime","s","PatchStruct","isPatch","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","rendererIds","KsRendererClientEvents","ksRendererClientMetaId","WS_EVENTS","GitProviderType","MergeableState","RestActions","TextEncoding","rolesById","roles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CCIA,SAASA,EAAQC,CAAAA,CAAAA,CAAiC,CAChD,GAAI,OAAOA,CAAAA,EAAU,QAAU,CAAA,OAAO,CACtC,CAAA,CAAA,GAAI,CACF,OAAO,CAAC,CAACC,oBAAY,GAAID,CAAAA,CAAK,CAChC,CAAA,KAAY,CACV,OAAO,CACT,CAAA,CACF,CAPSE,CAAAA,CAAAH,EAAA,CAAA,SAAA,CAAA,CAkBII,IAAAA,CAAAA,CAAoBC,QAC/B,CAAA,mBAAA,CACCC,GAAU,OAAOA,CAAAA,EAAU,QAAYN,EAAAA,EAAAA,CAAQM,CAAK,CACvD,CAEaC,CAAAA,CAAAA,CAA2CC,OAAM,CAAA,CAC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AAA,SAAA,CAHAA,CAAA,CAAA,EAAA,EAAA,EAAA,EAAA,CAAA,CAMAC,EACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,OAAS,QACTA,CAAAA,CAAAA,CAAA,KAAQ,CAAA,OAAA,CAJEA,CAAA,CAAA,EAAA,EAAA,EAAA,EAAA,CAAA,CAOAC,EACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,CAAA,CAAA,IAAA,CAAO,MAFGA,CAAAA,CAAAA,CAAAA,EAAAA,EAAAA,EAAA,ECrCL,EAAA,IAAMC,GAAY,CACvB,KAAA,CAAO,OACP,CAAA,SAAA,CAAW,WACX,CAAA,WAAA,CAAa,aACb,CAAA,MAAA,CAAQ,QACR,CAAA,OAAA,CAAS,SACT,CAAA,MAAA,CAAQ,QACV,CAAA,CACaC,EAAQ,CAAA,MAAA,CAAO,OAAOD,EAAS","file":"index.js","sourcesContent":["import {\n type,\n Describe,\n literal,\n optional,\n defaulted,\n boolean,\n array,\n object,\n} from 'superstruct';\n\nimport { ExpandRecursively } from '@knapsack/utils';\n\nimport {\n ColorConfig,\n ColorConfigStruct,\n ColorStringStruct,\n} from './color-config';\n\nimport {\n FontFaceConfigStruct,\n FontFaceConfig,\n TypographyConfigStruct,\n TypographyLinkConfigStruct,\n pageElements,\n pageElementsV2,\n} from './typography-config';\n\nimport {\n customizableNavElements,\n NavCustomizationConfigStruct,\n PrimaryNavCustomizationConfigStruct,\n SecondaryNavCustomizationConfigStruct,\n} from './nav-customization-config';\n\nexport type UiConfigV1 = {\n version: 1;\n oldSillySidebarBgColor: string;\n};\n\nexport const UiConfigV1Struct: Describe<UiConfigV1> = object({\n version: literal(1),\n oldSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV2 = {\n version: 2;\n anotherSillySidebarBgColor: string;\n};\n\nexport const UiConfigV2Struct: Describe<UiConfigV2> = object({\n version: literal(2),\n anotherSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV3 = {\n version: 3;\n sidebarBgColor: string;\n};\n\nexport const UiConfigV3Struct: Describe<UiConfigV3> = object({\n version: literal(3),\n sidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV4 = {\n version: 4;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n enableSidebarIcons?: boolean;\n};\nexport const UiConfigV4Struct: Describe<UiConfigV4> = object({\n version: literal(4),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport type UiConfigV5 = {\n version: 5;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n linkColor: ColorConfig;\n enableSidebarIcons: boolean;\n};\nexport const UiConfigV5Struct: Describe<UiConfigV5> = object({\n version: literal(5),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport interface _UiConfigV6 extends Omit<UiConfigV5, 'version'> {\n version: 6;\n appearance: {\n customFonts?: FontFaceConfig[];\n pageElements: typeof pageElements;\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfigV6' is not assignable to type 'Record<string, unknown>'.\" error\nexport type UiConfigV6 = ExpandRecursively<_UiConfigV6>;\n\nexport const UiConfigV6Struct: Describe<UiConfigV6> = object({\n version: literal(6),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV7 extends Omit<UiConfigV6, 'version'> {\n version: 7;\n appearance: {\n navigation?: typeof customizableNavElements;\n customFonts?: UiConfigV6['appearance']['customFonts'];\n pageElements: UiConfigV6['appearance']['pageElements'];\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig7' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\nexport type UiConfigV7 = ExpandRecursively<_UiConfigV7>;\n\nexport const UiConfigV7Struct: Describe<UiConfigV7> = object({\n version: literal(7),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV8\n extends Omit<UiConfigV7, 'version' | 'enableSidebarIcons'> {\n version: 8;\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig8' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\n// TODO: move this to @knapsack/types\nexport type UiConfigV8 = ExpandRecursively<_UiConfigV8>;\n\nexport const UiConfigV8Struct: Describe<UiConfigV8> = object({\n version: literal(8),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV9\n extends Omit<\n UiConfigV8,\n 'version' | 'primaryColor' | 'darkColor' | 'lightColor' | 'linkColor'\n > {\n version: 9;\n}\nexport type UiConfigV9 = ExpandRecursively<_UiConfigV9>;\n\nexport const UiConfigV9Struct: Describe<UiConfigV9> = object({\n version: literal(9),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV10 extends Omit<UiConfigV9, 'version'> {\n version: 10;\n appearance: {\n navigation?: UiConfigV9['appearance']['navigation'];\n customFonts?: UiConfigV9['appearance']['customFonts'];\n pageElements: typeof pageElementsV2;\n };\n}\nexport type UiConfigV10 = ExpandRecursively<_UiConfigV10>;\n\nexport const UiConfigV10Struct: Describe<UiConfigV10> = object({\n version: literal(10),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingXLarge: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n headingXSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport type UiConfigVersions =\n | typeof UiConfigV1Struct.TYPE\n | typeof UiConfigV2Struct.TYPE\n | typeof UiConfigV3Struct.TYPE\n | typeof UiConfigV4Struct.TYPE\n | typeof UiConfigV5Struct.TYPE\n | typeof UiConfigV6Struct.TYPE\n | typeof UiConfigV7Struct.TYPE\n | typeof UiConfigV8Struct.TYPE\n | typeof UiConfigV9Struct.TYPE\n | typeof UiConfigV10Struct.TYPE;\n\n// ALIASES FOR LATEST VERSIONS\nexport type UiConfig = UiConfigV10;\nexport const UiConfigStruct: typeof UiConfigV10Struct = UiConfigV10Struct;\n\nexport type NavElementNames = keyof UiConfig['appearance']['navigation'];\n","import colorString from 'color-string';\nimport { define, Describe, literal, string, type, union } from 'superstruct'; // https://docs.superstructjs.org\n\n/** Use `import { isColor } from '@knapsack/color-utils'` if you can, need to duplicate this logic due to dep cycle */\nfunction isColor(color: unknown): color is string {\n if (typeof color !== 'string') return false;\n try {\n return !!colorString.get(color);\n } catch (e) {\n return false;\n }\n}\n\nexport type ColorTokenConfig = {\n type: 'design-token';\n /** Will be **either** `-` (old) or `.` (new) separated */\n tokenName: string;\n};\nexport type ColorConfig =\n | { type: 'value'; colorValue: string }\n | ColorTokenConfig;\n\nexport const ColorStringStruct = define<string>(\n 'ColorStringStruct',\n (value) => typeof value === 'string' && isColor(value),\n);\n\nexport const ColorConfigStruct: Describe<ColorConfig> = union([\n type({\n type: literal('value'),\n colorValue: ColorStringStruct,\n }),\n type({\n type: literal('design-token'),\n tokenName: string(),\n }),\n]);\n\n// so we can check if an object is not just a ColorConfig but specifically a token\nexport const ColorTokenConfigStruct: Describe<ColorTokenConfig> = type({\n type: literal('design-token'),\n tokenName: string(),\n});\n","import {\n Describe,\n string,\n type,\n union,\n number,\n enums,\n optional,\n literal,\n array,\n size,\n boolean,\n object,\n} from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\n\nexport const HeadingLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nexport type HeadingLevel = (typeof HeadingLevels)[number];\n\nexport type FontSizeConfigVal = {\n unit: 'px' | 'rem';\n value: number;\n};\n\nexport const FontSizeConfigValStruct: Describe<FontSizeConfigVal> = object({\n unit: enums(['rem', 'px']),\n value: number(),\n});\n\nexport type FontFaceWeight = number | string;\n\nexport const FontFaceWeightStruct: Describe<FontFaceWeight> = union([\n string(),\n number(),\n]);\n\nexport enum FontFaceSourceFormats {\n woff2 = 'woff2',\n woff = 'woff',\n}\n\nexport type FontFaceSource = {\n /**\n * Note: if /when we eventually add 'local' type support, format isn't used!\n */\n format: keyof typeof FontFaceSourceFormats;\n type: 'url';\n path: string;\n};\n\nexport const FontFaceFormatsEnumStruct = enums(['woff2', 'woff']);\n\nexport const FontFaceSourceStruct: Describe<FontFaceSource> = type({\n format: FontFaceFormatsEnumStruct,\n type: literal('url'),\n path: string(),\n});\n\nexport type FontFaceConfig = {\n /**\n * registered name of the custom font\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family @font-face's font-family property}\n */\n family?: string;\n\n /**\n * number between 1 and 1000.\n *\n * note: since two weights are allowed (with variable fonts), this type is an\n * optional array for easy parsing down the road.\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight @font-face's font-weight property}.\n */\n weight?: FontFaceWeight | FontFaceWeight[];\n\n /**\n * the collection of urls / paths pointing to font files\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src @font-face's src property}.\n */\n src?: FontFaceSource[];\n\n /**\n * the style of the custom font (ex. normal or italic)\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style See MDN docs on font-style}.\n */\n style?: string;\n\n // @todo: implement these later\n // display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n // variationSettings?: string;\n // unicodeRange?: string; // or ideally, URange; //\n // see https://drafts.csswg.org/css-syntax-3/#urange-syntax and\n // https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range\n};\n\nexport const FontFaceConfigStruct: Describe<FontFaceConfig> = type({\n family: optional(string()),\n weight: optional(\n union([FontFaceWeightStruct, size(array(FontFaceWeightStruct), 2)]),\n ),\n src: optional(array(FontFaceSourceStruct)),\n style: optional(string()),\n display: optional(enums(['auto', 'block', 'swap', 'fallback', 'optional'])),\n variationSettings: optional(string()),\n unicodeRange: optional(string()),\n});\n\nexport type FontSizeConfig = {\n min: FontSizeConfigVal;\n max?: FontSizeConfigVal;\n};\n\nexport enum TextTransforms {\n inherit = 'As typed',\n capitalize = 'Capitalize',\n lowercase = 'Lowercase',\n uppercase = 'Uppercase',\n}\n\nexport enum FontStretches {\n 'ultra-condensed' = 'Ultra-condensed',\n 'extra-condensed' = 'Extra-condensed',\n condensed = 'Condensed',\n 'semi-condensed' = 'Semi-condensed',\n normal = 'Normal',\n 'semi-expanded' = 'Semi-expanded',\n expanded = 'Expanded',\n 'extra-expanded' = 'Extra-expanded',\n 'ultra-expanded' = 'Ultra-expanded',\n}\n\nexport type TypographyConfig = {\n /**\n * min / max height used to future-proof way of supporting responsive typography\n */\n fontSize?: FontSizeConfig;\n\n /**\n * reminder: line-heights can also be unitless!\n */\n lineHeight?: string | number;\n fontWeight?: FontFaceWeight;\n\n /**\n * note: letter-spacing can't be unitless, unit required!\n */\n letterSpacing?: string;\n\n /**\n * if not specified, Knapsack default font, otherwise should allow for a stack of font strings + fallbacks (including the names of custom registered fonts)\n */\n fontFamily?: string;\n\n textColor?: ColorConfig;\n\n textTransform?: keyof typeof TextTransforms;\n\n fontStretch?: keyof typeof FontStretches;\n};\n\nexport interface TypographyLinkConfig {\n fontWeight?: FontFaceWeight;\n textColor?: ColorConfig;\n hoverColor?: ColorConfig;\n underline?: boolean;\n textTransform?: keyof typeof TextTransforms;\n fontStretch?: keyof typeof FontStretches;\n}\n\nexport const TypographyLinkConfigStruct: Describe<TypographyLinkConfig> = type({\n fontWeight: optional(union([string(), number()])),\n textColor: optional(ColorConfigStruct),\n hoverColor: optional(ColorConfigStruct),\n underline: optional(boolean()),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nexport const FontSizeConfigStruct: Describe<FontSizeConfig> = type({\n min: FontSizeConfigValStruct,\n max: optional(FontSizeConfigValStruct),\n});\n\nexport const TypographyConfigStruct: Describe<TypographyConfig> = type({\n fontSize: optional(FontSizeConfigStruct),\n lineHeight: optional(union([string(), number()])),\n fontWeight: optional(union([string(), number()])),\n letterSpacing: optional(string()),\n fontFamily: optional(string()),\n textColor: optional(ColorConfigStruct),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nconst pageElementConfig: TypographyConfig = {};\nconst pageLinkElementConfig: TypographyLinkConfig = {};\n\nexport const pageElements = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport const pageElementsV2 = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingXLarge: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n headingXSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport type PageElementNames = keyof typeof pageElementsV2;\nexport type PageElementConfig = (typeof pageElementsV2)[PageElementNames];\n","import { Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\nimport { TypographyConfig, TypographyConfigStruct } from './typography-config';\n\nexport interface NavCustomizationConfig extends TypographyConfig {\n accentColor?: ColorConfig;\n}\n\nexport interface PrimaryNavCustomizationConfig extends NavCustomizationConfig {\n hoverColor?: ColorConfig;\n backgroundColor?: ColorConfig;\n}\n\nexport type SecondaryNavCustomizationConfig = Omit<\n PrimaryNavCustomizationConfig,\n 'hoverColor'\n>;\n\nexport const NavCustomizationConfigStruct: Describe<NavCustomizationConfig> =\n union([\n TypographyConfigStruct,\n type({\n accentColor: optional(ColorConfigStruct),\n }),\n ]);\n\n// hoverColor: optional(ColorConfigStruct),\nexport const PrimaryNavCustomizationConfigStruct: Describe<PrimaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n hoverColor: optional(ColorConfigStruct),\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nexport const SecondaryNavCustomizationConfigStruct: Describe<SecondaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nconst navCustomizationConfig: NavCustomizationConfig = {};\nconst secondaryNavCustomizationConfig: SecondaryNavCustomizationConfig = {};\nconst primaryNavCustomizationConfig: PrimaryNavCustomizationConfig = {};\n\nexport const customizableNavElements = {\n primaryNav: primaryNavCustomizationConfig,\n secondaryNav: secondaryNavCustomizationConfig,\n tabs: navCustomizationConfig,\n} as const;\n\nexport type CustomizableNavElementNames = keyof typeof customizableNavElements;\nexport type CustomizableNavElementConfig =\n (typeof customizableNavElements)[CustomizableNavElementNames];\n","import type { JSONContent } from '@tiptap/core';\nimport { TokenType } from './design-tokens-types';\n\nexport const BlockSizes = ['large', 'medium', 'small'] as const;\ntype BlockSize = (typeof BlockSizes)[number];\n\nexport const BlockSpacings = ['large', 'medium', 'small'] as const;\ntype BlockSpacing = (typeof BlockSpacings)[number];\n\nexport type BlockHeader = {\n showHeader?: boolean;\n title?: string;\n description?: string;\n};\n\n/**\n * Data for blocks made using the `createEmbedBlock` function\n */\ntype IframeBlockData = {\n url?: string;\n clickToInteract: boolean;\n height?: number | string;\n};\n\ntype BlockConfigBase<\n BlockType extends string,\n Data extends Record<string, unknown> = never,\n> = {\n // Unique across all blocks, basically a UUID upon creation\n // e.g. `ut79D2X_H`\n id: string;\n // Match this to a Slices `id` to use it\n blockType: BlockType;\n data: Data;\n header?: BlockHeader;\n size?: BlockSize;\n /** Controls the amount of spacing AFTER a block */\n spacing?: BlockSpacing;\n};\n\ntype BlockConfigUnion =\n | BlockConfigBase<\n 'component-spec-block',\n {\n patternId?: string;\n templateId?: string;\n collapsible?: boolean;\n expanded?: boolean;\n }\n >\n | BlockConfigBase<\n 'pattern-template-block',\n {\n patternId?: string;\n templateId?: string;\n demoId?: string;\n /** @deprecated */\n demoSize?: string;\n showSchemaForm?: boolean;\n showCodeSnippet?: boolean;\n hideControls?: boolean;\n allowResizing?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-src-tiles',\n {\n columns?: '4' | '3' | '2' | '1';\n imageStyles?: {\n align?: 'left' | 'right' | 'center';\n background?: 'dark' | 'light';\n corners?: 'square' | 'rounded';\n fit?: 'contain' | 'fill';\n seamless?: boolean;\n size?: 'auto' | 'small' | 'medium' | 'large' | 'xsmall' | 'xlarge';\n };\n items: {\n description?: JSONContent;\n fileId: string;\n nodeId: string;\n title?: string;\n }[];\n layout?: 'grid' | 'list';\n hideComponentProps?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-src-component',\n {\n fileId: string;\n componentId: string;\n contents: Array<'variants' | 'spec' | 'usage'>;\n styles?: {\n columns?: '4' | '3' | '2' | '1';\n image?: {\n align?: 'left' | 'right' | 'center';\n background?: 'dark' | 'light';\n corners?: 'square' | 'rounded';\n size?: 'auto' | 'small' | 'medium' | 'large' | 'xsmall' | 'xlarge';\n };\n layout?: 'grid' | 'list';\n };\n hideComponentProps?: boolean;\n hideComponentTitles?: boolean;\n }\n >\n | BlockConfigBase<\n 'text-editor',\n {\n autoFocus?: boolean;\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'files-list',\n {\n files: string[];\n }\n >\n | BlockConfigBase<\n 'callout',\n {\n type: 'error' | 'info' | 'success' | 'warning';\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'code-snippet',\n {\n content: JSONContent;\n }\n >\n | BlockConfigBase<'divider-block', Record<string, never>>\n | BlockConfigBase<\n 'guidelines',\n {\n guidelines: {\n id: string;\n image?: {\n src: string;\n title?: string;\n alt?: string;\n };\n imageFit?: 'contain' | 'cover';\n type: 'caution' | 'do' | 'dont';\n content?: JSONContent;\n }[];\n gridStyles?: {\n centered?: boolean;\n columns?: '4' | '3' | '2' | '1';\n };\n tileStyles?: {\n headerBeforeImage?: boolean;\n imageOutlined?: boolean;\n imageRounded?: boolean;\n imageSize?:\n | 'none'\n | 'small'\n | 'medium'\n | 'large'\n | 'xsmall'\n | 'xlarge';\n };\n }\n >\n | BlockConfigBase<\n 'image-block',\n {\n imageSize?: 'xs' | 's' | 'm' | 'l' | 'full';\n images?: {\n caption?: string;\n src: string;\n }[];\n }\n >\n | BlockConfigBase<\n 'shortcut-tiles',\n {\n shortcuts: {\n description?: string;\n id: string;\n image?: string;\n link: {\n external?: boolean;\n name?: string;\n path: string;\n };\n title: string;\n }[];\n gridStyles?: {\n columns?: '4' | '3' | '2' | '1';\n centered?: boolean;\n gapSize?: number;\n };\n tileStyles?: {\n imageSize?: 'none' | 'xsmall' | 'small' | 'medium' | 'large';\n outlined?: boolean;\n rounded?: boolean;\n titleSize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';\n };\n }\n >\n | BlockConfigBase<\n 'table',\n {\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'pattern-variations',\n {\n patternId?: string;\n templateId?: string;\n demoId?: string;\n variationId?: string;\n assetSetId?: string;\n excludePropValue?: string;\n includePropValue?: string;\n size?: 's' | 'm' | 'l' | 'full';\n /** @deprecated */\n hideBlockTitle?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-tokens',\n {\n tokenType: TokenType | '';\n demoId: string;\n groupIds: string[];\n exclude?: string;\n include?: string;\n }\n >\n | BlockConfigBase<\n 'design-token-collection',\n {\n collectionId: string;\n }\n >\n | BlockConfigBase<\n 'pattern-list-block',\n {\n itemSize?: 'small' | 'medium' | 'large' | 'full';\n showDescriptions?: boolean;\n excludePatterns?: string[];\n }\n >\n | BlockConfigBase<\n 'pattern-status-table-block',\n {\n excludeHiddenNavItems?: boolean;\n excludePatterns?: string[];\n }\n >\n | BlockConfigBase<\n 'video',\n {\n video: {\n format: string;\n name: string;\n size: string;\n url: string;\n };\n }\n >\n /** @deprecated */\n | BlockConfigBase<\n 'design-token-block',\n {\n tokens?: {\n type?: TokenType;\n category?: string;\n tags?: string[];\n name?: string;\n exclude?: string;\n };\n demo?: {\n id?: string;\n };\n }\n >\n | BlockConfigBase<'generic-iframe', IframeBlockData>\n | BlockConfigBase<'abstract-block', IframeBlockData>\n | BlockConfigBase<'adobe-xd-block', IframeBlockData>\n | BlockConfigBase<'airtable-block', IframeBlockData>\n | BlockConfigBase<'figma-block', IframeBlockData>\n | BlockConfigBase<'framer-cloud-block', IframeBlockData>\n | BlockConfigBase<'lucidchart-block', IframeBlockData>\n | BlockConfigBase<'vimeo-block', IframeBlockData>\n | BlockConfigBase<'youtube-block', IframeBlockData>\n | BlockConfigBase<'whimsical-block', IframeBlockData>\n | BlockConfigBase<\n 'markdown-block',\n {\n md?: string | string[];\n /** Automatically switches to edit mode + autofocuses on the editor */\n autoEdit?: boolean;\n columns?: number;\n }\n >;\n\n/**\n * This is the config for a block - which is what is stored in `block.ID.json` and available at `data.db.blocks.byId[blockId]`\n *\n * @example\n * // Use the first generic to filter down to a specific block type\n * type PatternListBlockConfig = BlockConfig<'pattern-list-block'>;\n * // Access the field `data` by doing this:\n * type Data= BlockConfig<'pattern-list-block'>['data'];\n */\nexport type BlockConfig<\n BlockType extends BlockConfigUnion['blockType'] = BlockConfigUnion['blockType'],\n> = Extract<BlockConfigUnion, { blockType: BlockType }>;\n\n/** Block Collections can be in several locations */\nexport type BlockCollectionLocation =\n | {\n type: 'page';\n pageId: string;\n }\n /** Tab on Pattern Page */\n | {\n type: 'patternSubPage';\n patternId: string;\n subPageId: string;\n }\n /** At bottom of Pattern Template page (under Spec table) - least used location */\n | {\n type: 'patternTemplate';\n patternId: string;\n templateId: string;\n };\n","export const tokenNameDisplayFormats = {\n default: 'Default',\n android: 'Android',\n cssVar: 'CSS Var',\n json: 'JSON',\n less: 'Less',\n scss: 'SCSS',\n swift: 'Swift',\n} as const;\n\nexport type TokenNameDisplayFormat = keyof typeof tokenNameDisplayFormats;\n","import * as s from 'superstruct';\n\nexport const strokeStyleValues = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n] as const;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionSingular}\n */\ntype TokenDefinitionSingularRaw =\n | { type: 'string'; value: string }\n | { type: 'number'; value: number }\n | { type: 'boolean'; value: boolean }\n | { type: 'color'; value: string }\n | {\n type: 'strokeStyle';\n value: (typeof strokeStyleValues)[number];\n }\n | { type: 'dimension'; value: `${number}${'px' | 'rem' | 'em' | '%'}` }\n | { type: 'duration'; value: `${number}ms` }\n // | { type: 'fontFamily'; value: string | string[] }\n | {\n type: 'fontWeight';\n // @TODO: Include union of possible strings https://tr.designtokens.org/format/#font-weight\n value: string | number;\n }\n | { type: 'cubicBezier'; value: [number, number, number, number] };\n\n/**\n * Definitions for both singular (non-composite) tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinitionSingular<'dimension'>\n * ```\n */\nexport type TokenDefinitionSingular<\n TheTokenType extends TokenDefinitionSingularRaw['type'] = TokenDefinitionSingularRaw['type'],\n> = Extract<TokenDefinitionSingularRaw, { type: TheTokenType }>;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionComposite}\n */\ntype TokenDefinitionCompositeRaw =\n | {\n type: 'border';\n value: {\n color: { type: 'color' };\n style: { type: 'strokeStyle' };\n width: { type: 'dimension' };\n };\n }\n | {\n type: 'shadow';\n value: {\n color: { type: 'color' };\n offsetX: { type: 'dimension' };\n offsetY: { type: 'dimension' };\n spread: { type: 'dimension' };\n blur: { type: 'dimension' };\n inset: { type: 'boolean' };\n };\n }\n | {\n type: 'transition';\n value: {\n duration: { type: 'duration' };\n delay: { type: 'duration' };\n timingFunction: { type: 'cubicBezier' };\n };\n };\n// | {\n// type: 'gradient';\n// value: {\n// color: { type: 'color' };\n// position: { type: 'dimension' };\n// }[];\n// };\n\n/**\n * Definitions for composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionShadow = TokenDefinitionComposite<'shadow'>\n * ```\n */\nexport type TokenDefinitionComposite<\n TheTokenType extends TokenDefinitionCompositeRaw['type'] = TokenDefinitionCompositeRaw['type'],\n> = Extract<TokenDefinitionCompositeRaw, { type: TheTokenType }>;\n\n/**\n * Definitions for both singular and composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinition<'dimension'>\n * ```\n */\nexport type TokenDefinition<\n TheTokenType extends\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'] =\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'],\n> = Extract<\n TokenDefinitionComposite | TokenDefinitionSingular,\n { type: TheTokenType }\n>;\n\nexport type TokenReference = `{${string}}`;\n/** ensures there is no `{}` */\nexport type NotTokenReference<T> = T extends TokenReference ? never : T;\n\nexport function isTokenReference(val: unknown): val is TokenReference {\n if (typeof val !== 'string') return false;\n // total times `{` appears in `val`\n // Handle situation `{a.b} {c.d}`. Ensure count of `{` and `}` === 1. This\n // guarantees we ONLY support a single reference, ie `{a.b}`\n const totalOpenBrackets = val.split('{').length - 1;\n return totalOpenBrackets === 1 && val.startsWith('{') && val.endsWith('}');\n}\n\nexport function hasTokenReferences(val: unknown): boolean {\n return typeof val === 'string' && val.includes('{');\n}\n\nexport function isNotTokenReference<T>(\n value: T,\n): value is NotTokenReference<T> {\n return !isTokenReference(value);\n}\n\nexport const TokenReferenceStruct = s.define<TokenReference>(\n 'Token Reference',\n (value) => {\n if (typeof value !== 'string') return false;\n if (isNotTokenReference(value)) {\n return 'Must start and end with curly braces';\n }\n return true;\n },\n);\n\nexport type TokenType = TokenDefinition['type'];\nexport type TokenTypeComposite = TokenDefinitionComposite['type'];\nexport type TokenTypeSingular = TokenDefinitionSingular['type'];\nexport type TokenValueSingular = TokenDefinitionSingular['value'];\n\n// We make a Record to ensure we have *every* possible value\n// b/c TS will yell at us if a new one is added but isn't included here\n// then we make an array out of them, so we can be sure we have *every* possible value\nconst compositeTypesRecord: Record<TokenTypeComposite, TokenTypeComposite> = {\n border: 'border',\n shadow: 'shadow',\n transition: 'transition',\n};\nexport const tokenTypeComposites = Object.values(compositeTypesRecord);\nconst singularTypesRecord: Record<TokenTypeSingular, TokenTypeSingular> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n color: 'color',\n dimension: 'dimension',\n duration: 'duration',\n // fontFamily: 'fontFamily',\n fontWeight: 'fontWeight',\n strokeStyle: 'strokeStyle',\n cubicBezier: 'cubicBezier',\n};\nexport const tokenTypeSingulars = Object.values(singularTypesRecord);\n/**\n * @deprecated You probably want `isTokenDataComposite`\n * @see {isTokenDataComposite}\n */\nexport function isTokenTypeComposite(\n type: TokenType,\n): type is TokenTypeComposite {\n return tokenTypeComposites.includes(type as TokenTypeComposite);\n}\n\nexport function isTokenTypeSingular(\n type: TokenType,\n): type is TokenTypeSingular {\n return tokenTypeSingulars.includes(type as TokenTypeSingular);\n}\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport * as s from 'superstruct';\nimport {\n NotTokenReference,\n TokenDefinition,\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenReferenceStruct,\n TokenType,\n hasTokenReferences,\n isTokenTypeComposite,\n} from './token-definitions';\nimport { TokenKsExtensions, TokenOrder } from './token-misc';\nimport { TokenSrcValue } from './token-src';\n\n/** Used for tokens AND groups */\ntype TokenDataBothCommon = {\n id: string;\n description?: string;\n};\n\n// Shows what a fully de-referenced `value` of a composite token would be\ntype CreateDataValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: TokenDefinitionSingular<\n ValueObj[Key]['type']\n >['value'];\n};\n\nexpectType<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>[]\n>([\n {\n inset: false,\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n },\n {\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n inset: true,\n },\n]);\n\ntype TokenDataCommon<\n Info extends {\n /** Basically the ID */\n type: TokenDefinition['type'];\n value: unknown;\n },\n> = TokenDataBothCommon & {\n type: Info['type'];\n value: Info['value'];\n /**\n * Extracted from `$extensions['cloud.knapsack'].token`\n */\n tokenConfig?: TokenKsExtensions['token'];\n /**\n * Tokens that are references by this token\n * @todo will need to change for shadow\n * @example\n * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n references?: Array<string[]>;\n /**\n * Tokens that use this as a reference token\n * @see {CreateTokenData.references}\n * @example\n * * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n // referencedBy?: Array<string[]>;\n};\n\ntype CreateTokenData<\n Info extends {\n type: TokenDefinition['type'];\n value: unknown;\n },\n> =\n | ({\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n originalValue: TokenReference;\n } & TokenDataCommon<Info>)\n | ({\n kind: 'static';\n originalValue: NotTokenReference<TokenSrcValue<Info['type']>>;\n } & TokenDataCommon<Info>);\n\nconst TokenDataBaseStruct: s.Describe<\n TokenDataBothCommon & {\n references?: Array<string[]>;\n tokenConfig?: TokenKsExtensions['token'];\n }\n> = s.type({\n id: s.string(),\n description: s.optional(s.string()),\n references: s.optional(s.array(s.array(s.string()))),\n tokenConfig: s.optional(\n s.type({\n purpose: s.optional(s.string()),\n }),\n ),\n});\n\ntype TokenDataSingularRaw = {\n // ignore the key, this makes a discriminated union out of the values\n [TokenDef in TokenDefinitionSingular as TokenDef['type']]: Simplify<\n CreateTokenData<TokenDef>\n >;\n}[TokenDefinitionSingular['type']];\n\nexport type TokenDataSingular<\n TT extends TokenDataSingularRaw['type'] = TokenDataSingularRaw['type'],\n> = Extract<TokenDataSingularRaw, { type: TT }>;\n\nexpectType<TokenDataSingular[]>([\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'static',\n },\n {\n type: 'duration',\n value: '1ms',\n kind: 'ref',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'ref',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n kind: 'static',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'static',\n id: '1',\n originalValue: '#000',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'ref',\n id: '1',\n originalValue: '{c.b}',\n referencedTokenId: 'c.b',\n },\n {\n type: 'cubicBezier',\n kind: 'static',\n value: [0, 0, 0, 1],\n originalValue: [0, 0, 0, 1],\n id: '1',\n },\n]);\n\ntype TokenDataCompositeRaw = {\n [TokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenData<{\n type: TokenType;\n value: Simplify<\n CreateDataValueForComposite<\n TokenDefinitionComposite<TokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\nexport type TokenDataComposite<\n TheTokenType extends TokenDataCompositeRaw['type'] = TokenDataCompositeRaw['type'],\n> = Extract<TokenDataCompositeRaw, { type: TheTokenType }>;\n\nexport function isTokenDataComposite(\n tokenData: TokenData,\n): tokenData is TokenDataComposite {\n return isTokenTypeComposite(tokenData.type);\n}\n\nexpectType<TokenDataComposite[]>([\n {\n type: 'border',\n kind: 'static',\n id: '1',\n value: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n originalValue: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n },\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n value: {\n color: 'red',\n style: 'dashed',\n width: '2px',\n },\n originalValue: '{a.b}',\n },\n {\n type: 'shadow',\n value: {\n color: '#000',\n offsetX: '1px',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n originalValue: {\n color: '#000',\n offsetX: '{a.a}',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n id: '1',\n kind: 'static',\n },\n {\n type: 'shadow',\n kind: 'ref',\n referencedTokenId: 'a.b',\n value: {\n inset: true,\n color: 'red',\n offsetX: '1px',\n blur: '2px',\n offsetY: '3px',\n spread: '4px',\n },\n originalValue: '{a.b}',\n id: '1',\n },\n {\n type: 'transition',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: '{a.b}',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '{a.c}',\n timingFunction: '{a.c}',\n },\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n id: '1',\n },\n]);\n\nexport type TokenData<\n TheTokenType extends TokenDataSingular['type'] | TokenDataComposite['type'] =\n | TokenDataSingular['type']\n | TokenDataComposite['type'],\n> = Extract<TokenDataSingular | TokenDataComposite, { type: TheTokenType }>;\n\nexport type TokenGroupData = Simplify<\n {\n type?: TokenType;\n /**\n * Extracted from `$extensions['cloud.knapsack'].group`\n */\n groupConfig?: TokenKsExtensions['group'];\n children: TokenOrder;\n } & TokenDataBothCommon\n>;\n\n/**\n * @deprecated Use `TokenValueColorStruct` instead\n */\nexport function isTokenValueColor(\n value: unknown,\n): value is TokenDefinitionSingular<'color'>['value'] {\n return typeof value === 'string' && !hasTokenReferences(value);\n}\n\nexport const TokenValueColorStruct = s.define<TokenData<'color'>['value']>(\n 'Color Value',\n (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (value === '') {\n return 'Value must not be empty';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n },\n);\n\nconst TokenDataColorNonRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('static'),\n originalValue: TokenValueColorStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataColorRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDimensionStruct` instead\n */\nexport function isTokenValueDimension(\n value: unknown,\n): value is TokenDefinitionSingular<'dimension'>['value'] {\n return (\n typeof value === 'string' &&\n (value.endsWith('px') || value.endsWith('rem')) &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDimensionStruct = s.define<\n TokenData<'dimension'>['value']\n>('Dimension Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n if (\n !value.endsWith('px') &&\n !value.endsWith('rem') &&\n !value.endsWith('em') &&\n !value.endsWith('%')\n ) {\n return 'Value must end with px, rem, em or %';\n }\n return true;\n});\n\nconst TokenDataDimensionNonRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDimensionStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDimensionRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDurationStruct` instead\n */\nexport function isTokenValueDuration(\n value: unknown,\n): value is TokenDefinitionSingular<'duration'>['value'] {\n return (\n typeof value === 'string' &&\n value.endsWith('ms') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDurationStruct = s.define<\n TokenData<'duration'>['value']\n>('Duration Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n\n const durationRegex = /^\\d+ms$/;\n if (!durationRegex.test(value)) {\n return 'Value must be a number followed by \"ms\" (e.g., \"100ms\")';\n }\n\n return true;\n});\n\nconst TokenDataDurationNonRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDurationStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDurationRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueFontWeightStruct` instead\n */\nexport function isTokenValueFontWeight(\n value: unknown,\n): value is TokenDefinitionSingular<'fontWeight'>['value'] {\n return (\n (typeof value === 'string' || typeof value === 'number') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueFontWeightStruct = s.define<\n TokenData<'fontWeight'>['value']\n>('Font Weight Value', (value) => {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return 'Value must be a string or number';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n});\n\nconst TokenDataFontWeightNonRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('static'),\n originalValue: TokenValueFontWeightStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataFontWeightRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueCubicBezierStruct = s.define<\n TokenData<'cubicBezier'>['value']\n>('Cubic Bezier Value', (value) => {\n if (!Array.isArray(value)) {\n return 'Value must be an array';\n }\n if (value.length !== 4) {\n return 'Value must be an array of 4 numbers';\n }\n if (!value.every((v) => typeof v === 'number')) {\n return 'Value must be an array of 4 numbers';\n }\n // check if the first and third values are between 0 and 1\n // cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )\n if (value[0] < 0 || value[0] > 1 || value[2] < 0 || value[2] > 1) {\n return 'The first and third cubicBezier values must be between 0 and 1';\n }\n return true;\n});\n\nconst TokenDataCubicBezierNonRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('static'),\n originalValue: TokenValueCubicBezierStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataCubicBezierRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"shadow\" token value AND totally de-referenced\n */\nexport function isTokenValueShadow(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>\n> {\n return (\n isObject(value) &&\n isTokenValueColor(value.color) &&\n isTokenValueDimension(value.offsetX) &&\n isTokenValueDimension(value.offsetY) &&\n isTokenValueDimension(value.blur) &&\n isTokenValueDimension(value.spread)\n );\n}\n\nconst TokenValueShadowStruct = s.define<TokenData<'shadow'>['value']>(\n 'Shadow Value',\n (value) => {\n if (isTokenValueShadow(value)) return true;\n return `Expected a shadow value, got ${JSON.stringify(value)}`;\n },\n);\n\nconst TokenDataShadowNonRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n offsetX: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n offsetY: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n blur: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n spread: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n inset: s.union([\n // marking this as optional b/c it could be `undefined` instead of `false`\n s.optional(s.boolean()),\n TokenReferenceStruct,\n ]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataShadowRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueStrokeStyleStruct = s.union([\n s.literal('solid'),\n s.literal('dashed'),\n s.literal('dotted'),\n s.literal('double'),\n s.literal('groove'),\n s.literal('ridge'),\n s.literal('outset'),\n s.literal('inset'),\n]);\n\n/**\n * Determines if it's a \"border\" token value AND totally de-referenced\n */\nexport function isTokenValueBorder(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'border'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueColorStruct.is(value.color) &&\n TokenValueStrokeStyleStruct.is(value.style) &&\n TokenValueDimensionStruct.is(value.width)\n );\n}\n\nconst TokenValueBorderStruct = s.define<TokenData<'border'>['value']>(\n 'Border Value',\n isTokenValueBorder,\n);\n\nconst TokenDataBorderNonRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n style: s.union([TokenValueStrokeStyleStruct, TokenReferenceStruct]),\n width: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBorderRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"transition\" token value AND totally de-referenced\n */\nexport function isTokenValueTransition(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'transition'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueCubicBezierStruct.is(value.timingFunction) &&\n TokenValueDurationStruct.is(value.duration) &&\n TokenValueDurationStruct.is(value.delay)\n );\n}\nconst TokenValueTransitionStruct = s.define<TokenData<'transition'>['value']>(\n 'Transition Value',\n isTokenValueTransition,\n);\n\nconst TokenDataTransitionNonRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n timingFunction: s.union([\n TokenValueCubicBezierStruct,\n TokenReferenceStruct,\n ]),\n duration: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n delay: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataTransitionRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringNonRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('static'),\n originalValue: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleNonRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('static'),\n originalValue: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n// const TokenDataFontFamilyNonRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'static' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('static'),\n// originalValue: s.union([s.string(), s.array(s.string())]),\n// }),\n// TokenDataBaseStruct,\n// );\n\n// const TokenDataFontFamilyRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'ref' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('ref'),\n// originalValue: TokenReferenceStruct,\n// referencedTokenId: s.string(),\n// }),\n// TokenDataBaseStruct,\n// );\n\nconst TokenDataNumberNonRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('static'),\n originalValue: s.number(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataNumberRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanNonRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('static'),\n originalValue: s.boolean(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n// Instead of using `s.union` to combine all the token data structs,\n// we first find out what \"type\" the token is\n// then we find out `kind` - which is our 2nd layer of discriminated union\n// and then use the specific struct\n// that way the errors are more specific to the actual declared token \"type\"\n// In a nutshell, `s.union` is not very good at discriminated unions errors\nexport const assertTokenData = (data: unknown): asserts data is TokenData => {\n if (!isObject(data)) {\n throw new Error(\n `Expected token data to be an object, got ${JSON.stringify(data)}`,\n );\n }\n if (!isObjKey('type', data)) {\n throw new Error(\n `Expected token data to have a \"type\" property, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n if (typeof data.type !== 'string') {\n throw new Error(\n `Expected token data \"type\" property to be a string, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n const type = data.type as TokenData['type'];\n const kind = data.kind as TokenData['kind'];\n try {\n switch (type) {\n case 'boolean':\n if (kind === 'ref') {\n TokenDataBooleanRefStruct.assert(data);\n } else {\n TokenDataBooleanNonRefStruct.assert(data);\n }\n return;\n case 'border':\n if (kind === 'ref') {\n TokenDataBorderRefStruct.assert(data);\n } else {\n TokenDataBorderNonRefStruct.assert(data);\n }\n return;\n case 'color':\n if (kind === 'ref') {\n TokenDataColorRefStruct.assert(data);\n } else {\n TokenDataColorNonRefStruct.assert(data);\n }\n return;\n case 'cubicBezier':\n if (kind === 'ref') {\n TokenDataCubicBezierRefStruct.assert(data);\n } else {\n TokenDataCubicBezierNonRefStruct.assert(data);\n }\n return;\n case 'dimension':\n if (kind === 'ref') {\n TokenDataDimensionRefStruct.assert(data);\n } else {\n TokenDataDimensionNonRefStruct.assert(data);\n }\n return;\n case 'duration':\n if (kind === 'ref') {\n TokenDataDurationRefStruct.assert(data);\n } else {\n TokenDataDurationNonRefStruct.assert(data);\n }\n return;\n case 'fontWeight':\n if (kind === 'ref') {\n TokenDataFontWeightRefStruct.assert(data);\n } else {\n TokenDataFontWeightNonRefStruct.assert(data);\n }\n return;\n case 'number':\n if (kind === 'ref') {\n TokenDataNumberRefStruct.assert(data);\n } else {\n TokenDataNumberNonRefStruct.assert(data);\n }\n return;\n case 'shadow':\n if (kind === 'ref') {\n TokenDataShadowRefStruct.assert(data);\n } else {\n TokenDataShadowNonRefStruct.assert(data);\n }\n return;\n case 'string':\n if (kind === 'ref') {\n TokenDataStringRefStruct.assert(data);\n } else {\n TokenDataStringNonRefStruct.assert(data);\n }\n return;\n case 'strokeStyle': // temp implementation\n if (kind === 'ref') {\n TokenDataStrokeStyleRefStruct.assert(data);\n } else {\n TokenDataStrokeStyleNonRefStruct.assert(data);\n }\n return;\n // case 'fontFamily':\n // if (kind === 'ref') {\n // TokenDataFontFamilyRefStruct.assert(data);\n // } else {\n // TokenDataFontFamilyNonRefStruct.assert(data);\n // }\n // return;\n case 'transition':\n if (kind === 'ref') {\n TokenDataTransitionRefStruct.assert(data);\n } else {\n TokenDataTransitionNonRefStruct.assert(data);\n }\n return;\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown token data type: ${type}`);\n }\n }\n } catch (error) {\n if (!(error instanceof s.StructError)) throw error;\n throw new Error(\n `Invalid token data for type \"${type}\": ${\n error.message\n }. Received this data: \"${JSON.stringify(data)}\"`,\n );\n }\n};\n","import { Simplify, expectType } from '@knapsack/utils';\nimport {\n TokenType,\n TokenDefinitionSingular,\n TokenDefinitionComposite,\n isTokenTypeComposite,\n isTokenTypeSingular,\n} from './token-definitions';\n\ntype CreateTokenSrcValueInfo<\n T extends {\n type: TokenType;\n value: unknown;\n },\n> =\n | {\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n isVarRef?: boolean;\n type: T['type'];\n }\n | {\n kind: 'static';\n type: T['type'];\n value: T['value'];\n };\n\ntype TokenSrcValueInfoSingularRaw = {\n // Ignore the key, pay attention to the value\n // The values become the items in the discriminated union\n [TheTokenType in TokenDefinitionSingular as TheTokenType['type']]: Simplify<\n CreateTokenSrcValueInfo<TheTokenType>\n >;\n}[TokenDefinitionSingular['type']];\n\n// This helper allows us to just pass the type string in to get that\n// item out of the discriminated union: `TokenSrcValueInfoSingular<'color'>`\ntype TokenSrcValueInfoSingular<\n TT extends TokenSrcValueInfoSingularRaw['type'] = TokenSrcValueInfoSingularRaw['type'],\n> = Extract<TokenSrcValueInfoSingularRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoSingular<'dimension'>[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'dimension',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n]);\n\ntype CreateSrcValueInfoForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: Simplify<\n CreateTokenSrcValueInfo<{\n type: ValueObj[Key]['type'];\n value: TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n }>\n >;\n};\n\ntype TokenSrcValueInfoCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenSrcValueInfo<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueInfoForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueInfoComposite<\n TT extends TokenSrcValueInfoCompositeRaw['type'] = TokenSrcValueInfoCompositeRaw['type'],\n> = Extract<TokenSrcValueInfoCompositeRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoComposite<'border'>[]>([\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'border',\n kind: 'static',\n value: {\n color: {\n kind: 'static',\n type: 'color',\n value: 'red',\n },\n style: {\n kind: 'ref',\n type: 'strokeStyle',\n referencedTokenId: '', // FIX\n },\n width: {\n kind: 'static',\n type: 'dimension',\n value: '2px',\n },\n },\n },\n]);\n\nexpectType<TokenSrcValueInfoComposite<'transition'>[]>([\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\nexport type TokenSrcValueInfo<\n TT extends\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'] =\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'],\n TheKind extends\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'] =\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'],\n> = Extract<\n TokenSrcValueInfoComposite | TokenSrcValueInfoSingular,\n { type: TT; kind: TheKind }\n>;\n\nexport function isTokenSrcValueInfoSingular(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoSingular {\n return isTokenTypeSingular(tokenSrcValueInfo?.type);\n}\nexport function isTokenSrcValueInfoComposite(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoComposite {\n return isTokenTypeComposite(tokenSrcValueInfo?.type);\n}\n\nexpectType<TokenSrcValueInfo[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'ref',\n // @ts-expect-error - with `kind: 'ref'`, `value` is not allowed\n value: '1px',\n },\n {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\n/**\n * A common object that is used to represent a token in the app.\n * Used in functions for editing communication between UI forms, Xstate,\n * and `@knapsack/design-tokens-utils`.\n */\nexport type TokenInfo<\n TheTokenType extends TokenSrcValueInfo['type'] = TokenSrcValueInfo['type'],\n> = {\n tokenSrcValueInfo: TokenSrcValueInfo<TheTokenType>;\n tokenId: string;\n description?: string;\n};\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport {\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenType,\n TokenDefinition,\n} from './token-definitions';\nimport { TokenKsExtensions } from './token-misc';\n\nexport type TokenSrcCommon<TheType extends TokenType = TokenType> = {\n $type?: TokenDefinition<TheType>['type'];\n $description?: string;\n $extensions?: {\n 'cloud.knapsack'?: TokenKsExtensions;\n };\n};\n\nexport function isTokenSrcExtensions(\n extensionsObj: unknown,\n): extensionsObj is TokenSrcCommon['$extensions'] {\n return isObject(extensionsObj) && isObjKey('cloud.knapsack', extensionsObj);\n}\n\ntype CreateSrcValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]:\n | TokenReference\n | TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n};\n\ntype TokenSrcValueCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueComposite<\n TT extends TokenSrcValueCompositeRaw['type'] = TokenSrcValueCompositeRaw['type'],\n> = Extract<TokenSrcValueCompositeRaw, { type: TT }>;\n\ntype TokenSrcValueRaw = TokenDefinitionSingular | TokenSrcValueComposite;\n\nexport type TokenSrcValue<\n Type extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Extract<TokenSrcValueRaw, { type: Type }>['value'] | TokenReference;\n\nexpectType<TokenSrcValue[]>([\n '#ddd',\n true,\n [83, 1, 1, 1],\n {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n {\n inset: true,\n color: '#000',\n offsetX: '0px',\n offsetY: '{spacing.medium}',\n spread: '0px',\n blur: '0px',\n },\n {\n timingFunction: '{timing.ease}',\n duration: '{timing.duration.medium}',\n delay: '7ms',\n color: '#000',\n },\n]);\n\nexport type TokenSrc<\n TheType extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Simplify<\n {\n $value: TokenSrcValue<TheType>;\n } & TokenSrcCommon<TheType>\n>;\n\nexport function isTokenSrc(tokenObject: unknown): tokenObject is TokenSrc {\n if (isObject(tokenObject) && isObjKey('$value', tokenObject)) return true;\n return false;\n}\n\nexport type TokenSrcGroup = TokenSrcCommon & {\n [key: string]:\n | TokenSrcGroup\n | TokenSrc\n | TokenSrcCommon\n | TokenSrcCommon['$extensions'];\n};\n\nexport function isTokenGroup(\n tokenObject: unknown,\n): tokenObject is TokenSrcGroup {\n // @todo improve\n return (\n isObject(tokenObject) &&\n !isTokenSrcExtensions(tokenObject) &&\n !isObjKey('$value', tokenObject) &&\n // ensuring we are not in `$extensions` object\n !isObjKey('cloud.knapsack', tokenObject)\n );\n}\n\n// Token VAR references look like TokenSrcGroup\nexport function isTokenTypeVarRef(tokenObject: unknown) {\n // It's at least a TokenSrcGroup\n if (isTokenGroup(tokenObject)) {\n // The specific key within collectionInfo with the var reference\n const varRefCollectionInfo =\n tokenObject.$extensions['cloud.knapsack'].group.collectionInfo;\n if (\n isObjKey('type', varRefCollectionInfo) &&\n isObjKey('referenceId', varRefCollectionInfo)\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import { parseNumberWithUnit } from '@knapsack/utils';\n\nexport function getPrimitiveValue(\n tokenValue: unknown,\n): 'string' | 'number' | 'boolean' {\n const type = typeof tokenValue;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return type;\n }\n throw new Error(\n `Invalid token value type: ${JSON.stringify(\n type,\n )}. Token value is: ${JSON.stringify(tokenValue)}`,\n );\n}\n\nexport type TokenDimensionUnit = 'px' | 'rem' | 'em' | '%';\n\n/**\n * Dimension strings require ending in 'px' or 'rem'\n * @see `libs/types/src/app-client-data/design-tokens-types/token-definitions.ts`\n */\nexport const isDimensionString = (\n value: string,\n): value is `${number}${'px' | 'rem' | 'em' | '%'}` =>\n value.includes('px') ||\n value.includes('rem') ||\n value.includes('em') ||\n value.includes('%');\n\n/**\n * Pass in values like `'12px'` to get detailed info\n * @throws if value is not a number or does not end in supported unit\n */\nexport function parseTokenDimensionValue(valueToParse: string | number): {\n value: number;\n unit?: TokenDimensionUnit;\n} {\n const { value, unit } = parseNumberWithUnit(valueToParse);\n if (!unit) {\n return { value };\n }\n if (unit !== 'px' && unit !== 'rem' && unit !== 'em' && unit !== '%') {\n throw new Error(`Invalid unit \"${unit}\" for value: ${value}`);\n }\n\n return { value, unit };\n}\n","import type { CSSProperties } from 'react';\nimport type { JsonSchemaObject } from '../json-schema';\nimport { RendererId } from '../renderers';\nimport { isObject } from '../type-utils';\nimport type { BlockConfig } from './blocks';\nimport type { Page, PageTab } from './page';\nimport { TokenSrcValueInfo } from './design-tokens-types/token-src-value-info';\n\nexport interface KsStatus {\n id: string;\n title: string;\n color?: string;\n}\n\nexport interface KsStatusSet {\n id: string;\n title: string;\n statuses: KsStatus[];\n}\n\n/**\n * Used by template renderers in addition to `path`\n * Twig: `@components/button.twig`\n * Web Components: `my-button` => `<my-button>`\n * React: a named export of the file if not `default`\n * @todo Replace this with `rendererOptions`\n */\ntype TemplateAlias = string;\n\nexport type SlottedTemplateDemo = {\n type: 'template-demo';\n /** @deprecated */\n patternId: string;\n /** @deprecated */\n templateId: string;\n /**\n * The demo referenced by `demoId` is inlined here before sending to server to\n * render, but is never stored in the json data. If this is present, it is\n * used instead of the demo referenced by `demoId`. This is done to ensure\n * server has all the latest data for a template demo by ensuring it includes\n * it's slotted children's data.\n * @see {inlineDemoData}\n */\n demo?: DataDemo;\n demoId: DemoBase['id'];\n};\n\n/**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n */\nexport type SlottedTemplateReference = {\n type: 'template-reference';\n patternId: string;\n templateId: string;\n};\n\nexport type SlottedText = {\n type: 'text';\n text: string;\n};\n\nexport type SlottedData =\n | SlottedText\n | SlottedTemplateDemo\n | SlottedTemplateReference;\n\n/** @deprecated - just check `type` */\nexport const isSlottedText = (\n slottedData: unknown,\n): slottedData is SlottedText =>\n isObject(slottedData) && slottedData.type === 'text';\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateDemo(\n slottedData: unknown,\n): slottedData is SlottedTemplateDemo {\n return isObject(slottedData) && slottedData.type === 'template-demo';\n}\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateReference(\n slottedData: unknown,\n): slottedData is SlottedTemplateReference {\n return isObject(slottedData) && slottedData.type === 'template-reference';\n}\n\n/**\n * Collection ID: Mode ID\n */\nexport type ThemeDefinition = {\n [collectionId: string]: string;\n};\n\nexport type SlotOptions = {\n /**\n * @default 'div'\n */\n wrappingElementName?: string;\n cssClasses?: string[];\n align?: {\n value:\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'left'\n | 'center'\n | 'right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n };\n layout?: {\n value: 'horizontal' | 'vertical' | 'wrap';\n };\n gap?: {\n value: TokenSrcValueInfo<'dimension'>;\n };\n paddingHorizontal?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n paddingVertical?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n /**\n * Collection ID: Mode ID\n */\n theme?: ThemeDefinition;\n};\n\n/**\n * These are created from {SlotOptions}\n * Only available in App Client for rendering - this is NOT saved in App Client Data\n */\nexport type SlotOptionsComputed = {\n styles: CSSProperties;\n cssClasses: string[];\n /**\n * @default 'div'\n */\n wrappingElementName: string;\n /**\n * can't be `style` or `class` or `className`\n */\n attributes: {\n [attributeName: string]: string;\n };\n};\n\nexport type KnapsackTemplateData = {\n /**\n * @todo Ideal would be `{ [key: string]: string | boolean | number }`\n */\n props: {\n [prop: string]: any;\n };\n slots?: {\n [slotName: string]: Array<SlottedData>;\n };\n /**\n * Settings from users are stored here and saved in App Client Data\n * This is used to dynamically create `slotsOptionsComputed`\n */\n slotsOptions?: {\n [slotName: string]: SlotOptions;\n };\n /**\n * Use `slotsOptions` to set & save styles on slotted children\n * Never set nor stored in App Client Data that gets saved\n * This is only inlined in the demo data for rendering so the App Client can\n * apply the styles to the slotted children\n * @see {inlineDemoData}\n */\n slotsOptionsComputed?: {\n [slotName: string]: SlotOptionsComputed;\n };\n};\n\ntype DemoType = 'data' | 'template';\n\ntype DemoBase = {\n id: string;\n title: string;\n description?: string;\n /**\n * Would override what was on the template\n */\n assetSetId?: string;\n width?: number;\n height?: number;\n type: DemoType;\n /** Collection ID: Mode ID */\n theme?: ThemeDefinition;\n};\n\n/**\n * Shows usage\n */\nexport type DataDemo = DemoBase & {\n type: 'data';\n patternId: string;\n templateId: string;\n data: KnapsackTemplateData;\n};\n\n/**\n * Shows source code\n */\nexport type TemplateDemo = DemoBase & {\n type: 'template';\n templateInfo: {\n alias?: TemplateAlias;\n path?: string;\n };\n};\n\nexport type Demo = TemplateDemo | DataDemo;\n\nexport type RenderDataDemo = Demo & {\n inlineStyles?: string;\n bodyAttributes?: Record<string, string>;\n};\n\n/** @deprecated */\nexport enum StageLayouts {\n portrait = 'portrait',\n landscape = 'landscape',\n}\n\nexport function isDataDemo(demo: TemplateDemo | DataDemo): demo is DataDemo {\n return demo?.type === 'data';\n}\n\nexport function isTemplateDemo(demo: Demo): demo is TemplateDemo {\n return demo?.type === 'template';\n}\n\nexport type KsSlotInfo = {\n title: string;\n description?: string;\n disallowText?: boolean;\n isRequired?: boolean;\n allowOnlyOne?: boolean;\n /**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {SlottedTemplateReference}\n */\n isTemplateReference?: boolean;\n allowedPatternIds?: string[];\n};\n\n/**\n * Supersedes `schema`\n */\nexport type KsTemplateSpec = {\n /**\n * Attempt to create the props & slots spec by reading the source file.\n * Prevents ability to use spec editor.\n *\n * If `true`, then uses the template `alias` & `path` to find the file.\n *\n * If a string, then that file path is used in place of the source file.\n *\n * Scenario: the `path` is used to point to a compiled file w types stripped\n * and this is used to point to either the source file w types or the compiled\n * `.d.ts` file. Currently only React is supported. The file extension\n * determines if TypeScript (ts/tsx) or PropTypes (js/jsx) is used for\n * inference.\n */\n isInferred?: boolean | string;\n /**\n * JSON Schema defining the serializable data passed in\n * The classic, formerly `schema`\n */\n props?: JsonSchemaObject;\n /**\n * Child component slots\n */\n slots?: {\n [name: string]: KsSlotInfo;\n };\n /**\n * @todo evaluate & refine\n */\n // cssProps?: {\n // [name: string]: {\n // title: string;\n // description: string;\n // };\n // };\n hidePropsTable?: boolean;\n hideSlotsTable?: boolean;\n /**\n * Extra Docs are each shown in their own table.\n * Useful for non-traditional spec docs that are more template language specific.\n * Examples: events, methods, etc\n */\n extraDocs?: {\n id: string;\n title: string;\n description?: string;\n tableRows?: {\n [columnTitle: string]: string;\n }[];\n }[];\n};\n\nexport interface KnapsackPatternTemplate {\n id: string;\n title?: string;\n /**\n * Relative file path to the template from the config file it is declared in\n */\n path: string;\n\n alias?: TemplateAlias;\n /**\n * Which template language? i.e. `twig`, `react` Replaces\n * KnapsackTemplateRenderer.test which ran a test on the file path (similar to\n * how WebPack loader `test` works)\n */\n templateLanguageId: RendererId;\n assetSetIds?: string[];\n spec?: KsTemplateSpec;\n /** Array of demo IDs, actual demo data is stored in `db.demos.demosById` */\n demoIds: Demo['id'][];\n /** Array of block IDs, actual block content is stored in db.blocks.blocksById */\n blockIds: BlockConfig['id'][];\n}\n\nexport type KnapsackPattern = Page & {\n $schema?: string;\n statuses?: {\n [statusSetId: string]: string;\n };\n templates?: KnapsackPatternTemplate[];\n subPages?: {\n id: string;\n title: string;\n blockIds: BlockConfig['id'][];\n }[];\n designSrcComponentsById?: Record<\n string,\n {\n id: string;\n title: string;\n componentId: string;\n fileId: string;\n }\n >;\n /** Controls order of `templates` & `subPages` on Pattern Page */\n tabs?: PageTab[];\n\n aliases?: string[];\n /**\n * Prevents pattern from appearing in System Overview and Status Table blocks\n */\n hideFromOverviewBlocks?: boolean;\n /**\n * Prevents pattern from appearing as an option in Component Embed and\n * Component Demo blocks\n */\n hideFromComponentBlocks?: boolean;\n};\n\nexport interface KnapsackPatternTemplateCode {\n html: string;\n data?: Record<string, any>;\n templateSrc: string;\n usage: string;\n language: string;\n}\n\nexport type KnapsackPatternsConfig = {\n $schema?: string;\n statusSets: KsStatusSet[];\n};\n\nexport interface TemplateRendererMeta {\n id: RendererId;\n title: string;\n version?: string;\n aliasTitle?: string;\n aliasDescription?: string;\n aliasUse: 'off' | 'optional' | 'required';\n aliasIsJsNamedExport?: boolean;\n syntaxHighlightingLanguage?: string;\n enableDataDemos: boolean;\n enableTemplateDemos: boolean;\n hasSlotsSupport: boolean;\n hasSlotOptionsSupport?: boolean;\n hasInferSpecSupport: boolean;\n hasTemplateSuggestionsSupport: boolean;\n prototypingTemplate?: {\n path: string;\n alias?: string;\n spec: Pick<KsTemplateSpec, 'props' | 'slots' | 'isInferred'>;\n };\n}\n\nexport type PatternsState = {\n patterns: {\n [id: string]: KnapsackPattern;\n };\n renderers: Partial<\n Record<\n RendererId,\n {\n meta: TemplateRendererMeta;\n }\n >\n >;\n} & KnapsackPatternsConfig;\n","import { ColorConfig } from '../color-config';\n\nexport enum PageHeaderSizes {\n auto = 'auto',\n small = 'small',\n medium = 'medium',\n large = 'large',\n full = 'full',\n}\n\nexport interface PageHeaderSettings {\n size?: `${PageHeaderSizes}`;\n backgroundImage?: string;\n backgroundColor?: ColorConfig;\n backgroundOverlay?: boolean;\n backgroundSize?: 'cover' | 'contain' | 'string';\n backgroundPosition?: 'left' | 'center' | 'right' | 'string';\n backgroundRepeat?: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\n hideText?: boolean;\n textColorTitle?: ColorConfig;\n textColorDescription?: ColorConfig;\n}\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { TokenSrcGroup } from './design-tokens-types';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { BlockConfig } from './blocks';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { Demo, PatternsState } from './patterns';\nimport { UiConfig } from '../ui-config';\nimport { PagesSettings } from './page';\nimport { BlocksSettings } from './blocks.settings';\nimport { DesignSrcFile } from '../design-src.types';\n\nexport * from './asset-sets';\nexport * from './blocks';\nexport * from './custom-pages';\nexport * from './design-tokens';\nexport * from './design-tokens-types';\nexport * from './nav';\nexport * from './files';\nexport * from './meta';\nexport * from './patterns';\nexport { PageHeaderSizes } from './page.header';\nexport type { PageHeaderSettings } from './page.header';\nexport type { PageTab, PageType } from './page';\n\nexport interface KsAppClientData {\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensSrc: TokenSrcGroup;\n metaState?: MetaState;\n filesState: KsFiles;\n db: {\n blocks: {\n byId: Record<string, BlockConfig>;\n settings: BlocksSettings;\n };\n demos: {\n byId: Record<string, Demo>;\n // \"never\" for now until there are actual settings for demos\n settings: Record<string, never>;\n };\n settings: {\n title?: string;\n hideTitleInNavigation?: boolean;\n logoUrl?: string;\n favicon?: `https://${string}`;\n theme?: UiConfig;\n pages?: PagesSettings;\n designSrcs?: {\n files?: DesignSrcFile[];\n };\n tokens?: {\n theming?: {\n /** Which template languages theming controls will show up for next to the components preview stage. */\n enabledRendererIds?: string[];\n };\n };\n prototyping?: {\n patternId: string;\n };\n };\n };\n}\n\nexport type KsAppClientDataNoMeta = Omit<KsAppClientData, 'metaState'>;\nexport type KsAppClientDataAndMeta = Required<KsAppClientData>;\n\nexport function isKsAppClientDataNoMeta(\n data: unknown,\n): data is KsAppClientDataNoMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataNoMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'db',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStruct = define<KsAppClientDataNoMeta>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMeta,\n);\n\nexport function isKsAppClientDataAndMeta(\n data: unknown,\n): data is KsAppClientDataAndMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataAndMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'metaState',\n 'db',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStruct = define<KsAppClientDataAndMeta>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMeta,\n);\n\nexport const KsMetaStateStruct: Describe<KsAppClientData['metaState']> = type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n});\n\nexport const isKsMetaState = KsMetaStateStruct.is;\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { KsDesignTokensState } from './design-tokens';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { PatternsState } from './patterns';\nimport type { KnapsackSettings } from './settings';\n\nexport type {\n KsDesignToken,\n KsDesignTokenAttributes,\n KsDesignTokenData,\n KsDesignTokenDataGroup,\n KsDesignTokenSrc,\n KsDesignTokenSrcGroup,\n KsDesignTokensState,\n KsTokenType,\n KsTokenValue,\n KnapsackDesignToken,\n} from './design-tokens';\n\nexport interface KsAppClientDataV3 {\n settingsState: {\n settings: KnapsackSettings;\n };\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensState: KsDesignTokensState;\n metaState?: MetaState;\n filesState: KsFiles;\n}\n\nexport type KsAppClientDataNoMetaV3 = Omit<KsAppClientDataV3, 'metaState'>;\nexport type KsAppClientDataAndMetaV3 = Required<KsAppClientDataV3>;\n\nexport function isKsAppClientDataNoMetaV3(\n data: unknown,\n): data is KsAppClientDataNoMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataNoMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStructV3 = define<KsAppClientDataNoMetaV3>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMetaV3,\n);\n\nexport function isKsAppClientDataAndMetaV3(\n data: unknown,\n): data is KsAppClientDataAndMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataAndMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n 'metaState',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStructV3 = define<KsAppClientDataAndMetaV3>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMetaV3,\n);\n\nexport const KsMetaStateStructV3: Describe<KsAppClientDataV3['metaState']> =\n type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n });\n\nexport const isKsMetaStateV3 = KsMetaStateStructV3.is;\n","import { isDraft, type Draft } from 'immer';\nimport { Migration } from './migration.types';\nimport { KnapsackPattern, SlottedData } from '../app-client-data/patterns';\n\ntype Migration417DemosType = {\n version: string;\n checkIfNeeded: (appClientData: any) => boolean;\n migrate: (appClientData: Draft<any>) => void;\n};\n\nexport const migration417Demos: Migration417DemosType = {\n version: '4.1.7',\n checkIfNeeded: (appClientData) => {\n // this one will be tough to check for, so we'll just assume it's needed\n return true;\n },\n // note that `appClientData` is mutable since we're already in Immer\n migrate: (appClientData) => {\n if (!isDraft(appClientData)) {\n throw new Error(\n `Tried to run migrations on appClientData but it is not an Immer Draft`,\n );\n }\n Object.values(appClientData.patternsState.patterns).forEach(\n (\n pattern: Draft<\n KnapsackPattern & {\n demoSize?: string;\n }\n >,\n ) => {\n delete pattern.demoSize;\n },\n );\n\n Object.values(appClientData.db.demos.byId).forEach((demo) => {\n if (demo.type !== 'data') return;\n\n Object.entries(demo.data.slots ?? {}).forEach(([slotName, slotData]) => {\n demo.data.slots[slotName] = slotData.map(\n (slottedData: Draft<SlottedData | string>) => {\n // it used to be just a string\n if (typeof slottedData === 'string') {\n return {\n type: 'text',\n text: slottedData,\n };\n }\n if (\n // not doing anything with these\n slottedData.type === 'template-reference' ||\n // these already were migrated or made by the new editor\n slottedData.type === 'text'\n ) {\n return slottedData;\n }\n // these used to not have a type set\n slottedData.type = 'template-demo';\n return slottedData;\n },\n );\n });\n\n if (demo.patternId && demo.templateId) return;\n\n // using an IIFE so we can stop looping once we find it\n // would use `break` but it's a double loop\n (() => {\n for (const { id: pId, templates = [] } of Object.values(\n appClientData.patternsState.patterns,\n )) {\n for (const { id: tId, demoIds = [] } of templates) {\n if (demoIds.includes(demo.id)) {\n demo.patternId = pId;\n demo.templateId = tId;\n // found it - stop looking\n return;\n }\n }\n }\n })();\n });\n },\n} satisfies Migration;\n","import { migration417Demos } from './4.1.7-demos';\n\nexport const migrations = [migration417Demos];\n","// import { JSONSchema7 } from 'json-schema'; @todo consider using instead; though I'm not seeing it make it's way to the compiled JSON schema themselves via `convert-types-to-json-schmea.js`\n\ntype PropBase<Type = any> = {\n title?: string;\n description?: string;\n default?: Type;\n};\n\nexport enum PropTypeNames {\n 'string' = 'string',\n 'boolean' = 'boolean',\n 'number' = 'number',\n 'object' = 'object',\n 'options' = 'options',\n 'function' = 'function',\n 'customTypeScript' = 'customTypeScript',\n 'array' = 'array',\n 'arrayOfObjects' = 'arrayOfObjects',\n 'arrayOfStrings' = 'arrayOfStrings',\n 'arrayOfNumbers' = 'arrayOfNumbers',\n 'unknown' = 'unknown',\n}\nexport type PropTypeNamesList = keyof typeof PropTypeNames;\n\nexport type StringProp = {\n type: 'string';\n} & PropBase<string>;\n\nexport type BooleanProp = {\n type: 'boolean';\n} & PropBase<boolean>;\n\nexport type NumberProp = {\n type: 'number';\n} & PropBase<number>;\n\nexport type OptionsProp = {\n type: 'string';\n enum: string[];\n enumNames?: string[];\n} & PropBase<string>;\n\nexport type CustomTypeScriptProp = {\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n type?: never;\n default?: string;\n} & PropBase<string>;\n\nexport type FunctionProp = {\n typeof: 'function';\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n default?: string;\n type?: 'string';\n} & PropBase<string>;\n\nexport type ObjectProp = {\n type: 'object';\n additionalProperties?: boolean;\n required?: string[];\n properties: {\n [prop: string]: PropertyTypes;\n };\n} & PropBase;\n\nexport type ArrayProp = {\n type: 'array';\n items: PropertyTypes;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfStringsProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: StringProp;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfNumbersProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: NumberProp;\n} & PropBase<number[]>;\n\nexport type ArrayOfObjectsProp = {\n type: 'array';\n items: ObjectProp;\n} & PropBase<Array<Record<string, unknown>>>;\n\nexport type PropertyTypes =\n | StringProp\n | BooleanProp\n | NumberProp\n | OptionsProp\n | FunctionProp\n | CustomTypeScriptProp\n | ObjectProp\n | ArrayOfObjectsProp\n | ArrayOfStringsProp\n | ArrayOfNumbersProp\n | ArrayProp;\n\nexport const isStringProp = (prop: PropertyTypes): prop is StringProp =>\n 'type' in prop && prop.type === 'string' && !('enum' in prop);\nexport const isNumberProp = (prop: PropertyTypes): prop is NumberProp =>\n 'type' in prop && prop.type === 'number';\nexport const isBooleanProp = (prop: PropertyTypes): prop is BooleanProp =>\n 'type' in prop && prop.type === 'boolean';\nexport const isOptionsProp = (prop: PropertyTypes): prop is OptionsProp =>\n 'enum' in prop;\nexport const isFunctionProp = (prop: PropertyTypes): prop is FunctionProp =>\n 'typeof' in prop && prop?.typeof === 'function';\nexport const isCustomTypeScriptProp = (\n prop: PropertyTypes,\n): prop is CustomTypeScriptProp => !('typeof' in prop) && 'tsType' in prop;\nexport const isArrayOfObjectsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfObjectsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'object';\nexport const isObjectProp = (prop: PropertyTypes): prop is ObjectProp =>\n 'type' in prop &&\n prop.type === 'object' &&\n 'properties' in prop &&\n Object.keys(prop.properties).length > 0;\nexport const isArrayOfStringsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfStringsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'string';\nexport const isArrayOfNumbersProp = (\n prop: PropertyTypes,\n): prop is ArrayOfNumbersProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'number';\n\nexport interface PropTypeDataBase {\n type: any;\n id: string;\n isRequired?: boolean;\n data: any;\n}\n\nexport interface StringPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.string;\n data: StringProp;\n}\n\nexport interface BooleanPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.boolean;\n data: BooleanProp;\n}\n\nexport interface NumberPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.number;\n data: NumberProp;\n}\n\nexport interface OptionsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.options;\n data: OptionsProp;\n}\n\nexport interface FunctionPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.function;\n data: FunctionProp;\n}\n\nexport interface CustomTypeScriptPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.customTypeScript;\n data: CustomTypeScriptProp;\n}\n\nexport interface ObjectPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.object;\n data: ObjectProp;\n}\n\nexport interface ArrayOfObjectsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfObjects;\n data: ArrayOfObjectsProp;\n}\n\nexport interface ArrayOfStringsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfStrings;\n data: ArrayOfStringsProp;\n}\n\nexport interface ArrayOfNumbersPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfNumbers;\n data: ArrayOfNumbersProp;\n}\n\nexport interface ArrayPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.array;\n data: ArrayProp;\n}\n\nexport type PropTypeData =\n | StringPropTypeData\n | BooleanPropTypeData\n | NumberPropTypeData\n | OptionsPropTypeData\n | FunctionPropTypeData\n | CustomTypeScriptPropTypeData\n | ObjectPropTypeData\n | ArrayOfObjectsPropTypeData\n | ArrayOfStringsPropTypeData\n | ArrayOfNumbersPropTypeData;\n\nexport type JsonSchemaObject<PropNames extends string = string> = {\n $schema?: string;\n title?: string;\n description?: string;\n type: 'object';\n required?: PropNames[];\n properties: Record<PropNames, PropertyTypes>;\n examples?: Record<string, unknown>[];\n};\n","import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n","import type { KnapsackPatternTemplate, TemplateDemo } from './app-client-data';\n\nexport const rendererIds = {\n react: 'react',\n vue: 'vue',\n 'web-components': 'web-components',\n twig: 'twig',\n hbs: 'hbs',\n angular: 'angular',\n html: 'html',\n} as const;\n\n/**\n * The ID of a renderer, e.g. 'react', 'vue', 'angular', etc.\n * On Pattern Templates, this will match up to `templateLanguageId` to identify which renderer to use.\n * @see {KnapsackPatternTemplate['templateLanguageId']}\n */\nexport type RendererId = keyof typeof rendererIds;\n/**\n * Results of rendering a pattern\n */\nexport type KsRenderResults = {\n ok: boolean;\n html: string;\n usage?: string;\n templateLanguage?: string;\n message?: string;\n};\n\nexport type KsRenderApiResults = KsRenderResults & {\n wrappedHtml: string;\n};\nexport type TemplateSuggestion = {\n path: string;\n alias?: string;\n};\n\nexport type TemplateSuggestionsGetFn = (opt: {\n rendererId: RendererId;\n newPath?: string;\n state: ContentStateForRendering;\n}) => Promise<{\n suggestions: TemplateSuggestion[];\n}>;\n\n/**\n * Aliases for package paths\n * Example:\n * ```js\n * {\n * 'my-pkg': '../path/to/my-pkg',\n * }\n * ```\n */\nexport type PkgPathAliases = Record<string, string>;\n\nexport type ContentStateForRendering = {\n /**\n * Patterns by ID\n */\n patterns: {\n [patternId: string]: {\n id: string;\n templates: Pick<\n KnapsackPatternTemplate,\n 'alias' | 'path' | 'templateLanguageId' | 'spec' | 'id' | 'title'\n >[];\n templateDemos: Array<\n TemplateDemo & {\n templateId: string;\n templateLanguageId: RendererId;\n }\n >;\n };\n };\n};\n","import type { FeedbackTypes } from './misc';\n\nexport enum KsRendererClientEvents {\n ready = 'ready',\n}\n\n/**\n * Message sent from the renderer client (in the iframe) to the App UI parent window\n * using `window.parent.postMessage()`.\n * Note that this likely will become a union type of all possible messages\n */\nexport type KsRendererClientMsg =\n | {\n /**\n * Sent when a `ResizeObserver` detects a change in the contents height or width.\n */\n type: 'ksRendererClient.contentResized';\n height: number;\n width: number;\n }\n | {\n type: 'ksRendererClient.showToast';\n msg: string;\n feedbackType?: FeedbackTypes;\n };\n\n/**\n * The meta data is stored in a script tag with this id\n * @see {KsRendererClientMeta}\n */\nexport const ksRendererClientMetaId = 'ks-meta';\n\n/**\n * Metadata about the current renderer client demo\n * @see {ksRendererClientMetaId} for the ID of the script tag\n */\nexport interface KsRendererClientMeta {\n patternId: string;\n templateId: string;\n demoId: string;\n assetSetId: string;\n isInIframe: boolean;\n websocketsPort: number;\n}\n","export const WS_EVENTS = {\n PATTERN_TEMPLATE_CHANGED: 'PATTERN_TEMPLATE_CHANGED',\n PATTERN_ASSET_CHANGED: 'PATTERN_ASSET_CHANGED',\n DESIGN_TOKENS_CHANGED: 'DESIGN_TOKENS_CHANGED',\n RENDERER_CLIENT_RELOAD: 'RENDERER_CLIENT_RELOAD',\n APP_CLIENT_DATA_CHANGED: 'APP_CLIENT_DATA_CHANGED',\n};\n\nexport type WebSocketEvent = keyof typeof WS_EVENTS;\n\nexport interface WebSocketMessage {\n event: string;\n data: Record<string, unknown>;\n}\n\nexport interface DesignTokensChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.DESIGN_TOKENS_CHANGED;\n data: Record<string, unknown>;\n}\n\nexport interface PatternChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_TEMPLATE_CHANGED;\n data: {\n /**\n * Absolute path to template on server that was just edited\n */\n path: string;\n };\n}\n\nexport interface AssetChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_ASSET_CHANGED;\n data: {\n /**\n * Absolute path to asset file (CSS/JS) on server that was just edited\n */\n path: string;\n };\n}\n\nexport interface RendererClientReloadMessage extends WebSocketMessage {\n event: typeof WS_EVENTS.RENDERER_CLIENT_RELOAD;\n data: {\n // @todo add patternId etc for more details\n };\n}\n\nexport interface AppClientDataChanged extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_TEMPLATE_CHANGED;\n data: Record<string, unknown>;\n}\n\nexport type WebSocketMessages =\n | PatternChangedData\n | AssetChangedData\n | DesignTokensChangedData\n | RendererClientReloadMessage;\n","export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha: string;\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n","/**\n * The roles here are duplicates of the roles in the database.\n * It needs to be here, in the types package, so it can be used in all packages.\n * If we pull it in from `@knapsack/hasura-gql-client`, which is the source, we get a dependency cycle. So we do it this way.\n * If the roles change in the database, we need to change them here too. We will get a build error if we don't (see code in `@knapsack/hasura-gql-client`).\n */\n\nexport const rolesById = {\n ADMIN: 'ADMIN',\n ANONYMOUS: 'ANONYMOUS',\n CONTRIBUTOR: 'CONTRIBUTOR',\n EDITOR: 'EDITOR',\n MANAGER: 'MANAGER',\n VIEWER: 'VIEWER',\n} as const;\nexport const roles = Object.values(rolesById);\nexport type Role = keyof typeof rolesById;\n"]}
1
+ {"version":3,"sources":["../src/ui-config.ts","../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts","../src/app-client-data/blocks.ts","../src/app-client-data/design-tokens.ts","../src/app-client-data/design-tokens-types/token-definitions.ts","../src/app-client-data/design-tokens-types/token-data.ts","../src/app-client-data/design-tokens-types/token-src-value-info.ts","../src/app-client-data/design-tokens-types/token-src.ts","../src/app-client-data/design-tokens-types/token-utils.ts","../src/app-client-data/patterns.ts","../src/app-client-data/page.header.ts","../src/app-client-data/index.ts","../src/app-client-data-v3/index.ts","../src/app-client-data-migrations/4.1.7-demos.ts","../src/app-client-data-migrations/index.ts","../src/json-schema.ts","../src/changes.ts","../src/renderers.ts","../src/renderer-client-types.ts","../src/web-sockets.ts","../src/git-providers.ts","../src/api/plugins.ts","../src/api/files.ts","../src/user-roles.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct","HeadingLevels","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceSourceFormats","FontFaceFormatsEnumStruct","FontFaceSourceStruct","FontFaceConfigStruct","optional","size","array","TextTransforms","FontStretches","TypographyLinkConfigStruct","boolean","FontSizeConfigStruct","TypographyConfigStruct","pageElementConfig","pageLinkElementConfig","pageElements","pageElementsV2","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements","UiConfigV1Struct","UiConfigV2Struct","UiConfigV3Struct","UiConfigV4Struct","defaulted","UiConfigV5Struct","UiConfigV6Struct","UiConfigV7Struct","UiConfigV8Struct","UiConfigV9Struct","UiConfigV10Struct","UiConfigStruct","BlockSizes","BlockSpacings","tokenNameDisplayFormats","strokeStyleValues","isTokenReference","val","hasTokenReferences","isNotTokenReference","TokenReferenceStruct","ke","compositeTypesRecord","tokenTypeComposites","singularTypesRecord","tokenTypeSingulars","isTokenTypeComposite","isTokenTypeSingular","expectType","TokenDataBaseStruct","t","isTokenDataComposite","tokenData","isTokenValueColor","TokenValueColorStruct","TokenDataColorNonRefStruct","TokenDataColorRefStruct","isTokenValueDimension","TokenValueDimensionStruct","TokenDataDimensionNonRefStruct","TokenDataDimensionRefStruct","isTokenValueDuration","TokenValueDurationStruct","TokenDataDurationNonRefStruct","TokenDataDurationRefStruct","isTokenValueFontWeight","TokenValueFontWeightStruct","TokenDataFontWeightNonRefStruct","TokenDataFontWeightRefStruct","TokenValueCubicBezierStruct","v","TokenDataCubicBezierNonRefStruct","TokenDataCubicBezierRefStruct","isTokenValueShadow","isObject","TokenValueShadowStruct","TokenDataShadowNonRefStruct","TokenDataShadowRefStruct","TokenValueStrokeStyleStruct","isTokenValueBorder","TokenValueBorderStruct","TokenDataBorderNonRefStruct","TokenDataBorderRefStruct","isTokenValueTransition","TokenValueTransitionStruct","TokenDataTransitionNonRefStruct","TokenDataTransitionRefStruct","TokenDataStringNonRefStruct","TokenDataStringRefStruct","TokenDataStrokeStyleNonRefStruct","TokenDataStrokeStyleRefStruct","TokenDataNumberNonRefStruct","TokenDataNumberRefStruct","TokenDataBooleanNonRefStruct","TokenDataBooleanRefStruct","assertTokenData","data","isObjKey","kind","error","isTokenSrcValueInfoSingular","tokenSrcValueInfo","isTokenSrcValueInfoComposite","isTokenSrcExtensions","extensionsObj","isTokenSrc","tokenObject","isTokenGroup","isTokenTypeVarRef","varRefCollectionInfo","getPrimitiveValue","tokenValue","isDimensionString","parseTokenDimensionValue","valueToParse","unit","parseNumberWithUnit","isSlottedText","slottedData","isSlottedTemplateDemo","isSlottedTemplateReference","StageLayouts","isDataDemo","demo","isTemplateDemo","PageHeaderSizes","isKsAppClientDataNoMeta","key","KsAppClientDataNoMetaStruct","isKsAppClientDataAndMeta","KsAppClientDataAndMetaStruct","KsMetaStateStruct","isKsMetaState","isKsAppClientDataNoMetaV3","KsAppClientDataNoMetaStructV3","isKsAppClientDataAndMetaV3","KsAppClientDataAndMetaStructV3","KsMetaStateStructV3","isKsMetaStateV3","migration417Demos","appClientData","isDraft","pattern","slotName","slotData","pId","templates","tId","demoIds","migrations","PropTypeNames","isStringProp","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp","PatchStructRuntime","s","PatchStruct","isPatch","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes","rendererIds","KsRendererClientEvents","ksRendererClientMetaId","WS_EVENTS","GitProviderType","MergeableState","RestActions","TextEncoding","plugins_exports","__export","ACTIONS","endpoint","files_exports","rolesById","roles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CCIA,SAASA,EAAAA,CAAQC,CAAiC,CAAA,CAChD,GAAI,OAAOA,CAAU,EAAA,QAAA,CAAU,OAAO,CAAA,CAAA,CACtC,GAAI,CACF,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A,EAAA,EAAA,EAAA,CAAA,KCGCG,EAAY,CAAA,CACvB,KAAO,CAAA,OAAA,CACP,SAAW,CAAA,WAAA,CACX,WAAa,CAAA,aAAA,CACb,OAAQ,QACR,CAAA,OAAA,CAAS,SACT,CAAA,MAAA,CAAQ,QACV,CAAA,CACaC,EAAQ,CAAA,MAAA,CAAO,OAAOD,EAAS","file":"index.js","sourcesContent":["import {\n type,\n Describe,\n literal,\n optional,\n defaulted,\n boolean,\n array,\n object,\n} from 'superstruct';\n\nimport { ExpandRecursively } from '@knapsack/utils';\n\nimport {\n ColorConfig,\n ColorConfigStruct,\n ColorStringStruct,\n} from './color-config';\n\nimport {\n FontFaceConfigStruct,\n FontFaceConfig,\n TypographyConfigStruct,\n TypographyLinkConfigStruct,\n pageElements,\n pageElementsV2,\n} from './typography-config';\n\nimport {\n customizableNavElements,\n NavCustomizationConfigStruct,\n PrimaryNavCustomizationConfigStruct,\n SecondaryNavCustomizationConfigStruct,\n} from './nav-customization-config';\n\nexport type UiConfigV1 = {\n version: 1;\n oldSillySidebarBgColor: string;\n};\n\nexport const UiConfigV1Struct: Describe<UiConfigV1> = object({\n version: literal(1),\n oldSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV2 = {\n version: 2;\n anotherSillySidebarBgColor: string;\n};\n\nexport const UiConfigV2Struct: Describe<UiConfigV2> = object({\n version: literal(2),\n anotherSillySidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV3 = {\n version: 3;\n sidebarBgColor: string;\n};\n\nexport const UiConfigV3Struct: Describe<UiConfigV3> = object({\n version: literal(3),\n sidebarBgColor: ColorStringStruct,\n});\n\nexport type UiConfigV4 = {\n version: 4;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n enableSidebarIcons?: boolean;\n};\nexport const UiConfigV4Struct: Describe<UiConfigV4> = object({\n version: literal(4),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport type UiConfigV5 = {\n version: 5;\n primaryColor: ColorConfig;\n darkColor: ColorConfig;\n lightColor: ColorConfig;\n linkColor: ColorConfig;\n enableSidebarIcons: boolean;\n};\nexport const UiConfigV5Struct: Describe<UiConfigV5> = object({\n version: literal(5),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n});\n\nexport interface _UiConfigV6 extends Omit<UiConfigV5, 'version'> {\n version: 6;\n appearance: {\n customFonts?: FontFaceConfig[];\n pageElements: typeof pageElements;\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfigV6' is not assignable to type 'Record<string, unknown>'.\" error\nexport type UiConfigV6 = ExpandRecursively<_UiConfigV6>;\n\nexport const UiConfigV6Struct: Describe<UiConfigV6> = object({\n version: literal(6),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV7 extends Omit<UiConfigV6, 'version'> {\n version: 7;\n appearance: {\n navigation?: typeof customizableNavElements;\n customFonts?: UiConfigV6['appearance']['customFonts'];\n pageElements: UiConfigV6['appearance']['pageElements'];\n };\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig7' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\nexport type UiConfigV7 = ExpandRecursively<_UiConfigV7>;\n\nexport const UiConfigV7Struct: Describe<UiConfigV7> = object({\n version: literal(7),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n enableSidebarIcons: optional(defaulted(boolean(), true)),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV8\n extends Omit<UiConfigV7, 'version' | 'enableSidebarIcons'> {\n version: 8;\n}\n\n// ExpandRecursively needed to avoid \"Type 'UiConfig8' is not assignable to type 'Record<string, unknown>'.\" error in ui-config.xstate.ts\n// TODO: move this to @knapsack/types\nexport type UiConfigV8 = ExpandRecursively<_UiConfigV8>;\n\nexport const UiConfigV8Struct: Describe<UiConfigV8> = object({\n version: literal(8),\n primaryColor: ColorConfigStruct,\n darkColor: ColorConfigStruct,\n lightColor: ColorConfigStruct,\n linkColor: ColorConfigStruct,\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV9\n extends Omit<\n UiConfigV8,\n 'version' | 'primaryColor' | 'darkColor' | 'lightColor' | 'linkColor'\n > {\n version: 9;\n}\nexport type UiConfigV9 = ExpandRecursively<_UiConfigV9>;\n\nexport const UiConfigV9Struct: Describe<UiConfigV9> = object({\n version: literal(9),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport interface _UiConfigV10 extends Omit<UiConfigV9, 'version'> {\n version: 10;\n appearance: {\n navigation?: UiConfigV9['appearance']['navigation'];\n customFonts?: UiConfigV9['appearance']['customFonts'];\n pageElements: typeof pageElementsV2;\n };\n}\nexport type UiConfigV10 = ExpandRecursively<_UiConfigV10>;\n\nexport const UiConfigV10Struct: Describe<UiConfigV10> = object({\n version: literal(10),\n\n appearance: type({\n customFonts: optional(array(FontFaceConfigStruct)),\n navigation: optional(\n type({\n primaryNav: optional(PrimaryNavCustomizationConfigStruct),\n secondaryNav: optional(SecondaryNavCustomizationConfigStruct),\n tabs: optional(NavCustomizationConfigStruct),\n }),\n ),\n pageElements: type({\n pageTitle: optional(TypographyConfigStruct),\n pageDescription: optional(TypographyConfigStruct),\n headingXLarge: optional(TypographyConfigStruct),\n headingLarge: optional(TypographyConfigStruct),\n headingMedium: optional(TypographyConfigStruct),\n headingSmall: optional(TypographyConfigStruct),\n headingXSmall: optional(TypographyConfigStruct),\n bodyText: optional(TypographyConfigStruct),\n link: optional(TypographyLinkConfigStruct),\n }),\n }),\n});\n\nexport type UiConfigVersions =\n | typeof UiConfigV1Struct.TYPE\n | typeof UiConfigV2Struct.TYPE\n | typeof UiConfigV3Struct.TYPE\n | typeof UiConfigV4Struct.TYPE\n | typeof UiConfigV5Struct.TYPE\n | typeof UiConfigV6Struct.TYPE\n | typeof UiConfigV7Struct.TYPE\n | typeof UiConfigV8Struct.TYPE\n | typeof UiConfigV9Struct.TYPE\n | typeof UiConfigV10Struct.TYPE;\n\n// ALIASES FOR LATEST VERSIONS\nexport type UiConfig = UiConfigV10;\nexport const UiConfigStruct: typeof UiConfigV10Struct = UiConfigV10Struct;\n\nexport type NavElementNames = keyof UiConfig['appearance']['navigation'];\n","import colorString from 'color-string';\nimport { define, Describe, literal, string, type, union } from 'superstruct'; // https://docs.superstructjs.org\n\n/** Use `import { isColor } from '@knapsack/color-utils'` if you can, need to duplicate this logic due to dep cycle */\nfunction isColor(color: unknown): color is string {\n if (typeof color !== 'string') return false;\n try {\n return !!colorString.get(color);\n } catch (e) {\n return false;\n }\n}\n\nexport type ColorTokenConfig = {\n type: 'design-token';\n /** Will be **either** `-` (old) or `.` (new) separated */\n tokenName: string;\n};\nexport type ColorConfig =\n | { type: 'value'; colorValue: string }\n | ColorTokenConfig;\n\nexport const ColorStringStruct = define<string>(\n 'ColorStringStruct',\n (value) => typeof value === 'string' && isColor(value),\n);\n\nexport const ColorConfigStruct: Describe<ColorConfig> = union([\n type({\n type: literal('value'),\n colorValue: ColorStringStruct,\n }),\n type({\n type: literal('design-token'),\n tokenName: string(),\n }),\n]);\n\n// so we can check if an object is not just a ColorConfig but specifically a token\nexport const ColorTokenConfigStruct: Describe<ColorTokenConfig> = type({\n type: literal('design-token'),\n tokenName: string(),\n});\n","import {\n Describe,\n string,\n type,\n union,\n number,\n enums,\n optional,\n literal,\n array,\n size,\n boolean,\n object,\n} from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\n\nexport const HeadingLevels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nexport type HeadingLevel = (typeof HeadingLevels)[number];\n\nexport type FontSizeConfigVal = {\n unit: 'px' | 'rem';\n value: number;\n};\n\nexport const FontSizeConfigValStruct: Describe<FontSizeConfigVal> = object({\n unit: enums(['rem', 'px']),\n value: number(),\n});\n\nexport type FontFaceWeight = number | string;\n\nexport const FontFaceWeightStruct: Describe<FontFaceWeight> = union([\n string(),\n number(),\n]);\n\nexport enum FontFaceSourceFormats {\n woff2 = 'woff2',\n woff = 'woff',\n}\n\nexport type FontFaceSource = {\n /**\n * Note: if /when we eventually add 'local' type support, format isn't used!\n */\n format: keyof typeof FontFaceSourceFormats;\n type: 'url';\n path: string;\n};\n\nexport const FontFaceFormatsEnumStruct = enums(['woff2', 'woff']);\n\nexport const FontFaceSourceStruct: Describe<FontFaceSource> = type({\n format: FontFaceFormatsEnumStruct,\n type: literal('url'),\n path: string(),\n});\n\nexport type FontFaceConfig = {\n /**\n * registered name of the custom font\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-family @font-face's font-family property}\n */\n family?: string;\n\n /**\n * number between 1 and 1000.\n *\n * note: since two weights are allowed (with variable fonts), this type is an\n * optional array for easy parsing down the road.\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight @font-face's font-weight property}.\n */\n weight?: FontFaceWeight | FontFaceWeight[];\n\n /**\n * the collection of urls / paths pointing to font files\n *\n * MDN Docs on {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src @font-face's src property}.\n */\n src?: FontFaceSource[];\n\n /**\n * the style of the custom font (ex. normal or italic)\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-style See MDN docs on font-style}.\n */\n style?: string;\n\n // @todo: implement these later\n // display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';\n // variationSettings?: string;\n // unicodeRange?: string; // or ideally, URange; //\n // see https://drafts.csswg.org/css-syntax-3/#urange-syntax and\n // https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range\n};\n\nexport const FontFaceConfigStruct: Describe<FontFaceConfig> = type({\n family: optional(string()),\n weight: optional(\n union([FontFaceWeightStruct, size(array(FontFaceWeightStruct), 2)]),\n ),\n src: optional(array(FontFaceSourceStruct)),\n style: optional(string()),\n display: optional(enums(['auto', 'block', 'swap', 'fallback', 'optional'])),\n variationSettings: optional(string()),\n unicodeRange: optional(string()),\n});\n\nexport type FontSizeConfig = {\n min: FontSizeConfigVal;\n max?: FontSizeConfigVal;\n};\n\nexport enum TextTransforms {\n inherit = 'As typed',\n capitalize = 'Capitalize',\n lowercase = 'Lowercase',\n uppercase = 'Uppercase',\n}\n\nexport enum FontStretches {\n 'ultra-condensed' = 'Ultra-condensed',\n 'extra-condensed' = 'Extra-condensed',\n condensed = 'Condensed',\n 'semi-condensed' = 'Semi-condensed',\n normal = 'Normal',\n 'semi-expanded' = 'Semi-expanded',\n expanded = 'Expanded',\n 'extra-expanded' = 'Extra-expanded',\n 'ultra-expanded' = 'Ultra-expanded',\n}\n\nexport type TypographyConfig = {\n /**\n * min / max height used to future-proof way of supporting responsive typography\n */\n fontSize?: FontSizeConfig;\n\n /**\n * reminder: line-heights can also be unitless!\n */\n lineHeight?: string | number;\n fontWeight?: FontFaceWeight;\n\n /**\n * note: letter-spacing can't be unitless, unit required!\n */\n letterSpacing?: string;\n\n /**\n * if not specified, Knapsack default font, otherwise should allow for a stack of font strings + fallbacks (including the names of custom registered fonts)\n */\n fontFamily?: string;\n\n textColor?: ColorConfig;\n\n textTransform?: keyof typeof TextTransforms;\n\n fontStretch?: keyof typeof FontStretches;\n};\n\nexport interface TypographyLinkConfig {\n fontWeight?: FontFaceWeight;\n textColor?: ColorConfig;\n hoverColor?: ColorConfig;\n underline?: boolean;\n textTransform?: keyof typeof TextTransforms;\n fontStretch?: keyof typeof FontStretches;\n}\n\nexport const TypographyLinkConfigStruct: Describe<TypographyLinkConfig> = type({\n fontWeight: optional(union([string(), number()])),\n textColor: optional(ColorConfigStruct),\n hoverColor: optional(ColorConfigStruct),\n underline: optional(boolean()),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nexport const FontSizeConfigStruct: Describe<FontSizeConfig> = type({\n min: FontSizeConfigValStruct,\n max: optional(FontSizeConfigValStruct),\n});\n\nexport const TypographyConfigStruct: Describe<TypographyConfig> = type({\n fontSize: optional(FontSizeConfigStruct),\n lineHeight: optional(union([string(), number()])),\n fontWeight: optional(union([string(), number()])),\n letterSpacing: optional(string()),\n fontFamily: optional(string()),\n textColor: optional(ColorConfigStruct),\n textTransform: optional(\n enums(['inherit', 'capitalize', 'lowercase', 'uppercase']),\n ),\n fontStretch: optional(\n enums([\n 'ultra-condensed',\n 'extra-condensed',\n 'condensed',\n 'semi-condensed',\n 'normal',\n 'semi-expanded',\n 'expanded',\n 'extra-expanded',\n 'ultra-expanded',\n ]),\n ),\n});\n\nconst pageElementConfig: TypographyConfig = {};\nconst pageLinkElementConfig: TypographyLinkConfig = {};\n\nexport const pageElements = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport const pageElementsV2 = {\n pageTitle: pageElementConfig,\n pageDescription: pageElementConfig,\n headingXLarge: pageElementConfig,\n headingLarge: pageElementConfig,\n headingMedium: pageElementConfig,\n headingSmall: pageElementConfig,\n headingXSmall: pageElementConfig,\n bodyText: pageElementConfig,\n link: pageLinkElementConfig,\n} as const;\n\nexport type PageElementNames = keyof typeof pageElementsV2;\nexport type PageElementConfig = (typeof pageElementsV2)[PageElementNames];\n","import { Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { ColorConfig, ColorConfigStruct } from './color-config';\nimport { TypographyConfig, TypographyConfigStruct } from './typography-config';\n\nexport interface NavCustomizationConfig extends TypographyConfig {\n accentColor?: ColorConfig;\n}\n\nexport interface PrimaryNavCustomizationConfig extends NavCustomizationConfig {\n hoverColor?: ColorConfig;\n backgroundColor?: ColorConfig;\n}\n\nexport type SecondaryNavCustomizationConfig = Omit<\n PrimaryNavCustomizationConfig,\n 'hoverColor'\n>;\n\nexport const NavCustomizationConfigStruct: Describe<NavCustomizationConfig> =\n union([\n TypographyConfigStruct,\n type({\n accentColor: optional(ColorConfigStruct),\n }),\n ]);\n\n// hoverColor: optional(ColorConfigStruct),\nexport const PrimaryNavCustomizationConfigStruct: Describe<PrimaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n hoverColor: optional(ColorConfigStruct),\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nexport const SecondaryNavCustomizationConfigStruct: Describe<SecondaryNavCustomizationConfig> =\n union([\n NavCustomizationConfigStruct,\n type({\n backgroundColor: optional(ColorConfigStruct),\n }),\n ]);\n\nconst navCustomizationConfig: NavCustomizationConfig = {};\nconst secondaryNavCustomizationConfig: SecondaryNavCustomizationConfig = {};\nconst primaryNavCustomizationConfig: PrimaryNavCustomizationConfig = {};\n\nexport const customizableNavElements = {\n primaryNav: primaryNavCustomizationConfig,\n secondaryNav: secondaryNavCustomizationConfig,\n tabs: navCustomizationConfig,\n} as const;\n\nexport type CustomizableNavElementNames = keyof typeof customizableNavElements;\nexport type CustomizableNavElementConfig =\n (typeof customizableNavElements)[CustomizableNavElementNames];\n","import type { JSONContent } from '@tiptap/core';\nimport { TokenType } from './design-tokens-types';\n\nexport const BlockSizes = ['large', 'medium', 'small'] as const;\ntype BlockSize = (typeof BlockSizes)[number];\n\nexport const BlockSpacings = ['large', 'medium', 'small'] as const;\ntype BlockSpacing = (typeof BlockSpacings)[number];\n\nexport type BlockHeader = {\n showHeader?: boolean;\n title?: string;\n description?: string;\n};\n\n/**\n * Data for blocks made using the `createEmbedBlock` function\n */\ntype IframeBlockData = {\n url?: string;\n clickToInteract: boolean;\n height?: number | string;\n};\n\ntype BlockConfigBase<\n BlockType extends string,\n Data extends Record<string, unknown> = never,\n> = {\n // Unique across all blocks, basically a UUID upon creation\n // e.g. `ut79D2X_H`\n id: string;\n // Match this to a Slices `id` to use it\n blockType: BlockType;\n data: Data;\n header?: BlockHeader;\n size?: BlockSize;\n /** Controls the amount of spacing AFTER a block */\n spacing?: BlockSpacing;\n};\n\ntype BlockConfigUnion =\n | BlockConfigBase<\n 'component-spec-block',\n {\n patternId?: string;\n templateId?: string;\n collapsible?: boolean;\n expanded?: boolean;\n }\n >\n | BlockConfigBase<\n 'pattern-template-block',\n {\n patternId?: string;\n templateId?: string;\n demoId?: string;\n /** @deprecated */\n demoSize?: string;\n showSchemaForm?: boolean;\n showCodeSnippet?: boolean;\n hideControls?: boolean;\n allowResizing?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-src-tiles',\n {\n columns?: '4' | '3' | '2' | '1';\n imageStyles?: {\n align?: 'left' | 'right' | 'center';\n background?: 'dark' | 'light';\n corners?: 'square' | 'rounded';\n fit?: 'contain' | 'fill';\n seamless?: boolean;\n size?: 'auto' | 'small' | 'medium' | 'large' | 'xsmall' | 'xlarge';\n };\n items: {\n description?: JSONContent;\n fileId: string;\n nodeId: string;\n title?: string;\n }[];\n layout?: 'grid' | 'list';\n hideComponentProps?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-src-component',\n {\n fileId: string;\n componentId: string;\n contents: Array<'variants' | 'spec' | 'usage'>;\n styles?: {\n columns?: '4' | '3' | '2' | '1';\n image?: {\n align?: 'left' | 'right' | 'center';\n background?: 'dark' | 'light';\n corners?: 'square' | 'rounded';\n size?: 'auto' | 'small' | 'medium' | 'large' | 'xsmall' | 'xlarge';\n };\n layout?: 'grid' | 'list';\n };\n hideComponentProps?: boolean;\n hideComponentTitles?: boolean;\n }\n >\n | BlockConfigBase<\n 'text-editor',\n {\n autoFocus?: boolean;\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'files-list',\n {\n files: string[];\n }\n >\n | BlockConfigBase<\n 'callout',\n {\n type: 'error' | 'info' | 'success' | 'warning';\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'code-snippet',\n {\n content: JSONContent;\n }\n >\n | BlockConfigBase<'divider-block', Record<string, never>>\n | BlockConfigBase<\n 'guidelines',\n {\n guidelines: {\n id: string;\n image?: {\n src: string;\n title?: string;\n alt?: string;\n };\n imageFit?: 'contain' | 'cover';\n type: 'caution' | 'do' | 'dont';\n content?: JSONContent;\n }[];\n gridStyles?: {\n centered?: boolean;\n columns?: '4' | '3' | '2' | '1';\n };\n tileStyles?: {\n headerBeforeImage?: boolean;\n imageOutlined?: boolean;\n imageRounded?: boolean;\n imageSize?:\n | 'none'\n | 'small'\n | 'medium'\n | 'large'\n | 'xsmall'\n | 'xlarge';\n };\n }\n >\n | BlockConfigBase<\n 'image-block',\n {\n imageSize?: 'xs' | 's' | 'm' | 'l' | 'full';\n images?: {\n caption?: string;\n src: string;\n }[];\n }\n >\n | BlockConfigBase<\n 'shortcut-tiles',\n {\n shortcuts: {\n description?: string;\n id: string;\n image?: string;\n link: {\n external?: boolean;\n name?: string;\n path: string;\n };\n title: string;\n }[];\n gridStyles?: {\n columns?: '4' | '3' | '2' | '1';\n centered?: boolean;\n gapSize?: number;\n };\n tileStyles?: {\n imageSize?: 'none' | 'xsmall' | 'small' | 'medium' | 'large';\n outlined?: boolean;\n rounded?: boolean;\n titleSize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';\n };\n }\n >\n | BlockConfigBase<\n 'table',\n {\n content: JSONContent;\n }\n >\n | BlockConfigBase<\n 'pattern-variations',\n {\n patternId?: string;\n templateId?: string;\n demoId?: string;\n variationId?: string;\n assetSetId?: string;\n excludePropValue?: string;\n includePropValue?: string;\n size?: 's' | 'm' | 'l' | 'full';\n /** @deprecated */\n hideBlockTitle?: boolean;\n }\n >\n | BlockConfigBase<\n 'design-tokens',\n {\n tokenType: TokenType | '';\n demoId: string;\n groupIds: string[];\n exclude?: string;\n include?: string;\n }\n >\n | BlockConfigBase<\n 'design-token-collection',\n {\n collectionId: string;\n }\n >\n | BlockConfigBase<\n 'pattern-list-block',\n {\n itemSize?: 'small' | 'medium' | 'large' | 'full';\n showDescriptions?: boolean;\n excludePatterns?: string[];\n }\n >\n | BlockConfigBase<\n 'pattern-status-table-block',\n {\n excludeHiddenNavItems?: boolean;\n excludePatterns?: string[];\n }\n >\n | BlockConfigBase<\n 'video',\n {\n video: {\n format: string;\n name: string;\n size: string;\n url: string;\n };\n }\n >\n /** @deprecated */\n | BlockConfigBase<\n 'design-token-block',\n {\n tokens?: {\n type?: TokenType;\n category?: string;\n tags?: string[];\n name?: string;\n exclude?: string;\n };\n demo?: {\n id?: string;\n };\n }\n >\n | BlockConfigBase<'generic-iframe', IframeBlockData>\n | BlockConfigBase<'abstract-block', IframeBlockData>\n | BlockConfigBase<'adobe-xd-block', IframeBlockData>\n | BlockConfigBase<'airtable-block', IframeBlockData>\n | BlockConfigBase<'figma-block', IframeBlockData>\n | BlockConfigBase<'framer-cloud-block', IframeBlockData>\n | BlockConfigBase<'lucidchart-block', IframeBlockData>\n | BlockConfigBase<'vimeo-block', IframeBlockData>\n | BlockConfigBase<'youtube-block', IframeBlockData>\n | BlockConfigBase<'whimsical-block', IframeBlockData>\n | BlockConfigBase<\n 'markdown-block',\n {\n md?: string | string[];\n /** Automatically switches to edit mode + autofocuses on the editor */\n autoEdit?: boolean;\n columns?: number;\n }\n >;\n\n/**\n * This is the config for a block - which is what is stored in `block.ID.json` and available at `data.db.blocks.byId[blockId]`\n *\n * @example\n * // Use the first generic to filter down to a specific block type\n * type PatternListBlockConfig = BlockConfig<'pattern-list-block'>;\n * // Access the field `data` by doing this:\n * type Data= BlockConfig<'pattern-list-block'>['data'];\n */\nexport type BlockConfig<\n BlockType extends BlockConfigUnion['blockType'] = BlockConfigUnion['blockType'],\n> = Extract<BlockConfigUnion, { blockType: BlockType }>;\n\n/** Block Collections can be in several locations */\nexport type BlockCollectionLocation =\n | {\n type: 'page';\n pageId: string;\n }\n /** Tab on Pattern Page */\n | {\n type: 'patternSubPage';\n patternId: string;\n subPageId: string;\n }\n /** At bottom of Pattern Template page (under Spec table) - least used location */\n | {\n type: 'patternTemplate';\n patternId: string;\n templateId: string;\n };\n","export const tokenNameDisplayFormats = {\n default: 'Default',\n android: 'Android',\n cssVar: 'CSS Var',\n json: 'JSON',\n less: 'Less',\n scss: 'SCSS',\n swift: 'Swift',\n} as const;\n\nexport type TokenNameDisplayFormat = keyof typeof tokenNameDisplayFormats;\n","import * as s from 'superstruct';\n\nexport const strokeStyleValues = [\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'outset',\n 'inset',\n] as const;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionSingular}\n */\ntype TokenDefinitionSingularRaw =\n | { type: 'string'; value: string }\n | { type: 'number'; value: number }\n | { type: 'boolean'; value: boolean }\n | { type: 'color'; value: string }\n | {\n type: 'strokeStyle';\n value: (typeof strokeStyleValues)[number];\n }\n | { type: 'dimension'; value: `${number}${'px' | 'rem' | 'em' | '%'}` }\n | { type: 'duration'; value: `${number}ms` }\n // | { type: 'fontFamily'; value: string | string[] }\n | {\n type: 'fontWeight';\n // @TODO: Include union of possible strings https://tr.designtokens.org/format/#font-weight\n value: string | number;\n }\n | { type: 'cubicBezier'; value: [number, number, number, number] };\n\n/**\n * Definitions for both singular (non-composite) tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinitionSingular<'dimension'>\n * ```\n */\nexport type TokenDefinitionSingular<\n TheTokenType extends TokenDefinitionSingularRaw['type'] = TokenDefinitionSingularRaw['type'],\n> = Extract<TokenDefinitionSingularRaw, { type: TheTokenType }>;\n\n/**\n * Don't use this one, use this instead:\n * @see {@link TokenDefinitionComposite}\n */\ntype TokenDefinitionCompositeRaw =\n | {\n type: 'border';\n value: {\n color: { type: 'color' };\n style: { type: 'strokeStyle' };\n width: { type: 'dimension' };\n };\n }\n | {\n type: 'shadow';\n value: {\n color: { type: 'color' };\n offsetX: { type: 'dimension' };\n offsetY: { type: 'dimension' };\n spread: { type: 'dimension' };\n blur: { type: 'dimension' };\n inset: { type: 'boolean' };\n };\n }\n | {\n type: 'transition';\n value: {\n duration: { type: 'duration' };\n delay: { type: 'duration' };\n timingFunction: { type: 'cubicBezier' };\n };\n };\n// | {\n// type: 'gradient';\n// value: {\n// color: { type: 'color' };\n// position: { type: 'dimension' };\n// }[];\n// };\n\n/**\n * Definitions for composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionShadow = TokenDefinitionComposite<'shadow'>\n * ```\n */\nexport type TokenDefinitionComposite<\n TheTokenType extends TokenDefinitionCompositeRaw['type'] = TokenDefinitionCompositeRaw['type'],\n> = Extract<TokenDefinitionCompositeRaw, { type: TheTokenType }>;\n\n/**\n * Definitions for both singular and composite tokens.\n * Use first generic param to get just that type.\n * @example\n * ```ts\n * type TokenDefinitionDimension = TokenDefinition<'dimension'>\n * ```\n */\nexport type TokenDefinition<\n TheTokenType extends\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'] =\n | TokenDefinitionComposite['type']\n | TokenDefinitionSingular['type'],\n> = Extract<\n TokenDefinitionComposite | TokenDefinitionSingular,\n { type: TheTokenType }\n>;\n\nexport type TokenReference = `{${string}}`;\n/** ensures there is no `{}` */\nexport type NotTokenReference<T> = T extends TokenReference ? never : T;\n\nexport function isTokenReference(val: unknown): val is TokenReference {\n if (typeof val !== 'string') return false;\n // total times `{` appears in `val`\n // Handle situation `{a.b} {c.d}`. Ensure count of `{` and `}` === 1. This\n // guarantees we ONLY support a single reference, ie `{a.b}`\n const totalOpenBrackets = val.split('{').length - 1;\n return totalOpenBrackets === 1 && val.startsWith('{') && val.endsWith('}');\n}\n\nexport function hasTokenReferences(val: unknown): boolean {\n return typeof val === 'string' && val.includes('{');\n}\n\nexport function isNotTokenReference<T>(\n value: T,\n): value is NotTokenReference<T> {\n return !isTokenReference(value);\n}\n\nexport const TokenReferenceStruct = s.define<TokenReference>(\n 'Token Reference',\n (value) => {\n if (typeof value !== 'string') return false;\n if (isNotTokenReference(value)) {\n return 'Must start and end with curly braces';\n }\n return true;\n },\n);\n\nexport type TokenType = TokenDefinition['type'];\nexport type TokenTypeComposite = TokenDefinitionComposite['type'];\nexport type TokenTypeSingular = TokenDefinitionSingular['type'];\nexport type TokenValueSingular = TokenDefinitionSingular['value'];\n\n// We make a Record to ensure we have *every* possible value\n// b/c TS will yell at us if a new one is added but isn't included here\n// then we make an array out of them, so we can be sure we have *every* possible value\nconst compositeTypesRecord: Record<TokenTypeComposite, TokenTypeComposite> = {\n border: 'border',\n shadow: 'shadow',\n transition: 'transition',\n};\nexport const tokenTypeComposites = Object.values(compositeTypesRecord);\nconst singularTypesRecord: Record<TokenTypeSingular, TokenTypeSingular> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n color: 'color',\n dimension: 'dimension',\n duration: 'duration',\n // fontFamily: 'fontFamily',\n fontWeight: 'fontWeight',\n strokeStyle: 'strokeStyle',\n cubicBezier: 'cubicBezier',\n};\nexport const tokenTypeSingulars = Object.values(singularTypesRecord);\n/**\n * @deprecated You probably want `isTokenDataComposite`\n * @see {isTokenDataComposite}\n */\nexport function isTokenTypeComposite(\n type: TokenType,\n): type is TokenTypeComposite {\n return tokenTypeComposites.includes(type as TokenTypeComposite);\n}\n\nexport function isTokenTypeSingular(\n type: TokenType,\n): type is TokenTypeSingular {\n return tokenTypeSingulars.includes(type as TokenTypeSingular);\n}\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport * as s from 'superstruct';\nimport {\n NotTokenReference,\n TokenDefinition,\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenReferenceStruct,\n TokenType,\n hasTokenReferences,\n isTokenTypeComposite,\n} from './token-definitions';\nimport { TokenKsExtensions, TokenOrder } from './token-misc';\nimport { TokenSrcValue } from './token-src';\n\n/** Used for tokens AND groups */\ntype TokenDataBothCommon = {\n id: string;\n description?: string;\n};\n\n// Shows what a fully de-referenced `value` of a composite token would be\ntype CreateDataValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: TokenDefinitionSingular<\n ValueObj[Key]['type']\n >['value'];\n};\n\nexpectType<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>[]\n>([\n {\n inset: false,\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n },\n {\n color: '#000',\n offsetX: '0px',\n offsetY: '0px',\n spread: '0px',\n blur: '0px',\n inset: true,\n },\n]);\n\ntype TokenDataCommon<\n Info extends {\n /** Basically the ID */\n type: TokenDefinition['type'];\n value: unknown;\n },\n> = TokenDataBothCommon & {\n type: Info['type'];\n value: Info['value'];\n /**\n * Extracted from `$extensions['cloud.knapsack'].token`\n */\n tokenConfig?: TokenKsExtensions['token'];\n /**\n * Tokens that are references by this token\n * @todo will need to change for shadow\n * @example\n * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n references?: Array<string[]>;\n /**\n * Tokens that use this as a reference token\n * @see {CreateTokenData.references}\n * @example\n * * ```\n * [\n * ['color.primary', 'color.secondary'],\n * ['spacing.medium']\n * ]\n * ```\n */\n // referencedBy?: Array<string[]>;\n};\n\ntype CreateTokenData<\n Info extends {\n type: TokenDefinition['type'];\n value: unknown;\n },\n> =\n | ({\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n originalValue: TokenReference;\n } & TokenDataCommon<Info>)\n | ({\n kind: 'static';\n originalValue: NotTokenReference<TokenSrcValue<Info['type']>>;\n } & TokenDataCommon<Info>);\n\nconst TokenDataBaseStruct: s.Describe<\n TokenDataBothCommon & {\n references?: Array<string[]>;\n tokenConfig?: TokenKsExtensions['token'];\n }\n> = s.type({\n id: s.string(),\n description: s.optional(s.string()),\n references: s.optional(s.array(s.array(s.string()))),\n tokenConfig: s.optional(\n s.type({\n purpose: s.optional(s.string()),\n }),\n ),\n});\n\ntype TokenDataSingularRaw = {\n // ignore the key, this makes a discriminated union out of the values\n [TokenDef in TokenDefinitionSingular as TokenDef['type']]: Simplify<\n CreateTokenData<TokenDef>\n >;\n}[TokenDefinitionSingular['type']];\n\nexport type TokenDataSingular<\n TT extends TokenDataSingularRaw['type'] = TokenDataSingularRaw['type'],\n> = Extract<TokenDataSingularRaw, { type: TT }>;\n\nexpectType<TokenDataSingular[]>([\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'static',\n },\n {\n type: 'duration',\n value: '1ms',\n kind: 'ref',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n originalValue: '1ms',\n id: '1',\n kind: 'ref',\n },\n // @ts-expect-error - kind is wrong\n {\n type: 'duration',\n value: '1ms',\n kind: 'static',\n id: '1',\n originalValue: '{a.b}',\n referencedTokenId: '1',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'static',\n id: '1',\n originalValue: '#000',\n },\n {\n type: 'color',\n value: '#000',\n kind: 'ref',\n id: '1',\n originalValue: '{c.b}',\n referencedTokenId: 'c.b',\n },\n {\n type: 'cubicBezier',\n kind: 'static',\n value: [0, 0, 0, 1],\n originalValue: [0, 0, 0, 1],\n id: '1',\n },\n]);\n\ntype TokenDataCompositeRaw = {\n [TokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenData<{\n type: TokenType;\n value: Simplify<\n CreateDataValueForComposite<\n TokenDefinitionComposite<TokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\nexport type TokenDataComposite<\n TheTokenType extends TokenDataCompositeRaw['type'] = TokenDataCompositeRaw['type'],\n> = Extract<TokenDataCompositeRaw, { type: TheTokenType }>;\n\nexport function isTokenDataComposite(\n tokenData: TokenData,\n): tokenData is TokenDataComposite {\n return isTokenTypeComposite(tokenData.type);\n}\n\nexpectType<TokenDataComposite[]>([\n {\n type: 'border',\n kind: 'static',\n id: '1',\n value: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n originalValue: {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n },\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n value: {\n color: 'red',\n style: 'dashed',\n width: '2px',\n },\n originalValue: '{a.b}',\n },\n {\n type: 'shadow',\n value: {\n color: '#000',\n offsetX: '1px',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n originalValue: {\n color: '#000',\n offsetX: '{a.a}',\n offsetY: '1px',\n blur: '1px',\n spread: '1px',\n inset: false,\n },\n id: '1',\n kind: 'static',\n },\n {\n type: 'shadow',\n kind: 'ref',\n referencedTokenId: 'a.b',\n value: {\n inset: true,\n color: 'red',\n offsetX: '1px',\n blur: '2px',\n offsetY: '3px',\n spread: '4px',\n },\n originalValue: '{a.b}',\n id: '1',\n },\n {\n type: 'transition',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: '{a.b}',\n kind: 'ref',\n referencedTokenId: 'a.b',\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '{a.c}',\n timingFunction: '{a.c}',\n },\n id: '1',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n originalValue: {\n duration: '100ms',\n delay: '200ms',\n timingFunction: [0, 0, 0, 0],\n },\n id: '1',\n },\n]);\n\nexport type TokenData<\n TheTokenType extends TokenDataSingular['type'] | TokenDataComposite['type'] =\n | TokenDataSingular['type']\n | TokenDataComposite['type'],\n> = Extract<TokenDataSingular | TokenDataComposite, { type: TheTokenType }>;\n\nexport type TokenGroupData = Simplify<\n {\n type?: TokenType;\n /**\n * Extracted from `$extensions['cloud.knapsack'].group`\n */\n groupConfig?: TokenKsExtensions['group'];\n children: TokenOrder;\n } & TokenDataBothCommon\n>;\n\n/**\n * @deprecated Use `TokenValueColorStruct` instead\n */\nexport function isTokenValueColor(\n value: unknown,\n): value is TokenDefinitionSingular<'color'>['value'] {\n return typeof value === 'string' && !hasTokenReferences(value);\n}\n\nexport const TokenValueColorStruct = s.define<TokenData<'color'>['value']>(\n 'Color Value',\n (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (value === '') {\n return 'Value must not be empty';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n },\n);\n\nconst TokenDataColorNonRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('static'),\n originalValue: TokenValueColorStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataColorRefStruct: s.Describe<\n Extract<TokenData<'color'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('color'),\n value: TokenValueColorStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDimensionStruct` instead\n */\nexport function isTokenValueDimension(\n value: unknown,\n): value is TokenDefinitionSingular<'dimension'>['value'] {\n return (\n typeof value === 'string' &&\n (value.endsWith('px') || value.endsWith('rem')) &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDimensionStruct = s.define<\n TokenData<'dimension'>['value']\n>('Dimension Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n if (\n !value.endsWith('px') &&\n !value.endsWith('rem') &&\n !value.endsWith('em') &&\n !value.endsWith('%')\n ) {\n return 'Value must end with px, rem, em or %';\n }\n return true;\n});\n\nconst TokenDataDimensionNonRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDimensionStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDimensionRefStruct: s.Describe<\n Extract<TokenData<'dimension'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('dimension'),\n value: TokenValueDimensionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueDurationStruct` instead\n */\nexport function isTokenValueDuration(\n value: unknown,\n): value is TokenDefinitionSingular<'duration'>['value'] {\n return (\n typeof value === 'string' &&\n value.endsWith('ms') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueDurationStruct = s.define<\n TokenData<'duration'>['value']\n>('Duration Value', (value) => {\n if (typeof value !== 'string') {\n return 'Value must be a string';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n\n const durationRegex = /^\\d+ms$/;\n if (!durationRegex.test(value)) {\n return 'Value must be a number followed by \"ms\" (e.g., \"100ms\")';\n }\n\n return true;\n});\n\nconst TokenDataDurationNonRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('static'),\n originalValue: TokenValueDurationStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataDurationRefStruct: s.Describe<\n Extract<TokenData<'duration'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('duration'),\n value: TokenValueDurationStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * @deprecated Use `TokenValueFontWeightStruct` instead\n */\nexport function isTokenValueFontWeight(\n value: unknown,\n): value is TokenDefinitionSingular<'fontWeight'>['value'] {\n return (\n (typeof value === 'string' || typeof value === 'number') &&\n !hasTokenReferences(value)\n );\n}\n\nexport const TokenValueFontWeightStruct = s.define<\n TokenData<'fontWeight'>['value']\n>('Font Weight Value', (value) => {\n if (typeof value !== 'string' && typeof value !== 'number') {\n return 'Value must be a string or number';\n }\n if (hasTokenReferences(value)) {\n return 'Value must not contain {} (token references)';\n }\n return true;\n});\n\nconst TokenDataFontWeightNonRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('static'),\n originalValue: TokenValueFontWeightStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataFontWeightRefStruct: s.Describe<\n Extract<TokenData<'fontWeight'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('fontWeight'),\n value: TokenValueFontWeightStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueCubicBezierStruct = s.define<\n TokenData<'cubicBezier'>['value']\n>('Cubic Bezier Value', (value) => {\n if (!Array.isArray(value)) {\n return 'Value must be an array';\n }\n if (value.length !== 4) {\n return 'Value must be an array of 4 numbers';\n }\n if (!value.every((v) => typeof v === 'number')) {\n return 'Value must be an array of 4 numbers';\n }\n // check if the first and third values are between 0 and 1\n // cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )\n if (value[0] < 0 || value[0] > 1 || value[2] < 0 || value[2] > 1) {\n return 'The first and third cubicBezier values must be between 0 and 1';\n }\n return true;\n});\n\nconst TokenDataCubicBezierNonRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('static'),\n originalValue: TokenValueCubicBezierStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataCubicBezierRefStruct: s.Describe<\n Extract<TokenData<'cubicBezier'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('cubicBezier'),\n value: TokenValueCubicBezierStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"shadow\" token value AND totally de-referenced\n */\nexport function isTokenValueShadow(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'shadow'>['value']>\n> {\n return (\n isObject(value) &&\n isTokenValueColor(value.color) &&\n isTokenValueDimension(value.offsetX) &&\n isTokenValueDimension(value.offsetY) &&\n isTokenValueDimension(value.blur) &&\n isTokenValueDimension(value.spread)\n );\n}\n\nconst TokenValueShadowStruct = s.define<TokenData<'shadow'>['value']>(\n 'Shadow Value',\n (value) => {\n if (isTokenValueShadow(value)) return true;\n return `Expected a shadow value, got ${JSON.stringify(value)}`;\n },\n);\n\nconst TokenDataShadowNonRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n offsetX: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n offsetY: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n blur: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n spread: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n inset: s.union([\n // marking this as optional b/c it could be `undefined` instead of `false`\n s.optional(s.boolean()),\n TokenReferenceStruct,\n ]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataShadowRefStruct: s.Describe<\n Extract<TokenData<'shadow'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('shadow'),\n value: TokenValueShadowStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nexport const TokenValueStrokeStyleStruct = s.union([\n s.literal('solid'),\n s.literal('dashed'),\n s.literal('dotted'),\n s.literal('double'),\n s.literal('groove'),\n s.literal('ridge'),\n s.literal('outset'),\n s.literal('inset'),\n]);\n\n/**\n * Determines if it's a \"border\" token value AND totally de-referenced\n */\nexport function isTokenValueBorder(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'border'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueColorStruct.is(value.color) &&\n TokenValueStrokeStyleStruct.is(value.style) &&\n TokenValueDimensionStruct.is(value.width)\n );\n}\n\nconst TokenValueBorderStruct = s.define<TokenData<'border'>['value']>(\n 'Border Value',\n isTokenValueBorder,\n);\n\nconst TokenDataBorderNonRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n color: s.union([TokenValueColorStruct, TokenReferenceStruct]),\n style: s.union([TokenValueStrokeStyleStruct, TokenReferenceStruct]),\n width: s.union([TokenValueDimensionStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBorderRefStruct: s.Describe<\n Extract<TokenData<'border'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('border'),\n value: TokenValueBorderStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n/**\n * Determines if it's a \"transition\" token value AND totally de-referenced\n */\nexport function isTokenValueTransition(\n value: unknown,\n): value is Simplify<\n CreateDataValueForComposite<TokenDefinitionComposite<'transition'>['value']>\n> {\n return (\n isObject(value) &&\n TokenValueCubicBezierStruct.is(value.timingFunction) &&\n TokenValueDurationStruct.is(value.duration) &&\n TokenValueDurationStruct.is(value.delay)\n );\n}\nconst TokenValueTransitionStruct = s.define<TokenData<'transition'>['value']>(\n 'Transition Value',\n isTokenValueTransition,\n);\n\nconst TokenDataTransitionNonRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('static'),\n originalValue: s.type({\n timingFunction: s.union([\n TokenValueCubicBezierStruct,\n TokenReferenceStruct,\n ]),\n duration: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n delay: s.union([TokenValueDurationStruct, TokenReferenceStruct]),\n }),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataTransitionRefStruct: s.Describe<\n Extract<TokenData<'transition'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('transition'),\n value: TokenValueTransitionStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringNonRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('static'),\n originalValue: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStringRefStruct: s.Describe<\n Extract<TokenData<'string'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('string'),\n value: s.string(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleNonRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('static'),\n originalValue: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataStrokeStyleRefStruct: s.Describe<\n Extract<TokenData<'strokeStyle'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('strokeStyle'),\n value: TokenValueStrokeStyleStruct,\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: TokenValueStrokeStyleStruct,\n }),\n TokenDataBaseStruct,\n);\n// const TokenDataFontFamilyNonRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'static' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('static'),\n// originalValue: s.union([s.string(), s.array(s.string())]),\n// }),\n// TokenDataBaseStruct,\n// );\n\n// const TokenDataFontFamilyRefStruct: s.Describe<\n// Extract<TokenData<'fontFamily'>, { kind: 'ref' }>\n// > = s.assign(\n// s.type({\n// type: s.literal('fontFamily'),\n// value: s.union([s.string(), s.array(s.string())]),\n// kind: s.literal('ref'),\n// originalValue: TokenReferenceStruct,\n// referencedTokenId: s.string(),\n// }),\n// TokenDataBaseStruct,\n// );\n\nconst TokenDataNumberNonRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('static'),\n originalValue: s.number(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataNumberRefStruct: s.Describe<\n Extract<TokenData<'number'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('number'),\n value: s.number(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanNonRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'static' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('static'),\n originalValue: s.boolean(),\n }),\n TokenDataBaseStruct,\n);\n\nconst TokenDataBooleanRefStruct: s.Describe<\n Extract<TokenData<'boolean'>, { kind: 'ref' }>\n> = s.assign(\n s.type({\n type: s.literal('boolean'),\n value: s.boolean(),\n kind: s.literal('ref'),\n originalValue: TokenReferenceStruct,\n referencedTokenId: s.string(),\n }),\n TokenDataBaseStruct,\n);\n\n// Instead of using `s.union` to combine all the token data structs,\n// we first find out what \"type\" the token is\n// then we find out `kind` - which is our 2nd layer of discriminated union\n// and then use the specific struct\n// that way the errors are more specific to the actual declared token \"type\"\n// In a nutshell, `s.union` is not very good at discriminated unions errors\nexport const assertTokenData = (data: unknown): asserts data is TokenData => {\n if (!isObject(data)) {\n throw new Error(\n `Expected token data to be an object, got ${JSON.stringify(data)}`,\n );\n }\n if (!isObjKey('type', data)) {\n throw new Error(\n `Expected token data to have a \"type\" property, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n if (typeof data.type !== 'string') {\n throw new Error(\n `Expected token data \"type\" property to be a string, got ${JSON.stringify(\n data,\n )}`,\n );\n }\n const type = data.type as TokenData['type'];\n const kind = data.kind as TokenData['kind'];\n try {\n switch (type) {\n case 'boolean':\n if (kind === 'ref') {\n TokenDataBooleanRefStruct.assert(data);\n } else {\n TokenDataBooleanNonRefStruct.assert(data);\n }\n return;\n case 'border':\n if (kind === 'ref') {\n TokenDataBorderRefStruct.assert(data);\n } else {\n TokenDataBorderNonRefStruct.assert(data);\n }\n return;\n case 'color':\n if (kind === 'ref') {\n TokenDataColorRefStruct.assert(data);\n } else {\n TokenDataColorNonRefStruct.assert(data);\n }\n return;\n case 'cubicBezier':\n if (kind === 'ref') {\n TokenDataCubicBezierRefStruct.assert(data);\n } else {\n TokenDataCubicBezierNonRefStruct.assert(data);\n }\n return;\n case 'dimension':\n if (kind === 'ref') {\n TokenDataDimensionRefStruct.assert(data);\n } else {\n TokenDataDimensionNonRefStruct.assert(data);\n }\n return;\n case 'duration':\n if (kind === 'ref') {\n TokenDataDurationRefStruct.assert(data);\n } else {\n TokenDataDurationNonRefStruct.assert(data);\n }\n return;\n case 'fontWeight':\n if (kind === 'ref') {\n TokenDataFontWeightRefStruct.assert(data);\n } else {\n TokenDataFontWeightNonRefStruct.assert(data);\n }\n return;\n case 'number':\n if (kind === 'ref') {\n TokenDataNumberRefStruct.assert(data);\n } else {\n TokenDataNumberNonRefStruct.assert(data);\n }\n return;\n case 'shadow':\n if (kind === 'ref') {\n TokenDataShadowRefStruct.assert(data);\n } else {\n TokenDataShadowNonRefStruct.assert(data);\n }\n return;\n case 'string':\n if (kind === 'ref') {\n TokenDataStringRefStruct.assert(data);\n } else {\n TokenDataStringNonRefStruct.assert(data);\n }\n return;\n case 'strokeStyle': // temp implementation\n if (kind === 'ref') {\n TokenDataStrokeStyleRefStruct.assert(data);\n } else {\n TokenDataStrokeStyleNonRefStruct.assert(data);\n }\n return;\n // case 'fontFamily':\n // if (kind === 'ref') {\n // TokenDataFontFamilyRefStruct.assert(data);\n // } else {\n // TokenDataFontFamilyNonRefStruct.assert(data);\n // }\n // return;\n case 'transition':\n if (kind === 'ref') {\n TokenDataTransitionRefStruct.assert(data);\n } else {\n TokenDataTransitionNonRefStruct.assert(data);\n }\n return;\n default: {\n const _exhaustiveCheck: never = type;\n throw new Error(`Unknown token data type: ${type}`);\n }\n }\n } catch (error) {\n if (!(error instanceof s.StructError)) throw error;\n throw new Error(\n `Invalid token data for type \"${type}\": ${\n error.message\n }. Received this data: \"${JSON.stringify(data)}\"`,\n );\n }\n};\n","import { Simplify, expectType } from '@knapsack/utils';\nimport {\n TokenType,\n TokenDefinitionSingular,\n TokenDefinitionComposite,\n isTokenTypeComposite,\n isTokenTypeSingular,\n} from './token-definitions';\n\ntype CreateTokenSrcValueInfo<\n T extends {\n type: TokenType;\n value: unknown;\n },\n> =\n | {\n kind: 'ref';\n /** Has `{}` removed */\n referencedTokenId: string;\n isVarRef?: boolean;\n type: T['type'];\n }\n | {\n kind: 'static';\n type: T['type'];\n value: T['value'];\n };\n\ntype TokenSrcValueInfoSingularRaw = {\n // Ignore the key, pay attention to the value\n // The values become the items in the discriminated union\n [TheTokenType in TokenDefinitionSingular as TheTokenType['type']]: Simplify<\n CreateTokenSrcValueInfo<TheTokenType>\n >;\n}[TokenDefinitionSingular['type']];\n\n// This helper allows us to just pass the type string in to get that\n// item out of the discriminated union: `TokenSrcValueInfoSingular<'color'>`\ntype TokenSrcValueInfoSingular<\n TT extends TokenSrcValueInfoSingularRaw['type'] = TokenSrcValueInfoSingularRaw['type'],\n> = Extract<TokenSrcValueInfoSingularRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoSingular<'dimension'>[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'dimension',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n]);\n\ntype CreateSrcValueInfoForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]: Simplify<\n CreateTokenSrcValueInfo<{\n type: ValueObj[Key]['type'];\n value: TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n }>\n >;\n};\n\ntype TokenSrcValueInfoCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<\n CreateTokenSrcValueInfo<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueInfoForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>\n >;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueInfoComposite<\n TT extends TokenSrcValueInfoCompositeRaw['type'] = TokenSrcValueInfoCompositeRaw['type'],\n> = Extract<TokenSrcValueInfoCompositeRaw, { type: TT }>;\n\nexpectType<TokenSrcValueInfoComposite<'border'>[]>([\n {\n type: 'border',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'border',\n kind: 'static',\n value: {\n color: {\n kind: 'static',\n type: 'color',\n value: 'red',\n },\n style: {\n kind: 'ref',\n type: 'strokeStyle',\n referencedTokenId: '', // FIX\n },\n width: {\n kind: 'static',\n type: 'dimension',\n value: '2px',\n },\n },\n },\n]);\n\nexpectType<TokenSrcValueInfoComposite<'transition'>[]>([\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\nexport type TokenSrcValueInfo<\n TT extends\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'] =\n | TokenSrcValueInfoComposite['type']\n | TokenSrcValueInfoSingular['type'],\n TheKind extends\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'] =\n | TokenSrcValueInfoComposite['kind']\n | TokenSrcValueInfoSingular['kind'],\n> = Extract<\n TokenSrcValueInfoComposite | TokenSrcValueInfoSingular,\n { type: TT; kind: TheKind }\n>;\n\nexport function isTokenSrcValueInfoSingular(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoSingular {\n return isTokenTypeSingular(tokenSrcValueInfo?.type);\n}\nexport function isTokenSrcValueInfoComposite(\n tokenSrcValueInfo: TokenSrcValueInfo,\n): tokenSrcValueInfo is TokenSrcValueInfoComposite {\n return isTokenTypeComposite(tokenSrcValueInfo?.type);\n}\n\nexpectType<TokenSrcValueInfo[]>([\n {\n type: 'dimension',\n kind: 'static',\n value: '1px',\n },\n {\n type: 'transition',\n kind: 'ref',\n referencedTokenId: 'a.b',\n },\n {\n type: 'transition',\n kind: 'ref',\n // @ts-expect-error - with `kind: 'ref'`, `value` is not allowed\n value: '1px',\n },\n {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n {\n type: 'transition',\n kind: 'static',\n value: {\n delay: {\n kind: 'static',\n type: 'duration',\n value: '1ms',\n },\n duration: {\n kind: 'ref',\n type: 'duration',\n referencedTokenId: 'animation.slow',\n },\n timingFunction: {\n kind: 'static',\n type: 'cubicBezier',\n value: [0.4, 0.0, 0.2, 1],\n },\n },\n },\n]);\n\n/**\n * A common object that is used to represent a token in the app.\n * Used in functions for editing communication between UI forms, Xstate,\n * and `@knapsack/design-tokens-utils`.\n */\nexport type TokenInfo<\n TheTokenType extends TokenSrcValueInfo['type'] = TokenSrcValueInfo['type'],\n> = {\n tokenSrcValueInfo: TokenSrcValueInfo<TheTokenType>;\n tokenId: string;\n description?: string;\n};\n","import { Simplify, expectType, isObjKey, isObject } from '@knapsack/utils';\nimport {\n TokenDefinitionComposite,\n TokenDefinitionSingular,\n TokenReference,\n TokenType,\n TokenDefinition,\n} from './token-definitions';\nimport { TokenKsExtensions } from './token-misc';\n\nexport type TokenSrcCommon<TheType extends TokenType = TokenType> = {\n $type?: TokenDefinition<TheType>['type'];\n $description?: string;\n $extensions?: {\n 'cloud.knapsack'?: TokenKsExtensions;\n };\n};\n\nexport function isTokenSrcExtensions(\n extensionsObj: unknown,\n): extensionsObj is TokenSrcCommon['$extensions'] {\n return isObject(extensionsObj) && isObjKey('cloud.knapsack', extensionsObj);\n}\n\ntype CreateSrcValueForComposite<\n ValueObj extends Record<string, { type: TokenDefinitionSingular['type'] }>,\n> = {\n [Key in keyof ValueObj]:\n | TokenReference\n | TokenDefinitionSingular<ValueObj[Key]['type']>['value'];\n};\n\ntype TokenSrcValueCompositeRaw = {\n [TheTokenType in TokenDefinitionComposite['type']]: Simplify<{\n type: TheTokenType;\n value: Simplify<\n CreateSrcValueForComposite<\n TokenDefinitionComposite<TheTokenType>['value']\n >\n >;\n }>;\n}[TokenDefinitionComposite['type']];\n\ntype TokenSrcValueComposite<\n TT extends TokenSrcValueCompositeRaw['type'] = TokenSrcValueCompositeRaw['type'],\n> = Extract<TokenSrcValueCompositeRaw, { type: TT }>;\n\ntype TokenSrcValueRaw = TokenDefinitionSingular | TokenSrcValueComposite;\n\nexport type TokenSrcValue<\n Type extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Extract<TokenSrcValueRaw, { type: Type }>['value'] | TokenReference;\n\nexpectType<TokenSrcValue[]>([\n '#ddd',\n true,\n [83, 1, 1, 1],\n {\n color: '#000',\n style: 'solid',\n width: '1px',\n },\n {\n inset: true,\n color: '#000',\n offsetX: '0px',\n offsetY: '{spacing.medium}',\n spread: '0px',\n blur: '0px',\n },\n {\n timingFunction: '{timing.ease}',\n duration: '{timing.duration.medium}',\n delay: '7ms',\n color: '#000',\n },\n]);\n\nexport type TokenSrc<\n TheType extends\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'] =\n | TokenDefinitionSingular['type']\n | TokenSrcValueComposite['type'],\n> = Simplify<\n {\n $value: TokenSrcValue<TheType>;\n } & TokenSrcCommon<TheType>\n>;\n\nexport function isTokenSrc(tokenObject: unknown): tokenObject is TokenSrc {\n if (isObject(tokenObject) && isObjKey('$value', tokenObject)) return true;\n return false;\n}\n\nexport type TokenSrcGroup = TokenSrcCommon & {\n [key: string]:\n | TokenSrcGroup\n | TokenSrc\n | TokenSrcCommon\n | TokenSrcCommon['$extensions'];\n};\n\nexport function isTokenGroup(\n tokenObject: unknown,\n): tokenObject is TokenSrcGroup {\n // @todo improve\n return (\n isObject(tokenObject) &&\n !isTokenSrcExtensions(tokenObject) &&\n !isObjKey('$value', tokenObject) &&\n // ensuring we are not in `$extensions` object\n !isObjKey('cloud.knapsack', tokenObject)\n );\n}\n\n// Token VAR references look like TokenSrcGroup\nexport function isTokenTypeVarRef(tokenObject: unknown) {\n // It's at least a TokenSrcGroup\n if (isTokenGroup(tokenObject)) {\n // The specific key within collectionInfo with the var reference\n const varRefCollectionInfo =\n tokenObject.$extensions['cloud.knapsack'].group.collectionInfo;\n if (\n isObjKey('type', varRefCollectionInfo) &&\n isObjKey('referenceId', varRefCollectionInfo)\n ) {\n return true;\n }\n }\n\n return false;\n}\n","import { parseNumberWithUnit } from '@knapsack/utils';\n\nexport function getPrimitiveValue(\n tokenValue: unknown,\n): 'string' | 'number' | 'boolean' {\n const type = typeof tokenValue;\n if (type === 'string' || type === 'number' || type === 'boolean') {\n return type;\n }\n throw new Error(\n `Invalid token value type: ${JSON.stringify(\n type,\n )}. Token value is: ${JSON.stringify(tokenValue)}`,\n );\n}\n\nexport type TokenDimensionUnit = 'px' | 'rem' | 'em' | '%';\n\n/**\n * Dimension strings require ending in 'px' or 'rem'\n * @see `libs/types/src/app-client-data/design-tokens-types/token-definitions.ts`\n */\nexport const isDimensionString = (\n value: string,\n): value is `${number}${'px' | 'rem' | 'em' | '%'}` =>\n value.includes('px') ||\n value.includes('rem') ||\n value.includes('em') ||\n value.includes('%');\n\n/**\n * Pass in values like `'12px'` to get detailed info\n * @throws if value is not a number or does not end in supported unit\n */\nexport function parseTokenDimensionValue(valueToParse: string | number): {\n value: number;\n unit?: TokenDimensionUnit;\n} {\n const { value, unit } = parseNumberWithUnit(valueToParse);\n if (!unit) {\n return { value };\n }\n if (unit !== 'px' && unit !== 'rem' && unit !== 'em' && unit !== '%') {\n throw new Error(`Invalid unit \"${unit}\" for value: ${value}`);\n }\n\n return { value, unit };\n}\n","import type { CSSProperties } from 'react';\nimport type { JsonSchemaObject } from '../json-schema';\nimport { RendererId } from '../renderers';\nimport { isObject } from '../type-utils';\nimport type { BlockConfig } from './blocks';\nimport type { Page, PageTab } from './page';\nimport { TokenSrcValueInfo } from './design-tokens-types/token-src-value-info';\n\nexport interface KsStatus {\n id: string;\n title: string;\n color?: string;\n}\n\nexport interface KsStatusSet {\n id: string;\n title: string;\n statuses: KsStatus[];\n}\n\n/**\n * Used by template renderers in addition to `path`\n * Twig: `@components/button.twig`\n * Web Components: `my-button` => `<my-button>`\n * React: a named export of the file if not `default`\n * @todo Replace this with `rendererOptions`\n */\ntype TemplateAlias = string;\n\nexport type SlottedTemplateDemo = {\n type: 'template-demo';\n /** @deprecated */\n patternId: string;\n /** @deprecated */\n templateId: string;\n /**\n * The demo referenced by `demoId` is inlined here before sending to server to\n * render, but is never stored in the json data. If this is present, it is\n * used instead of the demo referenced by `demoId`. This is done to ensure\n * server has all the latest data for a template demo by ensuring it includes\n * it's slotted children's data.\n * @see {inlineDemoData}\n */\n demo?: DataDemo;\n demoId: DemoBase['id'];\n};\n\n/**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n */\nexport type SlottedTemplateReference = {\n type: 'template-reference';\n patternId: string;\n templateId: string;\n};\n\nexport type SlottedText = {\n type: 'text';\n text: string;\n};\n\nexport type SlottedData =\n | SlottedText\n | SlottedTemplateDemo\n | SlottedTemplateReference;\n\n/** @deprecated - just check `type` */\nexport const isSlottedText = (\n slottedData: unknown,\n): slottedData is SlottedText =>\n isObject(slottedData) && slottedData.type === 'text';\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateDemo(\n slottedData: unknown,\n): slottedData is SlottedTemplateDemo {\n return isObject(slottedData) && slottedData.type === 'template-demo';\n}\n\n/** @deprecated - just check `type` */\nexport function isSlottedTemplateReference(\n slottedData: unknown,\n): slottedData is SlottedTemplateReference {\n return isObject(slottedData) && slottedData.type === 'template-reference';\n}\n\n/**\n * Collection ID: Mode ID\n */\nexport type ThemeDefinition = {\n [collectionId: string]: string;\n};\n\nexport type SlotOptions = {\n /**\n * @default 'div'\n */\n wrappingElementName?: string;\n cssClasses?: string[];\n align?: {\n value:\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'left'\n | 'center'\n | 'right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n };\n layout?: {\n value: 'horizontal' | 'vertical' | 'wrap';\n };\n gap?: {\n value: TokenSrcValueInfo<'dimension'>;\n };\n paddingHorizontal?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n paddingVertical?: {\n value: TokenSrcValueInfo<'dimension'>[];\n };\n /**\n * Collection ID: Mode ID\n */\n theme?: ThemeDefinition;\n};\n\n/**\n * These are created from {SlotOptions}\n * Only available in App Client for rendering - this is NOT saved in App Client Data\n */\nexport type SlotOptionsComputed = {\n styles: CSSProperties;\n cssClasses: string[];\n /**\n * @default 'div'\n */\n wrappingElementName: string;\n /**\n * can't be `style` or `class` or `className`\n */\n attributes: {\n [attributeName: string]: string;\n };\n};\n\nexport type KnapsackTemplateData = {\n /**\n * @todo Ideal would be `{ [key: string]: string | boolean | number }`\n */\n props: {\n [prop: string]: any;\n };\n slots?: {\n [slotName: string]: Array<SlottedData>;\n };\n /**\n * Settings from users are stored here and saved in App Client Data\n * This is used to dynamically create `slotsOptionsComputed`\n */\n slotsOptions?: {\n [slotName: string]: SlotOptions;\n };\n /**\n * Use `slotsOptions` to set & save styles on slotted children\n * Never set nor stored in App Client Data that gets saved\n * This is only inlined in the demo data for rendering so the App Client can\n * apply the styles to the slotted children\n * @see {inlineDemoData}\n */\n slotsOptionsComputed?: {\n [slotName: string]: SlotOptionsComputed;\n };\n};\n\ntype DemoType = 'data' | 'template';\n\ntype DemoBase = {\n id: string;\n title: string;\n description?: string;\n /**\n * Would override what was on the template\n */\n assetSetId?: string;\n width?: number;\n height?: number;\n type: DemoType;\n /** Collection ID: Mode ID */\n theme?: ThemeDefinition;\n};\n\n/**\n * Shows usage\n */\nexport type DataDemo = DemoBase & {\n type: 'data';\n patternId: string;\n templateId: string;\n data: KnapsackTemplateData;\n};\n\n/**\n * Shows source code\n */\nexport type TemplateDemo = DemoBase & {\n type: 'template';\n templateInfo: {\n alias?: TemplateAlias;\n path?: string;\n };\n};\n\nexport type Demo = TemplateDemo | DataDemo;\n\nexport type RenderDataDemo = Demo & {\n inlineStyles?: string;\n bodyAttributes?: Record<string, string>;\n};\n\n/** @deprecated */\nexport enum StageLayouts {\n portrait = 'portrait',\n landscape = 'landscape',\n}\n\nexport function isDataDemo(demo: TemplateDemo | DataDemo): demo is DataDemo {\n return demo?.type === 'data';\n}\n\nexport function isTemplateDemo(demo: Demo): demo is TemplateDemo {\n return demo?.type === 'template';\n}\n\nexport type KsSlotInfo = {\n title: string;\n description?: string;\n disallowText?: boolean;\n isRequired?: boolean;\n allowOnlyOne?: boolean;\n /**\n * i.e. Given a React Component, `Button`, this set to null/false would be\n * `<Button>` and set to true it would just be a reference to it: `Button`\n * @see {SlottedTemplateReference}\n */\n isTemplateReference?: boolean;\n allowedPatternIds?: string[];\n};\n\n/**\n * Supersedes `schema`\n */\nexport type KsTemplateSpec = {\n /**\n * Attempt to create the props & slots spec by reading the source file.\n * Prevents ability to use spec editor.\n *\n * If `true`, then uses the template `alias` & `path` to find the file.\n *\n * If a string, then that file path is used in place of the source file.\n *\n * Scenario: the `path` is used to point to a compiled file w types stripped\n * and this is used to point to either the source file w types or the compiled\n * `.d.ts` file. Currently only React is supported. The file extension\n * determines if TypeScript (ts/tsx) or PropTypes (js/jsx) is used for\n * inference.\n */\n isInferred?: boolean | string;\n /**\n * JSON Schema defining the serializable data passed in\n * The classic, formerly `schema`\n */\n props?: JsonSchemaObject;\n /**\n * Child component slots\n */\n slots?: {\n [name: string]: KsSlotInfo;\n };\n /**\n * @todo evaluate & refine\n */\n // cssProps?: {\n // [name: string]: {\n // title: string;\n // description: string;\n // };\n // };\n hidePropsTable?: boolean;\n hideSlotsTable?: boolean;\n /**\n * Extra Docs are each shown in their own table.\n * Useful for non-traditional spec docs that are more template language specific.\n * Examples: events, methods, etc\n */\n extraDocs?: {\n id: string;\n title: string;\n description?: string;\n tableRows?: {\n [columnTitle: string]: string;\n }[];\n }[];\n};\n\nexport interface KnapsackPatternTemplate {\n id: string;\n title?: string;\n /**\n * Relative file path to the template from the config file it is declared in\n */\n path: string;\n\n alias?: TemplateAlias;\n /**\n * Which template language? i.e. `twig`, `react` Replaces\n * KnapsackTemplateRenderer.test which ran a test on the file path (similar to\n * how WebPack loader `test` works)\n */\n templateLanguageId: RendererId;\n assetSetIds?: string[];\n spec?: KsTemplateSpec;\n /** Array of demo IDs, actual demo data is stored in `db.demos.demosById` */\n demoIds: Demo['id'][];\n /** Array of block IDs, actual block content is stored in db.blocks.blocksById */\n blockIds: BlockConfig['id'][];\n}\n\nexport type KnapsackPattern = Page & {\n $schema?: string;\n statuses?: {\n [statusSetId: string]: string;\n };\n templates?: KnapsackPatternTemplate[];\n subPages?: {\n id: string;\n title: string;\n blockIds: BlockConfig['id'][];\n }[];\n designSrcComponentsById?: Record<\n string,\n {\n id: string;\n title: string;\n componentId: string;\n fileId: string;\n }\n >;\n /** Controls order of `templates` & `subPages` on Pattern Page */\n tabs?: PageTab[];\n\n aliases?: string[];\n /**\n * Prevents pattern from appearing in System Overview and Status Table blocks\n */\n hideFromOverviewBlocks?: boolean;\n /**\n * Prevents pattern from appearing as an option in Component Embed and\n * Component Demo blocks\n */\n hideFromComponentBlocks?: boolean;\n};\n\nexport interface KnapsackPatternTemplateCode {\n html: string;\n data?: Record<string, any>;\n templateSrc: string;\n usage: string;\n language: string;\n}\n\nexport type KnapsackPatternsConfig = {\n $schema?: string;\n statusSets: KsStatusSet[];\n};\n\nexport interface TemplateRendererMeta {\n id: RendererId;\n title: string;\n version?: string;\n aliasTitle?: string;\n aliasDescription?: string;\n aliasUse: 'off' | 'optional' | 'required';\n aliasIsJsNamedExport?: boolean;\n syntaxHighlightingLanguage?: string;\n enableDataDemos: boolean;\n enableTemplateDemos: boolean;\n hasSlotsSupport: boolean;\n hasSlotOptionsSupport?: boolean;\n hasInferSpecSupport: boolean;\n hasTemplateSuggestionsSupport: boolean;\n prototypingTemplate?: {\n path: string;\n alias?: string;\n spec: Pick<KsTemplateSpec, 'props' | 'slots' | 'isInferred'>;\n };\n}\n\nexport type PatternsState = {\n patterns: {\n [id: string]: KnapsackPattern;\n };\n renderers: Partial<\n Record<\n RendererId,\n {\n meta: TemplateRendererMeta;\n }\n >\n >;\n} & KnapsackPatternsConfig;\n","import { ColorConfig } from '../color-config';\n\nexport enum PageHeaderSizes {\n auto = 'auto',\n small = 'small',\n medium = 'medium',\n large = 'large',\n full = 'full',\n}\n\nexport interface PageHeaderSettings {\n size?: `${PageHeaderSizes}`;\n backgroundImage?: string;\n backgroundColor?: ColorConfig;\n backgroundOverlay?: boolean;\n backgroundSize?: 'cover' | 'contain' | 'string';\n backgroundPosition?: 'left' | 'center' | 'right' | 'string';\n backgroundRepeat?: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat';\n hideText?: boolean;\n textColorTitle?: ColorConfig;\n textColorDescription?: ColorConfig;\n}\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { TokenSrcGroup } from './design-tokens-types';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { BlockConfig } from './blocks';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { Demo, PatternsState } from './patterns';\nimport { UiConfig } from '../ui-config';\nimport { PagesSettings } from './page';\nimport { BlocksSettings } from './blocks.settings';\nimport { DesignSrcFile } from '../design-src.types';\n\nexport * from './asset-sets';\nexport * from './blocks';\nexport * from './custom-pages';\nexport * from './design-tokens';\nexport * from './design-tokens-types';\nexport * from './nav';\nexport * from './files';\nexport * from './meta';\nexport * from './patterns';\nexport { PageHeaderSizes } from './page.header';\nexport type { PageHeaderSettings } from './page.header';\nexport type { PageTab, PageType } from './page';\n\nexport interface KsAppClientData {\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensSrc: TokenSrcGroup;\n metaState?: MetaState;\n filesState: KsFiles;\n db: {\n blocks: {\n byId: Record<string, BlockConfig>;\n settings: BlocksSettings;\n };\n demos: {\n byId: Record<string, Demo>;\n // \"never\" for now until there are actual settings for demos\n settings: Record<string, never>;\n };\n settings: {\n title?: string;\n hideTitleInNavigation?: boolean;\n logoUrl?: string;\n favicon?: `https://${string}`;\n theme?: UiConfig;\n pages?: PagesSettings;\n designSrcs?: {\n files?: DesignSrcFile[];\n };\n tokens?: {\n theming?: {\n /** Which template languages theming controls will show up for next to the components preview stage. */\n enabledRendererIds?: string[];\n };\n };\n prototyping?: {\n patternId: string;\n };\n };\n };\n}\n\nexport type KsAppClientDataNoMeta = Omit<KsAppClientData, 'metaState'>;\nexport type KsAppClientDataAndMeta = Required<KsAppClientData>;\n\nexport function isKsAppClientDataNoMeta(\n data: unknown,\n): data is KsAppClientDataNoMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataNoMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'db',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStruct = define<KsAppClientDataNoMeta>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMeta,\n);\n\nexport function isKsAppClientDataAndMeta(\n data: unknown,\n): data is KsAppClientDataAndMeta {\n if (!isObject(data)) return false;\n // TODO: bring in exhaustive key checking here so all keys are caught\n const requiredKeys: Array<keyof KsAppClientDataAndMeta> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'tokensSrc',\n 'metaState',\n 'db',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStruct = define<KsAppClientDataAndMeta>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMeta,\n);\n\nexport const KsMetaStateStruct: Describe<KsAppClientData['metaState']> = type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n});\n\nexport const isKsMetaState = KsMetaStateStruct.is;\n","import {\n // type structs validate that a value has a set of properties on it, but it does not assert anything about unspecified properties. This allows you to assert that a particular set of functionality exists without a strict equality check for properties.\n type,\n string,\n Describe,\n boolean,\n optional,\n array,\n number,\n define,\n} from 'superstruct';\nimport { isObjKey, isObject } from '../type-utils';\nimport type { KnapsackAssetSetsData } from './asset-sets';\nimport type { KsDesignTokensState } from './design-tokens';\nimport type { MetaState } from './meta';\nimport type { KnapsackNavsConfig } from './nav';\nimport type { KsFiles } from './files';\nimport type { KnapsackCustomPagesData } from './custom-pages';\nimport type { PatternsState } from './patterns';\nimport type { KnapsackSettings } from './settings';\n\nexport type {\n KsDesignToken,\n KsDesignTokenAttributes,\n KsDesignTokenData,\n KsDesignTokenDataGroup,\n KsDesignTokenSrc,\n KsDesignTokenSrcGroup,\n KsDesignTokensState,\n KsTokenType,\n KsTokenValue,\n KnapsackDesignToken,\n} from './design-tokens';\n\nexport interface KsAppClientDataV3 {\n settingsState: {\n settings: KnapsackSettings;\n };\n patternsState: PatternsState;\n customPagesState: KnapsackCustomPagesData;\n assetSetsState: KnapsackAssetSetsData;\n navsState: KnapsackNavsConfig;\n tokensState: KsDesignTokensState;\n metaState?: MetaState;\n filesState: KsFiles;\n}\n\nexport type KsAppClientDataNoMetaV3 = Omit<KsAppClientDataV3, 'metaState'>;\nexport type KsAppClientDataAndMetaV3 = Required<KsAppClientDataV3>;\n\nexport function isKsAppClientDataNoMetaV3(\n data: unknown,\n): data is KsAppClientDataNoMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataNoMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n ];\n if (!requiredKeys.every((key) => isObjKey(key, data))) return false;\n if (!isObjKey('metaState', data)) return true;\n return false;\n}\n\nexport const KsAppClientDataNoMetaStructV3 = define<KsAppClientDataNoMetaV3>(\n 'KsAppClientDataNoMeta',\n isKsAppClientDataNoMetaV3,\n);\n\nexport function isKsAppClientDataAndMetaV3(\n data: unknown,\n): data is KsAppClientDataAndMetaV3 {\n if (!isObject(data)) return false;\n const requiredKeys: Array<keyof KsAppClientDataAndMetaV3> = [\n 'assetSetsState',\n 'customPagesState',\n 'navsState',\n 'patternsState',\n 'settingsState',\n 'tokensState',\n 'metaState',\n ];\n return requiredKeys.every((key) => isObjKey(key, data));\n}\n\nexport const KsAppClientDataAndMetaStructV3 = define<KsAppClientDataAndMetaV3>(\n 'KsAppClientDataAndMeta',\n isKsAppClientDataAndMetaV3,\n);\n\nexport const KsMetaStateStructV3: Describe<KsAppClientDataV3['metaState']> =\n type({\n isLocalDev: boolean(),\n plugins: array(\n type({\n id: string(),\n hasContent: boolean(),\n clientPluginPath: optional(string()),\n cssPath: optional(string()),\n }),\n ),\n meta: optional(\n type({\n version: optional(string()),\n hasKnapsackCloud: boolean(),\n knapsackCloudSiteId: optional(string()),\n serverPort: optional(number()),\n websocketsPort: optional(number()),\n https: optional(boolean()),\n cacheDir: optional(string()),\n ksVersions: type({\n app: string(),\n }),\n }),\n ),\n });\n\nexport const isKsMetaStateV3 = KsMetaStateStructV3.is;\n","import { isDraft, type Draft } from 'immer';\nimport { Migration } from './migration.types';\nimport { KnapsackPattern, SlottedData } from '../app-client-data/patterns';\n\ntype Migration417DemosType = {\n version: string;\n checkIfNeeded: (appClientData: any) => boolean;\n migrate: (appClientData: Draft<any>) => void;\n};\n\nexport const migration417Demos: Migration417DemosType = {\n version: '4.1.7',\n checkIfNeeded: (appClientData) => {\n // this one will be tough to check for, so we'll just assume it's needed\n return true;\n },\n // note that `appClientData` is mutable since we're already in Immer\n migrate: (appClientData) => {\n if (!isDraft(appClientData)) {\n throw new Error(\n `Tried to run migrations on appClientData but it is not an Immer Draft`,\n );\n }\n Object.values(appClientData.patternsState.patterns).forEach(\n (\n pattern: Draft<\n KnapsackPattern & {\n demoSize?: string;\n }\n >,\n ) => {\n delete pattern.demoSize;\n },\n );\n\n Object.values(appClientData.db.demos.byId).forEach((demo) => {\n if (demo.type !== 'data') return;\n\n Object.entries(demo.data.slots ?? {}).forEach(([slotName, slotData]) => {\n demo.data.slots[slotName] = slotData.map(\n (slottedData: Draft<SlottedData | string>) => {\n // it used to be just a string\n if (typeof slottedData === 'string') {\n return {\n type: 'text',\n text: slottedData,\n };\n }\n if (\n // not doing anything with these\n slottedData.type === 'template-reference' ||\n // these already were migrated or made by the new editor\n slottedData.type === 'text'\n ) {\n return slottedData;\n }\n // these used to not have a type set\n slottedData.type = 'template-demo';\n return slottedData;\n },\n );\n });\n\n if (demo.patternId && demo.templateId) return;\n\n // using an IIFE so we can stop looping once we find it\n // would use `break` but it's a double loop\n (() => {\n for (const { id: pId, templates = [] } of Object.values(\n appClientData.patternsState.patterns,\n )) {\n for (const { id: tId, demoIds = [] } of templates) {\n if (demoIds.includes(demo.id)) {\n demo.patternId = pId;\n demo.templateId = tId;\n // found it - stop looking\n return;\n }\n }\n }\n })();\n });\n },\n} satisfies Migration;\n","import { migration417Demos } from './4.1.7-demos';\n\nexport const migrations = [migration417Demos];\n","// import { JSONSchema7 } from 'json-schema'; @todo consider using instead; though I'm not seeing it make it's way to the compiled JSON schema themselves via `convert-types-to-json-schmea.js`\n\ntype PropBase<Type = any> = {\n title?: string;\n description?: string;\n default?: Type;\n};\n\nexport enum PropTypeNames {\n 'string' = 'string',\n 'boolean' = 'boolean',\n 'number' = 'number',\n 'object' = 'object',\n 'options' = 'options',\n 'function' = 'function',\n 'customTypeScript' = 'customTypeScript',\n 'array' = 'array',\n 'arrayOfObjects' = 'arrayOfObjects',\n 'arrayOfStrings' = 'arrayOfStrings',\n 'arrayOfNumbers' = 'arrayOfNumbers',\n 'unknown' = 'unknown',\n}\nexport type PropTypeNamesList = keyof typeof PropTypeNames;\n\nexport type StringProp = {\n type: 'string';\n} & PropBase<string>;\n\nexport type BooleanProp = {\n type: 'boolean';\n} & PropBase<boolean>;\n\nexport type NumberProp = {\n type: 'number';\n} & PropBase<number>;\n\nexport type OptionsProp = {\n type: 'string';\n enum: string[];\n enumNames?: string[];\n} & PropBase<string>;\n\nexport type CustomTypeScriptProp = {\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n type?: never;\n default?: string;\n} & PropBase<string>;\n\nexport type FunctionProp = {\n typeof: 'function';\n /**\n * TypeScript type\n * @example (name: string) => void\n */\n tsType: string;\n default?: string;\n type?: 'string';\n} & PropBase<string>;\n\nexport type ObjectProp = {\n type: 'object';\n additionalProperties?: boolean;\n required?: string[];\n properties: {\n [prop: string]: PropertyTypes;\n };\n} & PropBase;\n\nexport type ArrayProp = {\n type: 'array';\n items: PropertyTypes;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfStringsProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: StringProp;\n} & PropBase<unknown[]>;\n\nexport type ArrayOfNumbersProp = {\n type: 'array';\n uniqueItems?: boolean;\n items: NumberProp;\n} & PropBase<number[]>;\n\nexport type ArrayOfObjectsProp = {\n type: 'array';\n items: ObjectProp;\n} & PropBase<Array<Record<string, unknown>>>;\n\nexport type PropertyTypes =\n | StringProp\n | BooleanProp\n | NumberProp\n | OptionsProp\n | FunctionProp\n | CustomTypeScriptProp\n | ObjectProp\n | ArrayOfObjectsProp\n | ArrayOfStringsProp\n | ArrayOfNumbersProp\n | ArrayProp;\n\nexport const isStringProp = (prop: PropertyTypes): prop is StringProp =>\n 'type' in prop && prop.type === 'string' && !('enum' in prop);\nexport const isNumberProp = (prop: PropertyTypes): prop is NumberProp =>\n 'type' in prop && prop.type === 'number';\nexport const isBooleanProp = (prop: PropertyTypes): prop is BooleanProp =>\n 'type' in prop && prop.type === 'boolean';\nexport const isOptionsProp = (prop: PropertyTypes): prop is OptionsProp =>\n 'enum' in prop;\nexport const isFunctionProp = (prop: PropertyTypes): prop is FunctionProp =>\n 'typeof' in prop && prop?.typeof === 'function';\nexport const isCustomTypeScriptProp = (\n prop: PropertyTypes,\n): prop is CustomTypeScriptProp => !('typeof' in prop) && 'tsType' in prop;\nexport const isArrayOfObjectsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfObjectsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'object';\nexport const isObjectProp = (prop: PropertyTypes): prop is ObjectProp =>\n 'type' in prop &&\n prop.type === 'object' &&\n 'properties' in prop &&\n Object.keys(prop.properties).length > 0;\nexport const isArrayOfStringsProp = (\n prop: PropertyTypes,\n): prop is ArrayOfStringsProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'string';\nexport const isArrayOfNumbersProp = (\n prop: PropertyTypes,\n): prop is ArrayOfNumbersProp =>\n 'type' in prop &&\n prop.type === 'array' &&\n 'items' in prop &&\n prop.items.type === 'number';\n\nexport interface PropTypeDataBase {\n type: any;\n id: string;\n isRequired?: boolean;\n data: any;\n}\n\nexport interface StringPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.string;\n data: StringProp;\n}\n\nexport interface BooleanPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.boolean;\n data: BooleanProp;\n}\n\nexport interface NumberPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.number;\n data: NumberProp;\n}\n\nexport interface OptionsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.options;\n data: OptionsProp;\n}\n\nexport interface FunctionPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.function;\n data: FunctionProp;\n}\n\nexport interface CustomTypeScriptPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.customTypeScript;\n data: CustomTypeScriptProp;\n}\n\nexport interface ObjectPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.object;\n data: ObjectProp;\n}\n\nexport interface ArrayOfObjectsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfObjects;\n data: ArrayOfObjectsProp;\n}\n\nexport interface ArrayOfStringsPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfStrings;\n data: ArrayOfStringsProp;\n}\n\nexport interface ArrayOfNumbersPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.arrayOfNumbers;\n data: ArrayOfNumbersProp;\n}\n\nexport interface ArrayPropTypeData extends PropTypeDataBase {\n type: typeof PropTypeNames.array;\n data: ArrayProp;\n}\n\nexport type PropTypeData =\n | StringPropTypeData\n | BooleanPropTypeData\n | NumberPropTypeData\n | OptionsPropTypeData\n | FunctionPropTypeData\n | CustomTypeScriptPropTypeData\n | ObjectPropTypeData\n | ArrayOfObjectsPropTypeData\n | ArrayOfStringsPropTypeData\n | ArrayOfNumbersPropTypeData;\n\nexport type JsonSchemaObject<PropNames extends string = string> = {\n $schema?: string;\n title?: string;\n description?: string;\n type: 'object';\n required?: PropNames[];\n properties: Record<PropNames, PropertyTypes>;\n examples?: Record<string, unknown>[];\n};\n","import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n","import type { KnapsackPatternTemplate, TemplateDemo } from './app-client-data';\n\nexport const rendererIds = {\n react: 'react',\n vue: 'vue',\n 'web-components': 'web-components',\n twig: 'twig',\n hbs: 'hbs',\n angular: 'angular',\n html: 'html',\n} as const;\n\n/**\n * The ID of a renderer, e.g. 'react', 'vue', 'angular', etc.\n * On Pattern Templates, this will match up to `templateLanguageId` to identify which renderer to use.\n * @see {KnapsackPatternTemplate['templateLanguageId']}\n */\nexport type RendererId = keyof typeof rendererIds;\n/**\n * Results of rendering a pattern\n */\nexport type KsRenderResults = {\n ok: boolean;\n html: string;\n usage?: string;\n templateLanguage?: string;\n message?: string;\n};\n\nexport type KsRenderApiResults = KsRenderResults & {\n wrappedHtml: string;\n};\nexport type TemplateSuggestion = {\n path: string;\n alias?: string;\n};\n\nexport type TemplateSuggestionsGetFn = (opt: {\n rendererId: RendererId;\n newPath?: string;\n state: ContentStateForRendering;\n}) => Promise<{\n suggestions: TemplateSuggestion[];\n}>;\n\n/**\n * Aliases for package paths\n * Example:\n * ```js\n * {\n * 'my-pkg': '../path/to/my-pkg',\n * }\n * ```\n */\nexport type PkgPathAliases = Record<string, string>;\n\nexport type ContentStateForRendering = {\n /**\n * Patterns by ID\n */\n patterns: {\n [patternId: string]: {\n id: string;\n templates: Pick<\n KnapsackPatternTemplate,\n 'alias' | 'path' | 'templateLanguageId' | 'spec' | 'id' | 'title'\n >[];\n templateDemos: Array<\n TemplateDemo & {\n templateId: string;\n templateLanguageId: RendererId;\n }\n >;\n };\n };\n};\n","import type { FeedbackTypes } from './misc';\n\nexport enum KsRendererClientEvents {\n ready = 'ready',\n}\n\n/**\n * Message sent from the renderer client (in the iframe) to the App UI parent window\n * using `window.parent.postMessage()`.\n * Note that this likely will become a union type of all possible messages\n */\nexport type KsRendererClientMsg =\n | {\n /**\n * Sent when a `ResizeObserver` detects a change in the contents height or width.\n */\n type: 'ksRendererClient.contentResized';\n height: number;\n width: number;\n }\n | {\n type: 'ksRendererClient.showToast';\n msg: string;\n feedbackType?: FeedbackTypes;\n };\n\n/**\n * The meta data is stored in a script tag with this id\n * @see {KsRendererClientMeta}\n */\nexport const ksRendererClientMetaId = 'ks-meta';\n\n/**\n * Metadata about the current renderer client demo\n * @see {ksRendererClientMetaId} for the ID of the script tag\n */\nexport interface KsRendererClientMeta {\n patternId: string;\n templateId: string;\n demoId: string;\n assetSetId: string;\n isInIframe: boolean;\n websocketsPort: number;\n}\n","export const WS_EVENTS = {\n PATTERN_TEMPLATE_CHANGED: 'PATTERN_TEMPLATE_CHANGED',\n PATTERN_ASSET_CHANGED: 'PATTERN_ASSET_CHANGED',\n DESIGN_TOKENS_CHANGED: 'DESIGN_TOKENS_CHANGED',\n RENDERER_CLIENT_RELOAD: 'RENDERER_CLIENT_RELOAD',\n APP_CLIENT_DATA_CHANGED: 'APP_CLIENT_DATA_CHANGED',\n};\n\nexport type WebSocketEvent = keyof typeof WS_EVENTS;\n\nexport interface WebSocketMessage {\n event: string;\n data: Record<string, unknown>;\n}\n\nexport interface DesignTokensChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.DESIGN_TOKENS_CHANGED;\n data: Record<string, unknown>;\n}\n\nexport interface PatternChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_TEMPLATE_CHANGED;\n data: {\n /**\n * Absolute path to template on server that was just edited\n */\n path: string;\n };\n}\n\nexport interface AssetChangedData extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_ASSET_CHANGED;\n data: {\n /**\n * Absolute path to asset file (CSS/JS) on server that was just edited\n */\n path: string;\n };\n}\n\nexport interface RendererClientReloadMessage extends WebSocketMessage {\n event: typeof WS_EVENTS.RENDERER_CLIENT_RELOAD;\n data: {\n // @todo add patternId etc for more details\n };\n}\n\nexport interface AppClientDataChanged extends WebSocketMessage {\n event: typeof WS_EVENTS.PATTERN_TEMPLATE_CHANGED;\n data: Record<string, unknown>;\n}\n\nexport type WebSocketMessages =\n | PatternChangedData\n | AssetChangedData\n | DesignTokensChangedData\n | RendererClientReloadMessage;\n","export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha: string;\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n","export const endpoint = `/plugins`;\n\nexport enum ACTIONS {\n getContent = 'getContent',\n}\n\nexport interface GetContentRequest {\n type: ACTIONS.getContent;\n pluginId: string;\n}\n\nexport interface GetContentResponse {\n type: ACTIONS.getContent;\n ok: boolean;\n message?: string;\n payload: Record<string, unknown>;\n}\n\nexport type ActionRequests = GetContentRequest;\n\nexport type ActionResponses = GetContentResponse;\n","import type { RendererId } from '../renderers';\n\nexport const endpoint = `/files`;\n\nexport enum ACTIONS {\n verify = 'verify',\n}\n\nexport interface VerifyData {\n type: ACTIONS.verify;\n payload: {\n path: string;\n rendererId: RendererId;\n };\n}\n\nexport interface VerifyDataResponse {\n type: ACTIONS.verify;\n payload: {\n exists: boolean;\n relativePath: string;\n absolutePath: string;\n type: 'absolute' | 'relative' | 'package' | 'unknown';\n };\n}\n\nexport type Actions = VerifyData;\n\nexport type ActionResponses = VerifyDataResponse;\n","/**\n * The roles here are duplicates of the roles in the database.\n * It needs to be here, in the types package, so it can be used in all packages.\n * If we pull it in from `@knapsack/hasura-gql-client`, which is the source, we get a dependency cycle. So we do it this way.\n * If the roles change in the database, we need to change them here too. We will get a build error if we don't (see code in `@knapsack/hasura-gql-client`).\n */\n\nexport const rolesById = {\n ADMIN: 'ADMIN',\n ANONYMOUS: 'ANONYMOUS',\n CONTRIBUTOR: 'CONTRIBUTOR',\n EDITOR: 'EDITOR',\n MANAGER: 'MANAGER',\n VIEWER: 'VIEWER',\n} as const;\nexport const roles = Object.values(rolesById);\nexport type Role = keyof typeof rolesById;\n"]}