@knapsack/types 5.0.0--canary.6593.4738696.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.lintstagedrc.mjs +2 -2
  2. package/CHANGELOG.md +174 -0
  3. package/convert-types-to-json-schemas.ts +3 -1
  4. package/dist/acd-test-fixtures/empty.d.ts +1 -1
  5. package/dist/acd-test-fixtures/empty.d.ts.map +1 -1
  6. package/dist/acd-test-fixtures/index.js.map +1 -1
  7. package/dist/acd-test-fixtures/index.mjs.map +1 -1
  8. package/dist/api-routes.js.map +1 -1
  9. package/dist/api-routes.mjs.map +1 -1
  10. package/dist/app-client-data/blocks.d.ts +2 -1
  11. package/dist/app-client-data/blocks.d.ts.map +1 -1
  12. package/dist/app-client-data/blocks.settings.d.ts +2 -2
  13. package/dist/app-client-data/blocks.settings.d.ts.map +1 -1
  14. package/dist/app-client-data/design-tokens-types/token-data.d.ts +7 -7
  15. package/dist/app-client-data/design-tokens-types/token-data.d.ts.map +1 -1
  16. package/dist/app-client-data/design-tokens-types/token-definitions.d.ts.map +1 -1
  17. package/dist/app-client-data/design-tokens-types/token-src-value-info.d.ts +2 -2
  18. package/dist/app-client-data/design-tokens-types/token-src-value-info.d.ts.map +1 -1
  19. package/dist/app-client-data/design-tokens-types/token-src.d.ts +3 -3
  20. package/dist/app-client-data/design-tokens-types/token-src.d.ts.map +1 -1
  21. package/dist/app-client-data/index.d.ts +14 -6
  22. package/dist/app-client-data/index.d.ts.map +1 -1
  23. package/dist/app-client-data/page.d.ts +0 -6
  24. package/dist/app-client-data/page.d.ts.map +1 -1
  25. package/dist/app-client-data/page.header.d.ts +1 -1
  26. package/dist/app-client-data/page.header.d.ts.map +1 -1
  27. package/dist/app-client-data/patterns.d.ts +74 -0
  28. package/dist/app-client-data/patterns.d.ts.map +1 -1
  29. package/dist/app-client-data/types-to-json-schemas.d.ts.map +1 -1
  30. package/dist/app-client-data/validation.test.d.ts +2 -0
  31. package/dist/app-client-data/validation.test.d.ts.map +1 -0
  32. package/dist/app-client-data-migrations/4.1.7-demos.d.ts.map +1 -1
  33. package/dist/app-client-data-migrations/migration.types.d.ts +1 -1
  34. package/dist/app-client-data-migrations/migration.types.d.ts.map +1 -1
  35. package/dist/app-client-data-v3/index.d.ts +1 -1
  36. package/dist/app-client-data-v3/index.d.ts.map +1 -1
  37. package/dist/app-client-data-v3/page.header.d.ts +1 -1
  38. package/dist/app-client-data-v3/page.header.d.ts.map +1 -1
  39. package/dist/app-client-data-v3/types-to-json-schemas.d.ts.map +1 -1
  40. package/dist/app-sections.d.ts +2 -1
  41. package/dist/app-sections.d.ts.map +1 -1
  42. package/dist/app-sections.js +1 -1
  43. package/dist/app-sections.js.map +1 -1
  44. package/dist/app-sections.mjs +1 -1
  45. package/dist/app-sections.mjs.map +1 -1
  46. package/dist/changes.js.map +1 -1
  47. package/dist/changes.mjs.map +1 -1
  48. package/dist/color-config.d.ts +1 -1
  49. package/dist/color-config.d.ts.map +1 -1
  50. package/dist/color-config.js +1 -1
  51. package/dist/color-config.js.map +1 -1
  52. package/dist/color-config.mjs +1 -1
  53. package/dist/color-config.mjs.map +1 -1
  54. package/dist/e2e-session-config.d.ts +20 -0
  55. package/dist/e2e-session-config.d.ts.map +1 -0
  56. package/dist/e2e-session-config.js +2 -0
  57. package/dist/e2e-session-config.js.map +1 -0
  58. package/dist/e2e-session-config.mjs +2 -0
  59. package/dist/e2e-session-config.mjs.map +1 -0
  60. package/dist/git-providers.js.map +1 -1
  61. package/dist/git-providers.mjs.map +1 -1
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +1 -1
  65. package/dist/index.js.map +1 -1
  66. package/dist/index.mjs +1 -1
  67. package/dist/index.mjs.map +1 -1
  68. package/dist/intercepts.d.ts +1 -1
  69. package/dist/intercepts.d.ts.map +1 -1
  70. package/dist/json-schema.js.map +1 -1
  71. package/dist/json-schema.mjs.map +1 -1
  72. package/dist/misc.d.ts +2 -2
  73. package/dist/misc.d.ts.map +1 -1
  74. package/dist/nav-customization-config.d.ts +3 -3
  75. package/dist/nav-customization-config.d.ts.map +1 -1
  76. package/dist/nav-customization-config.js +1 -1
  77. package/dist/nav-customization-config.js.map +1 -1
  78. package/dist/nav-customization-config.mjs +1 -1
  79. package/dist/nav-customization-config.mjs.map +1 -1
  80. package/dist/renderer-client-types.js.map +1 -1
  81. package/dist/renderer-client-types.mjs.map +1 -1
  82. package/dist/renderers.d.ts +28 -0
  83. package/dist/renderers.d.ts.map +1 -1
  84. package/dist/renderers.js +1 -1
  85. package/dist/renderers.js.map +1 -1
  86. package/dist/renderers.mjs +1 -1
  87. package/dist/renderers.mjs.map +1 -1
  88. package/dist/renderers.test.d.ts +2 -0
  89. package/dist/renderers.test.d.ts.map +1 -0
  90. package/dist/typography-config.d.ts +2 -2
  91. package/dist/typography-config.d.ts.map +1 -1
  92. package/dist/typography-config.js +1 -1
  93. package/dist/typography-config.js.map +1 -1
  94. package/dist/typography-config.mjs +1 -1
  95. package/dist/typography-config.mjs.map +1 -1
  96. package/dist/ui-config.d.ts +5 -5
  97. package/dist/ui-config.d.ts.map +1 -1
  98. package/dist/ui-config.js +1 -1
  99. package/dist/ui-config.js.map +1 -1
  100. package/dist/ui-config.mjs +1 -1
  101. package/dist/ui-config.mjs.map +1 -1
  102. package/dist/user-roles.d.ts +1 -0
  103. package/dist/user-roles.d.ts.map +1 -1
  104. package/dist/user-roles.js +1 -1
  105. package/dist/user-roles.js.map +1 -1
  106. package/dist/user-roles.mjs +1 -1
  107. package/dist/user-roles.mjs.map +1 -1
  108. package/dist/web-sockets.js.map +1 -1
  109. package/dist/web-sockets.mjs.map +1 -1
  110. package/package.json +16 -18
  111. package/vitest.config.mjs +1 -2
  112. package/.eslintrc.js +0 -6
  113. package/ava.config.cjs +0 -3
  114. package/dist/app-client-data/validation.vtest.d.ts +0 -2
  115. package/dist/app-client-data/validation.vtest.d.ts.map +0 -1
  116. package/dist/cypress-session-config.d.ts +0 -20
  117. package/dist/cypress-session-config.d.ts.map +0 -1
  118. package/dist/cypress-session-config.js +0 -2
  119. package/dist/cypress-session-config.js.map +0 -1
  120. package/dist/cypress-session-config.mjs +0 -2
  121. package/dist/cypress-session-config.mjs.map +0 -1
  122. package/dist/renderers.vitest.d.ts +0 -2
  123. package/dist/renderers.vitest.d.ts.map +0 -1
  124. package/dist/renderers.vitest.js +0 -451
  125. package/dist/renderers.vitest.js.map +0 -1
  126. package/dist/renderers.vitest.mjs +0 -451
  127. package/dist/renderers.vitest.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- export type Intercept = 'csatIntercept' | 'profileIncompleteIntercept' | 'readOnlyInterceptDesign' | 'readOnlyInterceptDevelop' | 'readOnlyInterceptDocumentation' | 'readOnlyInterceptPrototype' | 'readOnlyInterceptSettings';
1
+ export type Intercept = 'csatIntercept' | 'profileIncompleteIntercept' | 'readOnlyInterceptDesign' | 'readOnlyInterceptDevelop' | 'readOnlyInterceptDocumentation' | 'readOnlyInterceptPrototype' | 'readOnlyInterceptSettings' | 'readOnlyInterceptMCP' | 'mcpDisabledIntercept' | 'ipeDisabledIntercept' | 'intelligentToolsBillingBanner';
2
2
  //# sourceMappingURL=intercepts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intercepts.d.ts","sourceRoot":"","sources":["../src/intercepts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,4BAA4B,GAC5B,yBAAyB,GACzB,0BAA0B,GAC1B,gCAAgC,GAChC,4BAA4B,GAC5B,2BAA2B,CAAC"}
1
+ {"version":3,"file":"intercepts.d.ts","sourceRoot":"","sources":["../src/intercepts.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,4BAA4B,GAC5B,yBAAyB,GACzB,0BAA0B,GAC1B,gCAAgC,GAChC,4BAA4B,GAC5B,2BAA2B,GAC3B,sBAAsB,GACtB,sBAAsB,GACtB,sBAAsB,GACtB,+BAA+B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/json-schema.ts"],"names":["PropTypeNames","isStringProp","__name","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp"],"mappings":"aAQO,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,IAAA,CAAA,CAAA,CAAA,IAAKA,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,MAAW,CAAA,QAAA,CACXA,EAAA,OAAY,CAAA,SAAA,CACZA,CAAA,CAAA,MAAA,CAAW,SACXA,CAAA,CAAA,MAAA,CAAW,QACXA,CAAAA,CAAAA,CAAA,QAAY,SACZA,CAAAA,CAAAA,CAAA,QAAa,CAAA,UAAA,CACbA,EAAA,gBAAqB,CAAA,kBAAA,CACrBA,CAAA,CAAA,KAAA,CAAU,QACVA,CAAA,CAAA,cAAA,CAAmB,gBACnBA,CAAAA,CAAAA,CAAA,eAAmB,gBACnBA,CAAAA,CAAAA,CAAA,cAAmB,CAAA,gBAAA,CACnBA,EAAA,OAAY,CAAA,SAAA,CAZFA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAmGCC,EAAeC,CAACC,CAAAA,CAAAA,EAC3B,MAAUA,GAAAA,CAAAA,EAAQA,EAAK,IAAS,GAAA,QAAA,EAAY,EAAE,MAAA,GAAUA,GAD9B,cAEfC,CAAAA,CAAAA,CAAAA,CAAeF,CAACC,CAAAA,CAAAA,EAC3B,SAAUA,CAAQA,EAAAA,CAAAA,CAAK,IAAS,GAAA,QAAA,CADN,gBAEfE,CAAgBH,CAAAA,CAAAA,CAACC,CAC5B,EAAA,MAAA,GAAUA,GAAQA,CAAK,CAAA,IAAA,GAAS,SADL,CAAA,eAAA,CAAA,CAEhBG,EAAgBJ,CAACC,CAAAA,CAAAA,EAC5B,MAAUA,GAAAA,CAAAA,CADiB,iBAEhBI,CAAiBL,CAAAA,CAAAA,CAACC,CAC7B,EAAA,QAAA,GAAYA,CAAQA,EAAAA,CAAAA,EAAM,MAAW,GAAA,UAAA,CADT,kBAEjBK,CAAyBN,CAAAA,CAAAA,CACpCC,CACiC,EAAA,EAAE,WAAYA,CAAS,CAAA,EAAA,QAAA,GAAYA,CAFhC,CAAA,wBAAA,CAAA,CAGzBM,EAAuBP,CAClCC,CAAAA,CAAAA,EAEA,MAAUA,GAAAA,CAAAA,EACVA,EAAK,IAAS,GAAA,OAAA,EACd,OAAWA,GAAAA,CAAAA,EACXA,EAAK,KAAM,CAAA,IAAA,GAAS,QANc,CAAA,sBAAA,CAAA,CAOvBO,EAAeR,CAACC,CAAAA,CAAAA,EAC3B,MAAUA,GAAAA,CAAAA,EACVA,EAAK,IAAS,GAAA,QAAA,EACd,YAAgBA,GAAAA,CAAAA,EAChB,OAAO,IAAKA,CAAAA,CAAAA,CAAK,UAAU,CAAA,CAAE,OAAS,CAJZ,CAAA,cAAA,CAAA,CAKfQ,CAAuBT,CAAAA,CAAAA,CAClCC,GAEA,MAAUA,GAAAA,CAAAA,EACVA,CAAK,CAAA,IAAA,GAAS,SACd,OAAWA,GAAAA,CAAAA,EACXA,CAAK,CAAA,KAAA,CAAM,OAAS,QANc,CAAA,sBAAA,CAAA,CAOvBS,CAAuBV,CAAAA,CAAAA,CAClCC,GAEA,MAAUA,GAAAA,CAAAA,EACVA,CAAK,CAAA,IAAA,GAAS,SACd,OAAWA,GAAAA,CAAAA,EACXA,CAAK,CAAA,KAAA,CAAM,OAAS,QANc,CAAA,sBAAA","file":"json-schema.js","sourcesContent":["// 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' | 'number';\n enum: Array<string | number>;\n enumNames?: string[];\n} & PropBase<string | number>;\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"]}
1
+ {"version":3,"sources":["../src/json-schema.ts"],"names":["PropTypeNames","isStringProp","__name","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp"],"mappings":"aAQO,IAAA,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,GAAW,UAAA,CADT,kBAEjBK,CAAAA,CAAyBN,CAAAA,CACpCC,CAAAA,EACiC,EAAE,WAAYA,CAAAA,CAAAA,EAAS,QAAA,GAAYA,CAAAA,CAFhC,wBAAA,CAAA,CAGzBM,EAAuBP,CAAAA,CAClCC,CAAAA,EAEA,MAAA,GAAUA,CAAAA,EACVA,EAAK,IAAA,GAAS,OAAA,EACd,OAAA,GAAWA,CAAAA,EACXA,EAAK,KAAA,CAAM,IAAA,GAAS,QAAA,CANc,sBAAA,CAAA,CAOvBO,EAAeR,CAAAA,CAACC,CAAAA,EAC3B,MAAA,GAAUA,CAAAA,EACVA,EAAK,IAAA,GAAS,QAAA,EACd,YAAA,GAAgBA,CAAAA,EAChB,OAAO,IAAA,CAAKA,CAAAA,CAAK,UAAU,CAAA,CAAE,OAAS,CAAA,CAJZ,cAAA,CAAA,CAKfQ,CAAAA,CAAuBT,CAAAA,CAClCC,GAEA,MAAA,GAAUA,CAAAA,EACVA,CAAAA,CAAK,IAAA,GAAS,SACd,OAAA,GAAWA,CAAAA,EACXA,CAAAA,CAAK,KAAA,CAAM,OAAS,QAAA,CANc,sBAAA,CAAA,CAOvBS,CAAAA,CAAuBV,CAAAA,CAClCC,GAEA,MAAA,GAAUA,CAAAA,EACVA,CAAAA,CAAK,IAAA,GAAS,SACd,OAAA,GAAWA,CAAAA,EACXA,CAAAA,CAAK,KAAA,CAAM,OAAS,QAAA,CANc,sBAAA","file":"json-schema.js","sourcesContent":["// 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' | 'number';\n enum: Array<string | number>;\n enumNames?: string[];\n} & PropBase<string | number>;\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/json-schema.ts"],"names":["PropTypeNames","isStringProp","__name","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp"],"mappings":"AAQO,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,IAAA,CAAA,CAAA,CAAA,IAAKA,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CA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A,EACd,OAAWA,GAAAA,CAAAA,EACXA,EAAK,KAAM,CAAA,IAAA,GAAS,QANc,CAAA,sBAAA,CAAA,CAOvBO,EAAeR,CAACC,CAAAA,CAAAA,EAC3B,MAAUA,GAAAA,CAAAA,EACVA,EAAK,IAAS,GAAA,QAAA,EACd,YAAgBA,GAAAA,CAAAA,EAChB,OAAO,IAAKA,CAAAA,CAAAA,CAAK,UAAU,CAAA,CAAE,OAAS,CAJZ,CAAA,cAAA,CAAA,CAKfQ,CAAuBT,CAAAA,CAAAA,CAClCC,GAEA,MAAUA,GAAAA,CAAAA,EACVA,CAAK,CAAA,IAAA,GAAS,SACd,OAAWA,GAAAA,CAAAA,EACXA,CAAK,CAAA,KAAA,CAAM,OAAS,QANc,CAAA,sBAAA,CAAA,CAOvBS,CAAuBV,CAAAA,CAAAA,CAClCC,GAEA,MAAUA,GAAAA,CAAAA,EACVA,CAAK,CAAA,IAAA,GAAS,SACd,OAAWA,GAAAA,CAAAA,EACXA,CAAK,CAAA,KAAA,CAAM,OAAS,QANc,CAAA,sBAAA","file":"json-schema.mjs","sourcesContent":["// 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' | 'number';\n enum: Array<string | number>;\n enumNames?: string[];\n} & PropBase<string | number>;\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"]}
1
+ {"version":3,"sources":["../src/json-schema.ts"],"names":["PropTypeNames","isStringProp","__name","prop","isNumberProp","isBooleanProp","isOptionsProp","isFunctionProp","isCustomTypeScriptProp","isArrayOfObjectsProp","isObjectProp","isArrayOfStringsProp","isArrayOfNumbersProp"],"mappings":"AAQO,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,IAAA,CAAA,CAAA,CAAA,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAW,QAAA,CACXA,EAAA,OAAA,CAAY,SAAA,CACZA,CAAAA,CAAA,MAAA,CAAW,SACXA,CAAAA,CAAA,MAAA,CAAW,QAAA,CACXA,CAAAA,CAAA,QAAY,SAAA,CACZA,CAAAA,CAAA,QAAA,CAAa,UAAA,CACbA,EAAA,gBAAA,CAAqB,kBAAA,CACrBA,CAAAA,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AA,CAAK,UAAU,CAAA,CAAE,OAAS,CAAA,CAJZ,cAAA,CAAA,CAKfQ,CAAAA,CAAuBT,CAAAA,CAClCC,GAEA,MAAA,GAAUA,CAAAA,EACVA,CAAAA,CAAK,IAAA,GAAS,SACd,OAAA,GAAWA,CAAAA,EACXA,CAAAA,CAAK,KAAA,CAAM,OAAS,QAAA,CANc,sBAAA,CAAA,CAOvBS,CAAAA,CAAuBV,CAAAA,CAClCC,GAEA,MAAA,GAAUA,CAAAA,EACVA,CAAAA,CAAK,IAAA,GAAS,SACd,OAAA,GAAWA,CAAAA,EACXA,CAAAA,CAAK,KAAA,CAAM,OAAS,QAAA,CANc,sBAAA","file":"json-schema.mjs","sourcesContent":["// 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' | 'number';\n enum: Array<string | number>;\n enumNames?: string[];\n} & PropBase<string | number>;\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"]}
package/dist/misc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Simplify } from '@knapsack/utils';
1
+ import { type Simplify } from '@knapsack/utils';
2
2
  import type { DesignSrcItem } from './design-src.types';
3
- import { Role } from './user-roles';
3
+ import { type Role } from './user-roles';
4
4
  export type GenericResponse<data = Record<string, any>> = {
5
5
  ok: boolean;
6
6
  message?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,MAAM,MAAM,eAAe,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACxD,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,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,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { Describe } from 'superstruct';
2
- import { ColorConfig } from './color-config';
3
- import { TypographyConfig } from './typography-config';
1
+ import { type Describe } from 'superstruct';
2
+ import { type ColorConfig } from './color-config';
3
+ import { type TypographyConfig } from './typography-config';
4
4
  export interface NavCustomizationConfig extends TypographyConfig {
5
5
  accentColor?: ColorConfig;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nav-customization-config.d.ts","sourceRoot":"","sources":["../src/nav-customization-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAA0B,MAAM,qBAAqB,CAAC;AAE/E,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA8B,SAAQ,sBAAsB;IAC3E,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,eAAe,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,6BAA6B,EAC7B,YAAY,CACb,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,sBAAsB,CAMtE,CAAC;AAGL,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,6BAA6B,CAOpF,CAAC;AAEL,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,+BAA+B,CAMxF,CAAC;AAML,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAC/E,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,uBAAuB,CAAC,CAAC,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"nav-customization-config.d.ts","sourceRoot":"","sources":["../src/nav-customization-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA8B,SAAQ,sBAAsB;IAC3E,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,eAAe,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,6BAA6B,EAC7B,YAAY,CACb,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,sBAAsB,CAMtE,CAAC;AAGL,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,6BAA6B,CAOpF,CAAC;AAEL,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,+BAA+B,CAMxF,CAAC;AAML,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAC/E,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,uBAAuB,CAAC,CAAC,2BAA2B,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- 'use strict';var superstruct=require('superstruct'),b=require('color-string');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var b__default=/*#__PURE__*/_interopDefault(b);var z=Object.defineProperty;var m=(n,C)=>z(n,"name",{value:C,configurable:true});function N(n){if(typeof n!="string")return false;try{return !!b__default.default.get(n)}catch{return false}}m(N,"isColor");var k=superstruct.define("ColorStringStruct",n=>typeof n=="string"&&N(n)),t=superstruct.union([superstruct.type({type:superstruct.literal("value"),colorValue:k}),superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()})]);superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()});var u=superstruct.object({unit:superstruct.enums(["rem","px"]),value:superstruct.number()}),x=superstruct.union([superstruct.string(),superstruct.number()]);var L=superstruct.enums(["woff2","woff"]),W=superstruct.type({format:L,type:superstruct.literal("url"),path:superstruct.string()});superstruct.type({family:superstruct.optional(superstruct.string()),weight:superstruct.optional(superstruct.union([x,superstruct.size(superstruct.array(x),2)])),src:superstruct.optional(superstruct.array(W)),style:superstruct.optional(superstruct.string()),display:superstruct.optional(superstruct.enums(["auto","block","swap","fallback","optional"])),variationSettings:superstruct.optional(superstruct.string()),unicodeRange:superstruct.optional(superstruct.string())});superstruct.type({fontWeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),textColor:superstruct.optional(t),hoverColor:superstruct.optional(t),underline:superstruct.optional(superstruct.boolean()),textTransform:superstruct.optional(superstruct.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:superstruct.optional(superstruct.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var V=superstruct.type({min:u,max:superstruct.optional(u)}),h=superstruct.type({fontSize:superstruct.optional(V),lineHeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),fontWeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),letterSpacing:superstruct.optional(superstruct.string()),fontFamily:superstruct.optional(superstruct.string()),textColor:superstruct.optional(t),textTransform:superstruct.optional(superstruct.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:superstruct.optional(superstruct.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var S=superstruct.union([h,superstruct.type({accentColor:superstruct.optional(t)})]),ne=superstruct.union([S,superstruct.type({hoverColor:superstruct.optional(t),backgroundColor:superstruct.optional(t)})]),ie=superstruct.union([S,superstruct.type({backgroundColor:superstruct.optional(t)})]),P={},H={},U={},re={primaryNav:U,secondaryNav:H,tabs:P};exports.NavCustomizationConfigStruct=S;exports.PrimaryNavCustomizationConfigStruct=ne;exports.SecondaryNavCustomizationConfigStruct=ie;exports.customizableNavElements=re;//# sourceMappingURL=nav-customization-config.js.map
1
+ 'use strict';var superstruct=require('superstruct'),b=require('color-string');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var b__default=/*#__PURE__*/_interopDefault(b);var z=Object.defineProperty;var m=(n,C)=>z(n,"name",{value:C,configurable:true});function N(n){if(typeof n!="string")return false;try{return !!b__default.default.get(n)}catch{return false}}m(N,"isColor");var k=superstruct.define("ColorStringStruct",n=>typeof n=="string"&&N(n)),t=superstruct.union([superstruct.type({type:superstruct.literal("value"),colorValue:k}),superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()})]);superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()});var u=superstruct.object({unit:superstruct.enums(["rem","px"]),value:superstruct.number()}),x=superstruct.union([superstruct.string(),superstruct.number()]);var L=superstruct.enums(["woff2","woff"]),W=superstruct.type({format:L,type:superstruct.literal("url"),path:superstruct.string()});superstruct.type({family:superstruct.optional(superstruct.string()),weight:superstruct.optional(superstruct.union([x,superstruct.size(superstruct.array(x),2)])),src:superstruct.optional(superstruct.array(W)),style:superstruct.optional(superstruct.string()),display:superstruct.optional(superstruct.enums(["auto","block","swap","fallback","optional"])),variationSettings:superstruct.optional(superstruct.string()),unicodeRange:superstruct.optional(superstruct.string())});superstruct.type({fontWeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),textColor:superstruct.optional(t),hoverColor:superstruct.optional(t),underline:superstruct.optional(superstruct.boolean()),textTransform:superstruct.optional(superstruct.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:superstruct.optional(superstruct.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var V=superstruct.type({min:u,max:superstruct.optional(u)}),h=superstruct.type({fontSize:superstruct.optional(V),lineHeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),fontWeight:superstruct.optional(superstruct.union([superstruct.string(),superstruct.number()])),letterSpacing:superstruct.optional(superstruct.string()),fontFamily:superstruct.optional(superstruct.string()),textColor:superstruct.optional(t),textTransform:superstruct.optional(superstruct.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:superstruct.optional(superstruct.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var S=superstruct.union([h,superstruct.type({accentColor:superstruct.optional(t)})]),Z=superstruct.union([S,superstruct.type({hoverColor:superstruct.optional(t),backgroundColor:superstruct.optional(t)})]),_=superstruct.union([S,superstruct.type({backgroundColor:superstruct.optional(t)})]),P={},H={},U={},$={primaryNav:U,secondaryNav:H,tabs:P};exports.NavCustomizationConfigStruct=S;exports.PrimaryNavCustomizationConfigStruct=Z;exports.SecondaryNavCustomizationConfigStruct=_;exports.customizableNavElements=$;//# sourceMappingURL=nav-customization-config.js.map
2
2
  //# sourceMappingURL=nav-customization-config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceFormatsEnumStruct","FontFaceSourceStruct","optional","size","array","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements"],"mappings":"+QAIA,SAASA,CAAQC,CAAAA,CAAAA,CAAiC,CAChD,GAAI,OAAOA,GAAU,QAAU,CAAA,OAAO,OACtC,GAAI,CACF,OAAO,CAAC,CAACC,kBAAAA,CAAY,IAAID,CAAK,CAChC,CAAY,KAAA,CACV,OAAO,MACT,CACF,CAPSE,CAAAA,CAAAH,CAAA,CAAA,SAAA,CAAA,CAkBII,IAAAA,CAAAA,CAAoBC,mBAC/B,mBACCC,CAAAA,CAAAA,EAAU,OAAOA,CAAU,EAAA,QAAA,EAAYN,EAAQM,CAAK,CACvD,CAEaC,CAAAA,CAAAA,CAA2CC,iBAAM,CAAA,CAC5DC,iBAAK,CACH,IAAA,CAAMC,mBAAQ,CAAA,OAAO,CACrB,CAAA,UAAA,CAAYN,CACd,CAAC,CAAA,CACDK,gBAAK,CAAA,CACH,IAAMC,CAAAA,mBAAAA,CAAQ,cAAc,CAC5B,CAAA,SAAA,CAAWC,oBACb,CAAC,CACH,CAAC,CAAA,CAGiEF,gBAAAA,CAAK,CACrE,IAAA,CAAMC,oBAAQ,cAAc,CAAA,CAC5B,SAAWC,CAAAA,kBAAAA,EACb,CAAC,EClBM,IAAMC,CAAAA,CAAuDC,mBAAO,CACzE,IAAA,CAAMC,iBAAM,CAAA,CAAC,KAAO,CAAA,IAAI,CAAC,CACzB,CAAA,KAAA,CAAOC,oBACT,CAAC,EAIYC,CAAiDR,CAAAA,iBAAAA,CAAM,CAClEG,kBAAAA,EACAI,CAAAA,kBAAAA,EACF,CAAC,CAAA,CAgBYE,IAAAA,CAAAA,CAA4BH,iBAAM,CAAA,CAAC,QAAS,MAAM,CAAC,CAEnDI,CAAAA,CAAAA,CAAiDT,gBAAK,CAAA,CACjE,OAAQQ,CACR,CAAA,IAAA,CAAMP,oBAAQ,KAAK,CAAA,C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,CAAAA,CAAAA,CAA+D,EAAC,CAEzDC,EAA0B,CAAA,CACrC,WAAYD,CACZ,CAAA,YAAA,CAAcD,CACd,CAAA,IAAA,CAAMD,CACR","file":"nav-customization-config.js","sourcesContent":["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"]}
1
+ {"version":3,"sources":["../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceFormatsEnumStruct","FontFaceSourceStruct","optional","size","array","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements"],"mappings":"+QAWA,SAASA,CAAAA,CAAQC,CAAAA,CAAiC,CAChD,GAAI,OAAOA,GAAU,QAAA,CAAU,OAAO,OACtC,G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,CAASX,iBAAAA,CAAM,CAACG,kBAAAA,EAAO,CAAGI,kBAAAA,EAAQ,CAAC,CAAC,EAChD,aAAA,CAAeI,oBAAAA,CAASR,oBAAQ,CAAA,CAChC,WAAYQ,oBAAAA,CAASR,kBAAAA,EAAQ,CAAA,CAC7B,SAAA,CAAWQ,oBAAAA,CAASZ,CAAiB,CAAA,CACrC,aAAA,CAAeY,oBAAAA,CACbL,iBAAAA,CAAM,CAAC,SAAA,CAAW,aAAc,WAAA,CAAa,WAAW,CAAC,CAC3D,CAAA,CACA,WAAA,CAAaK,qBACXL,iBAAAA,CAAM,CACJ,kBACA,iBAAA,CACA,WAAA,CACA,iBACA,QAAA,CACA,eAAA,CACA,UAAA,CACA,gBAAA,CACA,gBACF,CAAC,CACH,CACF,CAAC,EC1MM,IAAMW,CAAAA,CACXjB,iBAAAA,CAAM,CACJgB,CAAAA,CACAf,gBAAAA,CAAK,CACH,WAAA,CAAaU,oBAAAA,CAASZ,CAAiB,CACzC,CAAC,CACH,CAAC,CAAA,CAGUmB,CAAAA,CACXlB,kBAAM,CACJiB,CAAAA,CACAhB,gBAAAA,CAAK,CACH,UAAA,CAAYU,oBAAAA,CAASZ,CAAiB,CAAA,CACtC,eAAA,CAAiBY,oBAAAA,CAASZ,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEUoB,CAAAA,CACXnB,iBAAAA,CAAM,CACJiB,CAAAA,CACAhB,iBAAK,CACH,eAAA,CAAiBU,oBAAAA,CAASZ,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEGqB,CAAAA,CAAiD,EAAC,CAClDC,CAAAA,CAAmE,EAAC,CACpEC,CAAAA,CAA+D,EAAC,CAEzDC,CAAAA,CAA0B,CACrC,WAAYD,CAAAA,CACZ,YAAA,CAAcD,CAAAA,CACd,IAAA,CAAMD,CACR","file":"nav-customization-config.js","sourcesContent":["import colorString from 'color-string';\nimport {\n define,\n type Describe,\n literal,\n string,\n type,\n union,\n} 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 type 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 { type 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 { type Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { type ColorConfig, ColorConfigStruct } from './color-config';\nimport {\n type TypographyConfig,\n TypographyConfigStruct,\n} 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"]}
@@ -1,2 +1,2 @@
1
- import {define,union,type,literal,string,object,number,enums,optional,array,size,boolean}from'superstruct';import b from'color-string';var z=Object.defineProperty;var m=(n,C)=>z(n,"name",{value:C,configurable:true});function N(n){if(typeof n!="string")return false;try{return !!b.get(n)}catch{return false}}m(N,"isColor");var k=define("ColorStringStruct",n=>typeof n=="string"&&N(n)),t=union([type({type:literal("value"),colorValue:k}),type({type:literal("design-token"),tokenName:string()})]);type({type:literal("design-token"),tokenName:string()});var u=object({unit:enums(["rem","px"]),value:number()}),x=union([string(),number()]);var L=enums(["woff2","woff"]),W=type({format:L,type:literal("url"),path:string()});type({family:optional(string()),weight:optional(union([x,size(array(x),2)])),src:optional(array(W)),style:optional(string()),display:optional(enums(["auto","block","swap","fallback","optional"])),variationSettings:optional(string()),unicodeRange:optional(string())});type({fontWeight:optional(union([string(),number()])),textColor:optional(t),hoverColor:optional(t),underline:optional(boolean()),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var V=type({min:u,max:optional(u)}),h=type({fontSize:optional(V),lineHeight:optional(union([string(),number()])),fontWeight:optional(union([string(),number()])),letterSpacing:optional(string()),fontFamily:optional(string()),textColor:optional(t),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var S=union([h,type({accentColor:optional(t)})]),ne=union([S,type({hoverColor:optional(t),backgroundColor:optional(t)})]),ie=union([S,type({backgroundColor:optional(t)})]),P={},H={},U={},re={primaryNav:U,secondaryNav:H,tabs:P};export{S as NavCustomizationConfigStruct,ne as PrimaryNavCustomizationConfigStruct,ie as SecondaryNavCustomizationConfigStruct,re as customizableNavElements};//# sourceMappingURL=nav-customization-config.mjs.map
1
+ import {define,union,type,literal,string,object,number,enums,optional,array,size,boolean}from'superstruct';import b from'color-string';var z=Object.defineProperty;var m=(n,C)=>z(n,"name",{value:C,configurable:true});function N(n){if(typeof n!="string")return false;try{return !!b.get(n)}catch{return false}}m(N,"isColor");var k=define("ColorStringStruct",n=>typeof n=="string"&&N(n)),t=union([type({type:literal("value"),colorValue:k}),type({type:literal("design-token"),tokenName:string()})]);type({type:literal("design-token"),tokenName:string()});var u=object({unit:enums(["rem","px"]),value:number()}),x=union([string(),number()]);var L=enums(["woff2","woff"]),W=type({format:L,type:literal("url"),path:string()});type({family:optional(string()),weight:optional(union([x,size(array(x),2)])),src:optional(array(W)),style:optional(string()),display:optional(enums(["auto","block","swap","fallback","optional"])),variationSettings:optional(string()),unicodeRange:optional(string())});type({fontWeight:optional(union([string(),number()])),textColor:optional(t),hoverColor:optional(t),underline:optional(boolean()),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var V=type({min:u,max:optional(u)}),h=type({fontSize:optional(V),lineHeight:optional(union([string(),number()])),fontWeight:optional(union([string(),number()])),letterSpacing:optional(string()),fontFamily:optional(string()),textColor:optional(t),textTransform:optional(enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:optional(enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))});var S=union([h,type({accentColor:optional(t)})]),Z=union([S,type({hoverColor:optional(t),backgroundColor:optional(t)})]),_=union([S,type({backgroundColor:optional(t)})]),P={},H={},U={},$={primaryNav:U,secondaryNav:H,tabs:P};export{S as NavCustomizationConfigStruct,Z as PrimaryNavCustomizationConfigStruct,_ as SecondaryNavCustomizationConfigStruct,$ as customizableNavElements};//# sourceMappingURL=nav-customization-config.mjs.map
2
2
  //# sourceMappingURL=nav-customization-config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceFormatsEnumStruct","FontFaceSourceStruct","optional","size","array","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements"],"mappings":"wNAIA,SAASA,CAAQC,CAAAA,CAAAA,CAAiC,CAChD,GAAI,OAAOA,GAAU,QAAU,CAAA,OAAO,OACtC,GAAI,CACF,OAAO,CAAC,CAACC,CAAAA,CAAY,IAAID,CAAK,CAChC,CAAY,KAAA,CACV,OAAO,MACT,CACF,CAPSE,CAAAA,CAAAH,CAAA,CAAA,SAAA,CAAA,CAkBII,IAAAA,CAAAA,CAAoBC,OAC/B,mBACCC,CAAAA,CAAAA,EAAU,OAAOA,CAAU,EAAA,QA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WAAW,CAAC,CAC3D,CACA,CAAA,WAAA,CAAaK,SACXL,KAAM,CAAA,CACJ,kBACA,iBACA,CAAA,WAAA,CACA,iBACA,QACA,CAAA,eAAA,CACA,UACA,CAAA,gBAAA,CACA,gBACF,CAAC,CACH,CACF,CAAC,EC7MM,IAAMW,CACXjB,CAAAA,KAAAA,CAAM,CACJgB,CACAf,CAAAA,IAAAA,CAAK,CACH,WAAA,CAAaU,QAASZ,CAAAA,CAAiB,CACzC,CAAC,CACH,CAAC,CAGUmB,CAAAA,EAAAA,CACXlB,MAAM,CACJiB,CAAAA,CACAhB,IAAK,CAAA,CACH,UAAYU,CAAAA,QAAAA,CAASZ,CAAiB,CACtC,CAAA,eAAA,CAAiBY,QAASZ,CAAAA,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEUoB,EACXnB,CAAAA,KAAAA,CAAM,CACJiB,CAAAA,CACAhB,KAAK,CACH,eAAA,CAAiBU,QAASZ,CAAAA,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEGqB,CAAiD,CAAA,EACjDC,CAAAA,CAAAA,CAAmE,EACnEC,CAAAA,CAAAA,CAA+D,EAAC,CAEzDC,EAA0B,CAAA,CACrC,WAAYD,CACZ,CAAA,YAAA,CAAcD,CACd,CAAA,IAAA,CAAMD,CACR","file":"nav-customization-config.mjs","sourcesContent":["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"]}
1
+ {"version":3,"sources":["../src/color-config.ts","../src/typography-config.ts","../src/nav-customization-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","FontSizeConfigValStruct","object","enums","number","FontFaceWeightStruct","FontFaceFormatsEnumStruct","FontFaceSourceStruct","optional","size","array","boolean","FontSizeConfigStruct","TypographyConfigStruct","NavCustomizationConfigStruct","PrimaryNavCustomizationConfigStruct","SecondaryNavCustomizationConfigStruct","navCustomizationConfig","secondaryNavCustomizationConfig","primaryNavCustomizationConfig","customizableNavElements"],"mappings":"wNAWA,SAASA,CAAAA,CAAQC,CAAAA,CAAiC,CAChD,GAAI,OAAOA,GAAU,QAAA,CAAU,OAAO,OACtC,GAAI,CACF,OAAO,CAAC,CAACC,CAAAA,CAAY,IAAID,CAAK,CAChC,CAAA,KAAY,CACV,OAAO,MACT,CACF,CAPSE,CAAAA,CAAAH,CAAAA,CAAA,SAAA,CAAA,CAkBF,IAAMI,CAAAA,CAAoBC,OAC/B,mBAAA,CACCC,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAA,EAAYN,EAAQM,CAAK,CACvD,CAAA,CAEaC,CAAAA,CAA2CC,KAAAA,CAAM,CAC5DC,KAAK,CACH,IAAA,CAAMC,OAAAA,CAAQ,OAAO,CAAA,CACrB,UAAA,CAAYN,CACd,CAAC,CAAA,CACDK,IAAAA,CAAK,CACH,IAAA,CAAMC,OAAAA,CAAQ,cAAc,CAAA,CAC5B,SAAA,CAAWC,QACb,CAAC,CACH,CAAC,CAAA,CAGiEF,IAAAA,CAAK,CACrE,IAAA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AC,CAAA,CAGUmB,CAAAA,CACXlB,MAAM,CACJiB,CAAAA,CACAhB,IAAAA,CAAK,CACH,UAAA,CAAYU,QAAAA,CAASZ,CAAiB,CAAA,CACtC,eAAA,CAAiBY,QAAAA,CAASZ,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEUoB,CAAAA,CACXnB,KAAAA,CAAM,CACJiB,CAAAA,CACAhB,KAAK,CACH,eAAA,CAAiBU,QAAAA,CAASZ,CAAiB,CAC7C,CAAC,CACH,CAAC,CAAA,CAEGqB,CAAAA,CAAiD,EAAC,CAClDC,CAAAA,CAAmE,EAAC,CACpEC,CAAAA,CAA+D,EAAC,CAEzDC,CAAAA,CAA0B,CACrC,WAAYD,CAAAA,CACZ,YAAA,CAAcD,CAAAA,CACd,IAAA,CAAMD,CACR","file":"nav-customization-config.mjs","sourcesContent":["import colorString from 'color-string';\nimport {\n define,\n type Describe,\n literal,\n string,\n type,\n union,\n} 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 type 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 { type 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 { type Describe, type, union, optional } from 'superstruct'; // https://docs.superstructjs.org\nimport { type ColorConfig, ColorConfigStruct } from './color-config';\nimport {\n type TypographyConfig,\n TypographyConfigStruct,\n} 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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/renderer-client-types.ts"],"names":["KsRendererClientEvents","ksRendererClientMetaId"],"mappings":"aAEO,IAAKA,OACVA,CAAA,CAAA,KAAA,CAAQ,OADEA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAoDCC,CAAyB,CAAA","file":"renderer-client-types.js","sourcesContent":["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 * Tracks the scroll position of the iframe's content\n */\n | {\n type: 'ksRendererClient.scrollPosition';\n scrollTop: number;\n scrollLeft: number;\n }\n /**\n * Sent when the iframe content is fully loaded\n */\n | {\n type: 'ksRendererClient.ready';\n };\n\n/**\n * Message sent from the App UI parent window to the renderer client (in the iframe)\n * using `window.parent.postMessage()`.\n */\nexport type KsRendererIncomingMsg = {\n type: 'ksRendererClient.updateScrollPosition';\n scrollTop: number;\n scrollLeft: number;\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"]}
1
+ {"version":3,"sources":["../src/renderer-client-types.ts"],"names":["KsRendererClientEvents","ksRendererClientMetaId"],"mappings":"aAEO,IAAKA,OACVA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CADEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAoDCC,CAAAA,CAAyB","file":"renderer-client-types.js","sourcesContent":["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 * Tracks the scroll position of the iframe's content\n */\n | {\n type: 'ksRendererClient.scrollPosition';\n scrollTop: number;\n scrollLeft: number;\n }\n /**\n * Sent when the iframe content is fully loaded\n */\n | {\n type: 'ksRendererClient.ready';\n };\n\n/**\n * Message sent from the App UI parent window to the renderer client (in the iframe)\n * using `window.parent.postMessage()`.\n */\nexport type KsRendererIncomingMsg = {\n type: 'ksRendererClient.updateScrollPosition';\n scrollTop: number;\n scrollLeft: number;\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/renderer-client-types.ts"],"names":["KsRendererClientEvents","ksRendererClientMetaId"],"mappings":"AAEO,IAAKA,OACVA,CAAA,CAAA,KAAA,CAAQ,OADEA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAoDCC,CAAyB,CAAA","file":"renderer-client-types.mjs","sourcesContent":["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 * Tracks the scroll position of the iframe's content\n */\n | {\n type: 'ksRendererClient.scrollPosition';\n scrollTop: number;\n scrollLeft: number;\n }\n /**\n * Sent when the iframe content is fully loaded\n */\n | {\n type: 'ksRendererClient.ready';\n };\n\n/**\n * Message sent from the App UI parent window to the renderer client (in the iframe)\n * using `window.parent.postMessage()`.\n */\nexport type KsRendererIncomingMsg = {\n type: 'ksRendererClient.updateScrollPosition';\n scrollTop: number;\n scrollLeft: number;\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"]}
1
+ {"version":3,"sources":["../src/renderer-client-types.ts"],"names":["KsRendererClientEvents","ksRendererClientMetaId"],"mappings":"AAEO,IAAKA,OACVA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CADEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAoDCC,CAAAA,CAAyB","file":"renderer-client-types.mjs","sourcesContent":["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 * Tracks the scroll position of the iframe's content\n */\n | {\n type: 'ksRendererClient.scrollPosition';\n scrollTop: number;\n scrollLeft: number;\n }\n /**\n * Sent when the iframe content is fully loaded\n */\n | {\n type: 'ksRendererClient.ready';\n };\n\n/**\n * Message sent from the App UI parent window to the renderer client (in the iframe)\n * using `window.parent.postMessage()`.\n */\nexport type KsRendererIncomingMsg = {\n type: 'ksRendererClient.updateScrollPosition';\n scrollTop: number;\n scrollLeft: number;\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"]}
@@ -10,6 +10,8 @@ export declare const rendererIds: {
10
10
  readonly hbs: "hbs";
11
11
  readonly angular: "angular";
12
12
  readonly html: "html";
13
+ readonly ios: "ios";
14
+ readonly android: "android";
13
15
  };
14
16
  /**
15
17
  * The ID of a renderer, e.g. 'react', 'vue', 'angular', etc.
@@ -77,6 +79,21 @@ export type TemplateInfo<TheRendererId extends RendererId = RendererId> = Extrac
77
79
  } | {
78
80
  rendererId: 'hbs';
79
81
  codeSrcPath: CodeSrc['path'];
82
+ } | {
83
+ rendererId: 'ios';
84
+ /** The library name that exports out several symbols/components */
85
+ moduleName: PathPackage;
86
+ /** The exported name of the component */
87
+ symbolName: string;
88
+ } | {
89
+ rendererId: 'android';
90
+ /**
91
+ * The library name that exports out several classes/components
92
+ * Example: `com.google.android.material`
93
+ */
94
+ packageName: PathPackage;
95
+ /** The exported name of the component */
96
+ componentName: string;
80
97
  }, {
81
98
  rendererId: TheRendererId;
82
99
  }>;
@@ -192,4 +209,15 @@ export type PathWithTemplates = {
192
209
  suggestion: TemplateSuggestion;
193
210
  }[];
194
211
  };
212
+ export declare const metaForIosRenderer: TemplateRendererMeta;
213
+ export declare const metaForAndroidRenderer: TemplateRendererMeta;
214
+ export declare const rendererIdsForNativeMobile: ["ios", "android"];
215
+ export type RendererIdsForNativeMobile = (typeof rendererIdsForNativeMobile)[number];
216
+ export declare function isRendererIdForNativeMobile(rendererId: string): rendererId is RendererIdsForNativeMobile;
217
+ export declare function isTemplateInfoForNativeMobile(templateInfo: TemplateInfo): templateInfo is Extract<TemplateInfo, {
218
+ rendererId: RendererIdsForNativeMobile;
219
+ }>;
220
+ export type TemplateInfoForNativeMobile = Extract<TemplateInfo, {
221
+ rendererId: RendererIdsForNativeMobile;
222
+ }>;
195
223
  //# sourceMappingURL=renderers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../src/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,OAAO,EACR,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,uBAAuB,EACvB,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAClD,MAAM,MAAM,OAAO,GACf;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,iBAAiB,EAAE,WAAW,CAAC;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;CACxB,GACD;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,kBAAkB,CAAC;IACzB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BAAkB,CAAC;QACjC,GAAG,EAAE,WAAW,CAAC;QACjB,UAAU,EAAE,kBAAkB,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,oBAahC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,oBAapC,CAAC;AAEF,eAAO,MAAM,0BAA0B,oBAGN,CAAC;AAElC,MAAM,MAAM,0BAA0B,GACpC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GACjB,UAAU,IAAI,0BAA0B,CAI1C;AAED,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,YAAY,GACzB,YAAY,IAAI,OAAO,CACxB,YAAY,EACZ;IAAE,UAAU,EAAE,0BAA0B,CAAA;CAAE,CAC3C,CAEA;AAED,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,YAAY,EACZ;IAAE,UAAU,EAAE,0BAA0B,CAAA;CAAE,CAC3C,CAAC"}
package/dist/renderers.js CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var zod=require('zod');var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:true});var i={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"},m=zod.z.strictObject({path:zod.z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:zod.z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function h(e){return "codeSrcPath"in e}r(h,"isTemplateInfoWithCodeSrcPath");function d(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(d,"createTemplateInfoId");function I(e){return {...e,id:d(e)}}r(I,"addIdToTemplateInfo");function g({rendererId:e,alias:t,path:n}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:n,exportName:t||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:n};case "twig":return {rendererId:e,namespacePath:t};case "web-components":return {rendererId:e,elementName:t};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}r(g,"normalizeTemplateInfo");function u(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(u,"convertTemplateInfoToOldWay");exports.CodeSrcUserConfigSchema=m;exports.addIdToTemplateInfo=I;exports.convertTemplateInfoToOldWay=u;exports.createTemplateInfoId=d;exports.isTemplateInfoWithCodeSrcPath=h;exports.normalizeTemplateInfo=g;exports.rendererIds=i;//# sourceMappingURL=renderers.js.map
1
+ 'use strict';var zod=require('zod');var d=Object.defineProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:true});var n={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html",ios:"ios",android:"android"},I=zod.z.strictObject({path:zod.z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:zod.z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function u(e){return "codeSrcPath"in e}r(u,"isTemplateInfoWithCodeSrcPath");function p(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;case "ios":return `${e.rendererId}---${e.moduleName}---${e.symbolName}`;case "android":return `${e.rendererId}---${e.packageName}---${e.componentName}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(p,"createTemplateInfoId");function g(e){return {...e,id:p(e)}}r(g,"addIdToTemplateInfo");function T({rendererId:e,alias:t,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:t||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:t};case "web-components":return {rendererId:e,elementName:t};case "ios":return {rendererId:e,moduleName:a,symbolName:t};case "android":return {rendererId:e,packageName:a,componentName:t};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}r(T,"normalizeTemplateInfo");function f(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};case "ios":return {path:e.moduleName,alias:e.symbolName};case "android":return {path:e.packageName,alias:e.componentName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(f,"convertTemplateInfoToOldWay");var S={id:n.ios,title:"iOS",aliasUse:"required",aliasTitle:"Symbol Name",aliasDescription:"The synchronized name of the iOS symbol.",enableDataDemos:true,enableTemplateDemos:false,hasTemplateImgSupport:true,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},P={id:n.android,title:"Android",aliasUse:"required",aliasTitle:"Component Name",aliasDescription:"The synchronized name of the Android component.",enableDataDemos:true,enableTemplateDemos:false,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasTemplateImgSupport:true,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},s=[n.ios,n.android];function i(e){return s.includes(e)}r(i,"isRendererIdForNativeMobile");function R(e){return i(e.rendererId)}r(R,"isTemplateInfoForNativeMobile");exports.CodeSrcUserConfigSchema=I;exports.addIdToTemplateInfo=g;exports.convertTemplateInfoToOldWay=f;exports.createTemplateInfoId=p;exports.isRendererIdForNativeMobile=i;exports.isTemplateInfoForNativeMobile=R;exports.isTemplateInfoWithCodeSrcPath=u;exports.metaForAndroidRenderer=P;exports.metaForIosRenderer=S;exports.normalizeTemplateInfo=T;exports.rendererIds=n;exports.rendererIdsForNativeMobile=s;//# sourceMappingURL=renderers.js.map
2
2
  //# sourceMappingURL=renderers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/renderers.ts"],"names":["rendererIds","CodeSrcUserConfigSchema","z","val","isTemplateInfoWithCodeSrcPath","info","__name","createTemplateInfoId","t","addIdToTemplateInfo","normalizeTemplateInfo","rendererId","alias","path","convertTemplateInfoToOldWay"],"mappings":"oCAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,IAAA,CAAA,CAAA,CAgBO,IAAMA,EAAc,CACzB,KAAA,CAAO,OACP,CAAA,GAAA,CAAK,MACL,gBAAkB,CAAA,gBAAA,CAClB,IAAM,CAAA,MAAA,CACN,IAAK,KACL,CAAA,OAAA,CAAS,SACT,CAAA,IAAA,CAAM,MACR,CAAA,CAuCaC,CAA0BC,CAAAA,KAAAA,CAAE,aAAa,CACpD,IAAA,CAAMA,KACH,CAAA,MAAA,GACA,QACC,CAAA,gGACF,CACF,CAAA,MAAA,CAAQA,MACL,MAAmCC,CAAAA,CAAAA,EAC3B,OAAOA,CAAAA,EAAQ,UACvB,CAAA,CACA,QAAS,EAAA,CACT,SAAS,oDAAoD,CAClE,CAAC,EA4DM,SAASC,CACdC,CAAAA,CAAAA,CACqC,CACrC,OAAO,gBAAiBA,CAC1B,CAJgBC,CAAAF,CAAAA,CAAAA,CAAA,iCAWT,SAASG,CAAAA,CAAqBC,CAAiC,CAAA,CACpE,OAAQA,CAAE,CAAA,UAAA,EACR,KAAK,UACL,KAAK,OAAA,CACH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,CACjB,EACF,KAAK,gBAAA,CACH,OAAO,CACL,WAAAD,CACA,CAAA,WAAA,CAAaC,CACf,CAAA,CACF,QAAS,CAEP,MAAM,IAAI,KAAA,CAAM,CAAwBD,qBAAAA,EAAAA,CAAU,EAAE,CACtD,CACF,CACF,CAAA,GAGF,CA3CgBL,CAAAI,CAAAA,CAAAA,CAAA,yBA0DT,SAASI,CAAAA,CAA4BT,CAG1C,CAAA,CACA,OAAQA,CAAK,CAAA,UAAA,EACX,KAAK,QACL,KAAK,SAAA,CACH,OAAO,CACL,IAAMA,CAAAA,CAAAA,CAAK,WACX,CAAA,KAAA,CAAOA,EAAK,UACd,CAAA,CACF,KAAK,KAAA,CACL,KAAK,MACL,CAAA,KAAK,KACH,CAAA,OAAO,CACL,IAAMA,CAAAA,CAAAA,CAAK,WACb,CAAA,CACF,KAAK,MAAA,CACH,OAAO,CACL,MAAOA,CAAK,CAAA,aACd,CACF,CAAA,KAAK,iBACH,OAAO,CACL,KAAOA,CAAAA,CAAAA,CAAK,WACd,CACF,CAAA,QAAS,CAEP,MAAM,IAAI,KAAA,CAAM,0BAA0B,IAAK,CAAA,SAAA,CAAUA,CAAI,CAAC,EAAE,CAClE,CACF,CACF,CA9BgBC,EAAAQ,CAAA,CAAA,6BAAA,CAAA","file":"renderers.js","sourcesContent":["import { z } from 'zod';\nimport type {\n PathPackage,\n PathPackageSubPath,\n PathRelative,\n Branded,\n} from './re-exports';\nimport type {\n KnapsackPatternTemplate,\n TemplateDemo,\n TemplateRendererMeta,\n KsSpecMeta,\n KsTemplateSpec,\n} from './app-client-data/patterns';\nimport type { Simplify } from './type-utils';\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;\nexport type CodeSrc =\n | {\n type: 'package';\n path: PathPackage;\n pathFromOutputDir: PathPackage;\n pkgName: PathPackage;\n rendererId: RendererId;\n }\n | {\n type: 'package-sub-path';\n path: PathPackageSubPath;\n pathFromOutputDir: PathPackageSubPath;\n pkgName: PathPackage;\n subPath: PathRelative;\n rendererId: RendererId;\n }\n | {\n type: 'relative-from-data-dir';\n rendererId: RendererId;\n path: PathRelative;\n pathFromOutputDir: PathRelative;\n };\n\nexport type CodeSrcUserConfig = {\n /**\n * Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths\n */\n path: string;\n filter?: (path: string) => boolean;\n};\n\nexport const CodeSrcUserConfigSchema = z.strictObject({\n path: z\n .string()\n .describe(\n 'Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths',\n ),\n filter: z\n .custom<(path: string) => boolean>((val) => {\n return typeof val === 'function';\n })\n .optional()\n .describe('A function that takes a path and returns a boolean'),\n});\n\nexport type TemplateInfoId = Branded<string, 'TemplateInfoId'>;\n\nexport type TemplateInfo<TheRendererId extends RendererId = RendererId> =\n Extract<\n | {\n rendererId: 'react';\n codeSrcPath: CodeSrc['path'];\n /**\n * Name of the export. If it's the default export, this will be `'default'`.\n */\n exportName: string;\n }\n | {\n rendererId: 'vue';\n codeSrcPath: CodeSrc['path'];\n }\n | {\n rendererId: 'web-components';\n elementName: string;\n }\n | {\n rendererId: 'angular';\n codeSrcPath: CodeSrc['path'];\n /**\n * Name of the export. If it's the default export, this will be `'default'`.\n */\n exportName: string;\n }\n | {\n rendererId: 'html';\n codeSrcPath: CodeSrc['path'];\n }\n | {\n rendererId: 'twig';\n namespacePath: string;\n }\n | {\n rendererId: 'hbs';\n codeSrcPath: CodeSrc['path'];\n },\n { rendererId: TheRendererId }\n >;\n\nexport type TemplateInfoWithId<TheRendererId extends RendererId = RendererId> =\n Extract<\n Simplify<\n TemplateInfo<TheRendererId> & {\n id: TemplateInfoId;\n }\n >,\n { rendererId: TheRendererId }\n >;\n\nexport type TemplateInfoWithCodeSrcPath = Extract<\n TemplateInfo,\n { codeSrcPath: string }\n>;\n\nexport function isTemplateInfoWithCodeSrcPath(\n info: TemplateInfo,\n): info is TemplateInfoWithCodeSrcPath {\n return 'codeSrcPath' in info;\n}\n\n/**\n * Create a unique ID for a template info\n * This is used to identify the template info by a single unique string\n * @returns A unique ID for the template info\n */\nexport function createTemplateInfoId(t: TemplateInfo): TemplateInfoId {\n switch (t.rendererId) {\n case 'angular':\n case 'react':\n return `${t.rendererId}---${t.codeSrcPath}---${\n t.exportName || 'default'\n }` as TemplateInfoId;\n case 'web-components':\n return `${t.rendererId}---${t.elementName}` as TemplateInfoId;\n case 'twig':\n return `${t.rendererId}---${t.namespacePath}` as TemplateInfoId;\n case 'vue':\n case 'hbs':\n case 'html':\n return `${t.rendererId}---${t.codeSrcPath}` as TemplateInfoId;\n default: {\n const _: never = t;\n throw new Error(`Invalid template info: ${JSON.stringify(t)}`);\n }\n }\n}\n\nexport function addIdToTemplateInfo<TheRendererId extends RendererId>(\n t: TemplateInfo<TheRendererId>,\n): TemplateInfoWithId<TheRendererId> {\n return {\n ...t,\n id: createTemplateInfoId(t),\n };\n}\n\n/**\n * Converts old way of specifying template info (`path` & `alias`) to new way {@link TemplateInfo}\n * @see {@link convertTemplateInfoToOldWay} for the reverse\n */\nexport function normalizeTemplateInfo<TheRendererId extends RendererId>({\n rendererId,\n alias,\n path,\n}: {\n rendererId: TheRendererId;\n path?: CodeSrc['path'];\n alias?: string;\n}): TemplateInfo<TheRendererId> {\n const info = ((): TemplateInfo => {\n switch (rendererId) {\n case 'react':\n case 'angular':\n return {\n rendererId,\n codeSrcPath: path,\n exportName: alias || 'default',\n };\n case 'vue':\n case 'hbs':\n case 'html':\n return {\n rendererId,\n codeSrcPath: path,\n };\n case 'twig':\n return {\n rendererId,\n namespacePath: alias,\n };\n case 'web-components':\n return {\n rendererId,\n elementName: alias,\n };\n default: {\n const _: never = rendererId;\n throw new Error(`Invalid renderer ID: ${rendererId}`);\n }\n }\n })();\n\n return info as TemplateInfo<TheRendererId>;\n}\n\nexport type RendererTemplateConfig = {\n templateInfo: TemplateInfo;\n /**\n * If it's stored here, it's never inferred\n */\n spec?: KsTemplateSpec<false | undefined>;\n specMeta?: KsSpecMeta;\n};\n\n/**\n * Converts new way of specifying template info {@link TemplateInfo} to old way (`path` & `alias`)\n * @see {@link normalizeTemplateInfo} for the reverse\n */\nexport function convertTemplateInfoToOldWay(info: TemplateInfo): {\n path?: string;\n alias?: string;\n} {\n switch (info.rendererId) {\n case 'react':\n case 'angular':\n return {\n path: info.codeSrcPath,\n alias: info.exportName,\n };\n case 'hbs':\n case 'html':\n case 'vue':\n return {\n path: info.codeSrcPath,\n };\n case 'twig':\n return {\n alias: info.namespacePath,\n };\n case 'web-components':\n return {\n alias: info.elementName,\n };\n default: {\n const _: never = info;\n throw new Error(`Invalid template info: ${JSON.stringify(info)}`);\n }\n }\n}\n\nexport type RendererDiscovery<TheRendererId extends RendererId> = {\n rendererId: TheRendererId;\n meta: TemplateRendererMeta;\n codeSrcsByPath: Record<CodeSrc['path'], CodeSrc>;\n templates: TemplateInfoWithId<TheRendererId>[];\n};\n\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 connected?: boolean;\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\nexport type TemplateUse = {\n patternId: string;\n patternTitle: string;\n templateId: string;\n templateTitle: string;\n};\n\nexport type PathWithTemplates = {\n path: string;\n templates: {\n id: TemplateInfoId;\n templateInfo: TemplateInfoWithId;\n use: TemplateUse;\n suggestion: TemplateSuggestion;\n }[];\n};\n"]}
1
+ {"version":3,"sources":["../src/renderers.ts"],"names":["rendererIds","CodeSrcUserConfigSchema","z","val","isTemplateInfoWithCodeSrcPath","info","__name","createTemplateInfoId","t","addIdToTemplateInfo","normalizeTemplateInfo","rendererId","alias","path","convertTemplateInfoToOldWay","metaForIosRenderer","metaForAndroidRenderer","rendererIdsForNativeMobile","isRendererIdForNativeMobile","isTemplateInfoForNativeMobile","templateInfo"],"mappings":"qHAgBO,IAAMA,CAAAA,CAAc,CACzB,KAAA,CAAO,OAAA,CACP,GAAA,CAAK,KAAA,CACL,gBAAA,CAAkB,gBAAA,CAClB,KAAM,MAAA,CACN,GAAA,CAAK,KAAA,CACL,OAAA,CAAS,SAAA,CACT,IAAA,CAAM,MAAA,CACN,GAAA,CAAK,KAAA,CACL,OAAA,CAAS,SACX,CAAA,CAuCaC,CAAAA,CAA0BC,KAAAA,CAAE,aAAa,CACpD,IAAA,CAAMA,KAAAA,CACH,MAAA,EAAO,CACP,QAAA,CACC,gGACF,CAAA,CACF,MAAA,CAAQA,KAAAA,CACL,MAAA,CAAmCC,CAAAA,EAC3B,OAAOA,CAAAA,EAAQ,UACvB,CAAA,CACA,QAAA,EAAS,CACT,QAAA,CAAS,oDAAoD,CAClE,CAAC,EA6EM,SAASC,CAAAA,CACdC,CAAAA,CACqC,CACrC,OAAO,aAAA,GAAiBA,CAC1B,CAJgBC,CAAAA,CAAAF,CAAAA,CAA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AY,OACd,EAKO,SAASkB,CAAAA,CACdP,CAAAA,CAC0C,CAC1C,OAAOM,CAAAA,CAA2B,QAAA,CAChCN,CACF,CACF,CANgBL,CAAAA,CAAAY,EAAA,6BAAA,CAAA,CAQT,SAASC,CAAAA,CACdC,CAAAA,CAIA,CACA,OAAOF,CAAAA,CAA4BE,CAAAA,CAAa,UAAU,CAC5D,CAPgBd,CAAAA,CAAAa,CAAAA,CAAA,+BAAA,CAAA","file":"renderers.js","sourcesContent":["import { z } from 'zod';\nimport type {\n PathPackage,\n PathPackageSubPath,\n PathRelative,\n Branded,\n} from './re-exports';\nimport type {\n KnapsackPatternTemplate,\n TemplateDemo,\n TemplateRendererMeta,\n KsSpecMeta,\n KsTemplateSpec,\n} from './app-client-data/patterns';\nimport type { Simplify } from './type-utils';\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 ios: 'ios',\n android: 'android',\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;\nexport type CodeSrc =\n | {\n type: 'package';\n path: PathPackage;\n pathFromOutputDir: PathPackage;\n pkgName: PathPackage;\n rendererId: RendererId;\n }\n | {\n type: 'package-sub-path';\n path: PathPackageSubPath;\n pathFromOutputDir: PathPackageSubPath;\n pkgName: PathPackage;\n subPath: PathRelative;\n rendererId: RendererId;\n }\n | {\n type: 'relative-from-data-dir';\n rendererId: RendererId;\n path: PathRelative;\n pathFromOutputDir: PathRelative;\n };\n\nexport type CodeSrcUserConfig = {\n /**\n * Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths\n */\n path: string;\n filter?: (path: string) => boolean;\n};\n\nexport const CodeSrcUserConfigSchema = z.strictObject({\n path: z\n .string()\n .describe(\n 'Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths',\n ),\n filter: z\n .custom<(path: string) => boolean>((val) => {\n return typeof val === 'function';\n })\n .optional()\n .describe('A function that takes a path and returns a boolean'),\n});\n\nexport type TemplateInfoId = Branded<string, 'TemplateInfoId'>;\n\nexport type TemplateInfo<TheRendererId extends RendererId = RendererId> =\n Extract<\n | {\n rendererId: 'react';\n codeSrcPath: CodeSrc['path'];\n /**\n * Name of the export. If it's the default export, this will be `'default'`.\n */\n exportName: string;\n }\n | {\n rendererId: 'vue';\n codeSrcPath: CodeSrc['path'];\n }\n | {\n rendererId: 'web-components';\n elementName: string;\n }\n | {\n rendererId: 'angular';\n codeSrcPath: CodeSrc['path'];\n /**\n * Name of the export. If it's the default export, this will be `'default'`.\n */\n exportName: string;\n }\n | {\n rendererId: 'html';\n codeSrcPath: CodeSrc['path'];\n }\n | {\n rendererId: 'twig';\n namespacePath: string;\n }\n | {\n rendererId: 'hbs';\n codeSrcPath: CodeSrc['path'];\n }\n | {\n rendererId: 'ios';\n /** The library name that exports out several symbols/components */\n moduleName: PathPackage;\n /** The exported name of the component */\n symbolName: string;\n }\n | {\n rendererId: 'android';\n /**\n * The library name that exports out several classes/components\n * Example: `com.google.android.material`\n */\n packageName: PathPackage;\n /** The exported name of the component */\n componentName: string;\n },\n { rendererId: TheRendererId }\n >;\n\nexport type TemplateInfoWithId<TheRendererId extends RendererId = RendererId> =\n Extract<\n Simplify<\n TemplateInfo<TheRendererId> & {\n id: TemplateInfoId;\n }\n >,\n { rendererId: TheRendererId }\n >;\n\nexport type TemplateInfoWithCodeSrcPath = Extract<\n TemplateInfo,\n { codeSrcPath: string }\n>;\n\nexport function isTemplateInfoWithCodeSrcPath(\n info: TemplateInfo,\n): info is TemplateInfoWithCodeSrcPath {\n return 'codeSrcPath' in info;\n}\n\n/**\n * Create a unique ID for a template info\n * This is used to identify the template info by a single unique string\n * @returns A unique ID for the template info\n */\nexport function createTemplateInfoId(t: TemplateInfo): TemplateInfoId {\n switch (t.rendererId) {\n case 'angular':\n case 'react':\n return `${t.rendererId}---${t.codeSrcPath}---${\n t.exportName || 'default'\n }` as TemplateInfoId;\n case 'web-components':\n return `${t.rendererId}---${t.elementName}` as TemplateInfoId;\n case 'twig':\n return `${t.rendererId}---${t.namespacePath}` as TemplateInfoId;\n case 'vue':\n case 'hbs':\n case 'html':\n return `${t.rendererId}---${t.codeSrcPath}` as TemplateInfoId;\n case 'ios':\n return `${t.rendererId}---${t.moduleName}---${t.symbolName}` as TemplateInfoId;\n case 'android':\n return `${t.rendererId}---${t.packageName}---${t.componentName}` as TemplateInfoId;\n default: {\n const _: never = t;\n throw new Error(`Invalid template info: ${JSON.stringify(t)}`);\n }\n }\n}\n\nexport function addIdToTemplateInfo<TheRendererId extends RendererId>(\n t: TemplateInfo<TheRendererId>,\n): TemplateInfoWithId<TheRendererId> {\n return {\n ...t,\n id: createTemplateInfoId(t),\n };\n}\n\n/**\n * Converts old way of specifying template info (`path` & `alias`) to new way {@link TemplateInfo}\n * @see {@link convertTemplateInfoToOldWay} for the reverse\n */\nexport function normalizeTemplateInfo<TheRendererId extends RendererId>({\n rendererId,\n alias,\n path,\n}: {\n rendererId: TheRendererId;\n path?: CodeSrc['path'];\n alias?: string;\n}): TemplateInfo<TheRendererId> {\n const info = ((): TemplateInfo => {\n switch (rendererId) {\n case 'react':\n case 'angular':\n return {\n rendererId,\n codeSrcPath: path,\n exportName: alias || 'default',\n };\n case 'vue':\n case 'hbs':\n case 'html':\n return {\n rendererId,\n codeSrcPath: path,\n };\n case 'twig':\n return {\n rendererId,\n namespacePath: alias,\n };\n case 'web-components':\n return {\n rendererId,\n elementName: alias,\n };\n // @TOOD: Just speculation for ios/android for now\n case 'ios':\n return {\n rendererId,\n moduleName: path as PathPackage,\n symbolName: alias,\n };\n case 'android':\n return {\n rendererId,\n packageName: path as PathPackage,\n componentName: alias,\n };\n default: {\n const _: never = rendererId;\n throw new Error(`Invalid renderer ID: ${rendererId}`);\n }\n }\n })();\n\n return info as TemplateInfo<TheRendererId>;\n}\n\nexport type RendererTemplateConfig = {\n templateInfo: TemplateInfo;\n /**\n * If it's stored here, it's never inferred\n */\n spec?: KsTemplateSpec<false | undefined>;\n specMeta?: KsSpecMeta;\n};\n\n/**\n * Converts new way of specifying template info {@link TemplateInfo} to old way (`path` & `alias`)\n * @see {@link normalizeTemplateInfo} for the reverse\n */\nexport function convertTemplateInfoToOldWay(info: TemplateInfo): {\n path?: string;\n alias?: string;\n} {\n switch (info.rendererId) {\n case 'react':\n case 'angular':\n return {\n path: info.codeSrcPath,\n alias: info.exportName,\n };\n case 'hbs':\n case 'html':\n case 'vue':\n return {\n path: info.codeSrcPath,\n };\n case 'twig':\n return {\n alias: info.namespacePath,\n };\n case 'web-components':\n return {\n alias: info.elementName,\n };\n case 'ios':\n return {\n path: info.moduleName,\n alias: info.symbolName,\n };\n case 'android':\n return {\n path: info.packageName,\n alias: info.componentName,\n };\n default: {\n const _: never = info;\n throw new Error(`Invalid template info: ${JSON.stringify(info)}`);\n }\n }\n}\n\nexport type RendererDiscovery<TheRendererId extends RendererId> = {\n rendererId: TheRendererId;\n meta: TemplateRendererMeta;\n codeSrcsByPath: Record<CodeSrc['path'], CodeSrc>;\n templates: TemplateInfoWithId<TheRendererId>[];\n};\n\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 connected?: boolean;\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\nexport type TemplateUse = {\n patternId: string;\n patternTitle: string;\n templateId: string;\n templateTitle: string;\n};\n\nexport type PathWithTemplates = {\n path: string;\n templates: {\n id: TemplateInfoId;\n templateInfo: TemplateInfoWithId;\n use: TemplateUse;\n suggestion: TemplateSuggestion;\n }[];\n};\n\nexport const metaForIosRenderer: TemplateRendererMeta = {\n id: rendererIds.ios,\n title: 'iOS',\n aliasUse: 'required',\n aliasTitle: 'Symbol Name',\n aliasDescription: 'The synchronized name of the iOS symbol.',\n enableDataDemos: true,\n enableTemplateDemos: false,\n hasTemplateImgSupport: true,\n hasSlotsSupport: false,\n hasSlotOptionsSupport: false,\n hasInferSpecSupport: true,\n hasTemplateSuggestionsSupport: true,\n};\n\nexport const metaForAndroidRenderer: TemplateRendererMeta = {\n id: rendererIds.android,\n title: 'Android',\n aliasUse: 'required',\n aliasTitle: 'Component Name',\n aliasDescription: 'The synchronized name of the Android component.',\n enableDataDemos: true,\n enableTemplateDemos: false,\n hasSlotsSupport: false,\n hasSlotOptionsSupport: false,\n hasTemplateImgSupport: true,\n hasInferSpecSupport: true,\n hasTemplateSuggestionsSupport: true,\n};\n\nexport const rendererIdsForNativeMobile = [\n rendererIds.ios,\n rendererIds.android,\n] as const satisfies RendererId[];\n\nexport type RendererIdsForNativeMobile =\n (typeof rendererIdsForNativeMobile)[number];\n\nexport function isRendererIdForNativeMobile(\n rendererId: string,\n): rendererId is RendererIdsForNativeMobile {\n return rendererIdsForNativeMobile.includes(\n rendererId as RendererIdsForNativeMobile,\n );\n}\n\nexport function isTemplateInfoForNativeMobile(\n templateInfo: TemplateInfo,\n): templateInfo is Extract<\n TemplateInfo,\n { rendererId: RendererIdsForNativeMobile }\n> {\n return isRendererIdForNativeMobile(templateInfo.rendererId);\n}\n\nexport type TemplateInfoForNativeMobile = Extract<\n TemplateInfo,\n { rendererId: RendererIdsForNativeMobile }\n>;\n"]}
@@ -1,2 +1,2 @@
1
- import {z}from'zod';var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:true});var i={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"},m=z.strictObject({path:z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function h(e){return "codeSrcPath"in e}r(h,"isTemplateInfoWithCodeSrcPath");function d(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(d,"createTemplateInfoId");function I(e){return {...e,id:d(e)}}r(I,"addIdToTemplateInfo");function g({rendererId:e,alias:t,path:n}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:n,exportName:t||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:n};case "twig":return {rendererId:e,namespacePath:t};case "web-components":return {rendererId:e,elementName:t};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}r(g,"normalizeTemplateInfo");function u(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(u,"convertTemplateInfoToOldWay");export{m as CodeSrcUserConfigSchema,I as addIdToTemplateInfo,u as convertTemplateInfoToOldWay,d as createTemplateInfoId,h as isTemplateInfoWithCodeSrcPath,g as normalizeTemplateInfo,i as rendererIds};//# sourceMappingURL=renderers.mjs.map
1
+ import {z}from'zod';var d=Object.defineProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:true});var n={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html",ios:"ios",android:"android"},I=z.strictObject({path:z.string().describe("Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths"),filter:z.custom(e=>typeof e=="function").optional().describe("A function that takes a path and returns a boolean")});function u(e){return "codeSrcPath"in e}r(u,"isTemplateInfoWithCodeSrcPath");function p(e){switch(e.rendererId){case "angular":case "react":return `${e.rendererId}---${e.codeSrcPath}---${e.exportName||"default"}`;case "web-components":return `${e.rendererId}---${e.elementName}`;case "twig":return `${e.rendererId}---${e.namespacePath}`;case "vue":case "hbs":case "html":return `${e.rendererId}---${e.codeSrcPath}`;case "ios":return `${e.rendererId}---${e.moduleName}---${e.symbolName}`;case "android":return `${e.rendererId}---${e.packageName}---${e.componentName}`;default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(p,"createTemplateInfoId");function g(e){return {...e,id:p(e)}}r(g,"addIdToTemplateInfo");function T({rendererId:e,alias:t,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:t||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:t};case "web-components":return {rendererId:e,elementName:t};case "ios":return {rendererId:e,moduleName:a,symbolName:t};case "android":return {rendererId:e,packageName:a,componentName:t};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}r(T,"normalizeTemplateInfo");function f(e){switch(e.rendererId){case "react":case "angular":return {path:e.codeSrcPath,alias:e.exportName};case "hbs":case "html":case "vue":return {path:e.codeSrcPath};case "twig":return {alias:e.namespacePath};case "web-components":return {alias:e.elementName};case "ios":return {path:e.moduleName,alias:e.symbolName};case "android":return {path:e.packageName,alias:e.componentName};default:{throw new Error(`Invalid template info: ${JSON.stringify(e)}`)}}}r(f,"convertTemplateInfoToOldWay");var S={id:n.ios,title:"iOS",aliasUse:"required",aliasTitle:"Symbol Name",aliasDescription:"The synchronized name of the iOS symbol.",enableDataDemos:true,enableTemplateDemos:false,hasTemplateImgSupport:true,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},P={id:n.android,title:"Android",aliasUse:"required",aliasTitle:"Component Name",aliasDescription:"The synchronized name of the Android component.",enableDataDemos:true,enableTemplateDemos:false,hasSlotsSupport:false,hasSlotOptionsSupport:false,hasTemplateImgSupport:true,hasInferSpecSupport:true,hasTemplateSuggestionsSupport:true},s=[n.ios,n.android];function i(e){return s.includes(e)}r(i,"isRendererIdForNativeMobile");function R(e){return i(e.rendererId)}r(R,"isTemplateInfoForNativeMobile");export{I as CodeSrcUserConfigSchema,g as addIdToTemplateInfo,f as convertTemplateInfoToOldWay,p as createTemplateInfoId,i as isRendererIdForNativeMobile,R as isTemplateInfoForNativeMobile,u as isTemplateInfoWithCodeSrcPath,P as metaForAndroidRenderer,S as metaForIosRenderer,T as normalizeTemplateInfo,n as rendererIds,s as rendererIdsForNativeMobile};//# sourceMappingURL=renderers.mjs.map
2
2
  //# sourceMappingURL=renderers.mjs.map