@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.
- package/.lintstagedrc.mjs +2 -2
- package/CHANGELOG.md +174 -0
- package/convert-types-to-json-schemas.ts +3 -1
- package/dist/acd-test-fixtures/empty.d.ts +1 -1
- package/dist/acd-test-fixtures/empty.d.ts.map +1 -1
- package/dist/acd-test-fixtures/index.js.map +1 -1
- package/dist/acd-test-fixtures/index.mjs.map +1 -1
- package/dist/api-routes.js.map +1 -1
- package/dist/api-routes.mjs.map +1 -1
- package/dist/app-client-data/blocks.d.ts +2 -1
- package/dist/app-client-data/blocks.d.ts.map +1 -1
- package/dist/app-client-data/blocks.settings.d.ts +2 -2
- package/dist/app-client-data/blocks.settings.d.ts.map +1 -1
- package/dist/app-client-data/design-tokens-types/token-data.d.ts +7 -7
- package/dist/app-client-data/design-tokens-types/token-data.d.ts.map +1 -1
- package/dist/app-client-data/design-tokens-types/token-definitions.d.ts.map +1 -1
- package/dist/app-client-data/design-tokens-types/token-src-value-info.d.ts +2 -2
- package/dist/app-client-data/design-tokens-types/token-src-value-info.d.ts.map +1 -1
- package/dist/app-client-data/design-tokens-types/token-src.d.ts +3 -3
- package/dist/app-client-data/design-tokens-types/token-src.d.ts.map +1 -1
- package/dist/app-client-data/index.d.ts +14 -6
- package/dist/app-client-data/index.d.ts.map +1 -1
- package/dist/app-client-data/page.d.ts +0 -6
- package/dist/app-client-data/page.d.ts.map +1 -1
- package/dist/app-client-data/page.header.d.ts +1 -1
- package/dist/app-client-data/page.header.d.ts.map +1 -1
- package/dist/app-client-data/patterns.d.ts +74 -0
- package/dist/app-client-data/patterns.d.ts.map +1 -1
- package/dist/app-client-data/types-to-json-schemas.d.ts.map +1 -1
- package/dist/app-client-data/validation.test.d.ts +2 -0
- package/dist/app-client-data/validation.test.d.ts.map +1 -0
- package/dist/app-client-data-migrations/4.1.7-demos.d.ts.map +1 -1
- package/dist/app-client-data-migrations/migration.types.d.ts +1 -1
- package/dist/app-client-data-migrations/migration.types.d.ts.map +1 -1
- package/dist/app-client-data-v3/index.d.ts +1 -1
- package/dist/app-client-data-v3/index.d.ts.map +1 -1
- package/dist/app-client-data-v3/page.header.d.ts +1 -1
- package/dist/app-client-data-v3/page.header.d.ts.map +1 -1
- package/dist/app-client-data-v3/types-to-json-schemas.d.ts.map +1 -1
- package/dist/app-sections.d.ts +2 -1
- package/dist/app-sections.d.ts.map +1 -1
- package/dist/app-sections.js +1 -1
- package/dist/app-sections.js.map +1 -1
- package/dist/app-sections.mjs +1 -1
- package/dist/app-sections.mjs.map +1 -1
- package/dist/changes.js.map +1 -1
- package/dist/changes.mjs.map +1 -1
- package/dist/color-config.d.ts +1 -1
- package/dist/color-config.d.ts.map +1 -1
- package/dist/color-config.js +1 -1
- package/dist/color-config.js.map +1 -1
- package/dist/color-config.mjs +1 -1
- package/dist/color-config.mjs.map +1 -1
- package/dist/e2e-session-config.d.ts +20 -0
- package/dist/e2e-session-config.d.ts.map +1 -0
- package/dist/e2e-session-config.js +2 -0
- package/dist/e2e-session-config.js.map +1 -0
- package/dist/e2e-session-config.mjs +2 -0
- package/dist/e2e-session-config.mjs.map +1 -0
- package/dist/git-providers.js.map +1 -1
- package/dist/git-providers.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/intercepts.d.ts +1 -1
- package/dist/intercepts.d.ts.map +1 -1
- package/dist/json-schema.js.map +1 -1
- package/dist/json-schema.mjs.map +1 -1
- package/dist/misc.d.ts +2 -2
- package/dist/misc.d.ts.map +1 -1
- package/dist/nav-customization-config.d.ts +3 -3
- package/dist/nav-customization-config.d.ts.map +1 -1
- package/dist/nav-customization-config.js +1 -1
- package/dist/nav-customization-config.js.map +1 -1
- package/dist/nav-customization-config.mjs +1 -1
- package/dist/nav-customization-config.mjs.map +1 -1
- package/dist/renderer-client-types.js.map +1 -1
- package/dist/renderer-client-types.mjs.map +1 -1
- package/dist/renderers.d.ts +28 -0
- package/dist/renderers.d.ts.map +1 -1
- package/dist/renderers.js +1 -1
- package/dist/renderers.js.map +1 -1
- package/dist/renderers.mjs +1 -1
- package/dist/renderers.mjs.map +1 -1
- package/dist/renderers.test.d.ts +2 -0
- package/dist/renderers.test.d.ts.map +1 -0
- package/dist/typography-config.d.ts +2 -2
- package/dist/typography-config.d.ts.map +1 -1
- package/dist/typography-config.js +1 -1
- package/dist/typography-config.js.map +1 -1
- package/dist/typography-config.mjs +1 -1
- package/dist/typography-config.mjs.map +1 -1
- package/dist/ui-config.d.ts +5 -5
- package/dist/ui-config.d.ts.map +1 -1
- package/dist/ui-config.js +1 -1
- package/dist/ui-config.js.map +1 -1
- package/dist/ui-config.mjs +1 -1
- package/dist/ui-config.mjs.map +1 -1
- package/dist/user-roles.d.ts +1 -0
- package/dist/user-roles.d.ts.map +1 -1
- package/dist/user-roles.js +1 -1
- package/dist/user-roles.js.map +1 -1
- package/dist/user-roles.mjs +1 -1
- package/dist/user-roles.mjs.map +1 -1
- package/dist/web-sockets.js.map +1 -1
- package/dist/web-sockets.mjs.map +1 -1
- package/package.json +16 -18
- package/vitest.config.mjs +1 -2
- package/.eslintrc.js +0 -6
- package/ava.config.cjs +0 -3
- package/dist/app-client-data/validation.vtest.d.ts +0 -2
- package/dist/app-client-data/validation.vtest.d.ts.map +0 -1
- package/dist/cypress-session-config.d.ts +0 -20
- package/dist/cypress-session-config.d.ts.map +0 -1
- package/dist/cypress-session-config.js +0 -2
- package/dist/cypress-session-config.js.map +0 -1
- package/dist/cypress-session-config.mjs +0 -2
- package/dist/cypress-session-config.mjs.map +0 -1
- package/dist/renderers.vitest.d.ts +0 -2
- package/dist/renderers.vitest.d.ts.map +0 -1
- package/dist/renderers.vitest.js +0 -451
- package/dist/renderers.vitest.js.map +0 -1
- package/dist/renderers.vitest.mjs +0 -451
- package/dist/renderers.vitest.mjs.map +0 -1
package/dist/changes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","t","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"ieAWA,IAAMA,
|
|
1
|
+
{"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","t","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"ieAWA,IAAMA,CAAAA,CAAuBC,YAAA,CAAA,MAAA,CAAO,CAClC,EAAA,CAAMA,YAAA,CAAA,KAAA,CAAM,CAAGA,YAAA,CAAA,OAAA,CAAQ,SAAS,CAAA,CAAKA,YAAA,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAKA,YAAA,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACzE,IAAA,CAAQA,YAAA,CAAA,KAAA,CAAQA,YAAA,CAAA,KAAA,CAAM,CAAGA,YAAA,CAAA,MAAA,EAAO,CAAKA,YAAA,CAAA,MAAA,EAAQ,CAAC,CAAC,CAAA,CAC/C,KAAA,CAASA,YAAA,CAAA,QAAA,CAAWA,YAAA,CAAA,GAAA,EAAK,CAC3B,CAAC,CAAA,CACKC,CAAAA,CAAiCF,CAAAA,CAE1BG,CAAAA,CAAUC,CAAAA,CAACC,CAAAA,EACtBH,EAAY,EAAA,CAAGG,CAAK,CAAA,CADC,SAAA,CAAA,CAGjBC,CAAAA,CAAyBL,YAAA,CAAA,KAAA,CAAMD,CAAkB,CAAA,CACjDO,CAAAA,CAAqCD,CAAAA,CAE9BE,CAAAA,CAAYJ,CAAAA,CAACK,CAAAA,EACxBF,CAAAA,CAAc,GAAGE,CAAO,CAAA,CADD,WAAA,CAAA,CAenBC,CAAAA,CAA0BT,YAAA,CAAA,IAAA,CAAK,CACnC,OAAA,CAASK,CAAAA,CACT,cAAA,CAAkBL,YAAA,CAAA,QAAA,CAASK,CAAoB,CAAA,CAC/C,KAAA,CAASL,YAAA,CAAA,QAAA,CAAWA,oBAAO,CAAE,IAAA,CAAQA,YAAA,CAAA,MAAA,EAAS,CAAC,CAAC,CAAA,CAChD,EAAA,CAAMA,YAAA,CAAA,MAAA,EAAO,CACb,IAAA,CAAQA,YAAA,CAAA,MAAA,EAAO,CACf,MAAA,CAAUA,sBAAWA,YAAA,CAAA,MAAA,EAAQ,CAC/B,CAAC,CAAA,CACKU,CAAAA,CAAmDD,CAAAA,CAE5CE,CAAAA,CAAmBR,CAAAA,CAACS,CAAAA,EAC/BF,CAAAA,CAAqB,EAAA,CAAGE,CAAM,CAAA,CADA,oBAG1BC,CAAAA,CAAiCb,YAAA,CAAA,KAAA,CAAMS,CAAqB,CAAA,CACrDK,CAAAA,CACXD,CAAAA,CAEWE,CAAAA,CAAoBZ,CAAAA,CAC/Ba,CAAAA,EACgCF,CAAAA,CAAsB,EAAA,CAAGE,CAAO,CAAA,CAFjC,mBAAA","file":"changes.js","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n"]}
|
package/dist/changes.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"+GAWA,IAAMA,CAAuB,CAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["../src/changes.ts"],"names":["PatchStructRuntime","PatchStruct","isPatch","__name","patch","PatchesStructRuntime","PatchesStruct","isPatches","patches","KsRemoteChangeRuntime","KsRemoteChangeStruct","isKsRemoteChange","change","KsRemoteChangesStructRuntime","KsRemoteChangesStruct","isKsRemoteChanges","changes"],"mappings":"+GAWA,IAAMA,CAAAA,CAAuB,CAAA,CAAA,MAAA,CAAO,CAClC,EAAA,CAAM,CAAA,CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,OAAA,CAAQ,SAAS,CAAA,CAAK,CAAA,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAK,CAAA,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACzE,IAAA,CAAQ,CAAA,CAAA,KAAA,CAAQ,CAAA,CAAA,KAAA,CAAM,CAAG,CAAA,CAAA,MAAA,EAAO,CAAK,CAAA,CAAA,MAAA,EAAQ,CAAC,CAAC,CAAA,CAC/C,KAAA,CAAS,CAAA,CAAA,QAAA,CAAW,CAAA,CAAA,GAAA,EAAK,CAC3B,CAAC,CAAA,CACKC,CAAAA,CAAiCD,CAAAA,CAE1BE,CAAAA,CAAUC,CAAAA,CAACC,CAAAA,EACtBH,EAAY,EAAA,CAAGG,CAAK,CAAA,CADC,SAAA,CAAA,CAGjBC,CAAAA,CAAyB,CAAA,CAAA,KAAA,CAAML,CAAkB,CAAA,CACjDM,CAAAA,CAAqCD,CAAAA,CAE9BE,CAAAA,CAAYJ,CAAAA,CAACK,CAAAA,EACxBF,CAAAA,CAAc,GAAGE,CAAO,CAAA,CADD,WAAA,CAAA,CAenBC,CAAAA,CAA0B,CAAA,CAAA,IAAA,CAAK,CACnC,OAAA,CAASJ,CAAAA,CACT,cAAA,CAAkB,CAAA,CAAA,QAAA,CAASA,CAAoB,CAAA,CAC/C,KAAA,CAAS,CAAA,CAAA,QAAA,CAAW,SAAO,CAAE,IAAA,CAAQ,CAAA,CAAA,MAAA,EAAS,CAAC,CAAC,CAAA,CAChD,EAAA,CAAM,CAAA,CAAA,MAAA,EAAO,CACb,IAAA,CAAQ,CAAA,CAAA,MAAA,EAAO,CACf,MAAA,CAAU,WAAW,CAAA,CAAA,MAAA,EAAQ,CAC/B,CAAC,CAAA,CACKK,CAAAA,CAAmDD,CAAAA,CAE5CE,CAAAA,CAAmBR,CAAAA,CAACS,CAAAA,EAC/BF,CAAAA,CAAqB,EAAA,CAAGE,CAAM,CAAA,CADA,oBAG1BC,CAAAA,CAAiC,CAAA,CAAA,KAAA,CAAMJ,CAAqB,CAAA,CACrDK,CAAAA,CACXD,CAAAA,CAEWE,CAAAA,CAAoBZ,CAAAA,CAC/Ba,CAAAA,EACgCF,CAAAA,CAAsB,EAAA,CAAGE,CAAO,CAAA,CAFjC,mBAAA","file":"changes.mjs","sourcesContent":["import * as s from 'superstruct';\nimport type { Patch } from 'immer';\nimport type { SetOptional } from '@knapsack/utils';\nimport type { UUID, DateString } from './misc';\n\n/**\n * Patch\n */\n\nexport type { Patch };\n\nconst PatchStructRuntime = s.object({\n op: s.union([s.literal('replace'), s.literal('remove'), s.literal('add')]),\n path: s.array(s.union([s.string(), s.number()])),\n value: s.optional(s.any()),\n});\nconst PatchStruct: s.Describe<Patch> = PatchStructRuntime;\n\nexport const isPatch = (patch: unknown): patch is Patch =>\n PatchStruct.is(patch);\n\nconst PatchesStructRuntime = s.array(PatchStructRuntime);\nconst PatchesStruct: s.Describe<Patch[]> = PatchesStructRuntime;\n\nexport const isPatches = (patches: unknown): patches is Patch[] =>\n PatchesStruct.is(patches);\n\n/**\n * KsRemoteChange\n */\nexport type KsChange<Event extends { type: string } = { type: string }> = {\n patches: Patch[];\n inversePatches: Patch[];\n event: Event;\n id: UUID;\n date: DateString;\n};\nexport type KsRemoteChange = SetOptional<KsChange, 'inversePatches' | 'event'>;\n\nconst KsRemoteChangeRuntime = s.type({\n patches: PatchesStructRuntime,\n inversePatches: s.optional(PatchesStructRuntime),\n event: s.optional(s.object({ type: s.string() })),\n id: s.string(),\n date: s.string(),\n userId: s.optional(s.string()),\n});\nconst KsRemoteChangeStruct: s.Describe<KsRemoteChange> = KsRemoteChangeRuntime;\n\nexport const isKsRemoteChange = (change: unknown): change is KsRemoteChange =>\n KsRemoteChangeStruct.is(change);\n\nconst KsRemoteChangesStructRuntime = s.array(KsRemoteChangeRuntime);\nexport const KsRemoteChangesStruct: s.Describe<KsRemoteChange[]> =\n KsRemoteChangesStructRuntime;\n\nexport const isKsRemoteChanges = (\n changes: unknown,\n): changes is KsRemoteChange[] => KsRemoteChangesStruct.is(changes);\n"]}
|
package/dist/color-config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-config.d.ts","sourceRoot":"","sources":["../src/color-config.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"color-config.d.ts","sourceRoot":"","sources":["../src/color-config.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,QAAQ,EAKd,MAAM,aAAa,CAAC;AAYrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,gBAAgB,CAAC;AAErB,eAAO,MAAM,iBAAiB,4CAG7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CASlD,CAAC;AAGH,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,gBAAgB,CAG5D,CAAC"}
|
package/dist/color-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var l=require('color-string'),superstruct=require('superstruct');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var g=Object.defineProperty;var n=(o,r)=>g(o,"name",{value:r,configurable:true});function C(o){if(typeof o!="string")return false;try{return !!l__default.default.get(o)}catch{return false}}n(C,"isColor");var c=superstruct.define("ColorStringStruct",o=>typeof o=="string"&&C(o)),
|
|
1
|
+
'use strict';var l=require('color-string'),superstruct=require('superstruct');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var g=Object.defineProperty;var n=(o,r)=>g(o,"name",{value:r,configurable:true});function C(o){if(typeof o!="string")return false;try{return !!l__default.default.get(o)}catch{return false}}n(C,"isColor");var c=superstruct.define("ColorStringStruct",o=>typeof o=="string"&&C(o)),k=superstruct.union([superstruct.type({type:superstruct.literal("value"),colorValue:c}),superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()})]),a=superstruct.type({type:superstruct.literal("design-token"),tokenName:superstruct.string()});exports.ColorConfigStruct=k;exports.ColorStringStruct=c;exports.ColorTokenConfigStruct=a;//# sourceMappingURL=color-config.js.map
|
|
2
2
|
//# sourceMappingURL=color-config.js.map
|
package/dist/color-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/color-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct"],"mappings":"8LAAA,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,
|
|
1
|
+
{"version":3,"sources":["../src/color-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct"],"mappings":"8LAAA,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,CAWA,SAASA,EAAQC,CAAAA,CAAiC,CAChD,GAAI,OAAOA,CAAAA,EAAU,SAAU,OAAO,MAAA,CACtC,GAAI,CACF,OAAO,CAAC,CAACC,kBAAAA,CAAY,IAAID,CAAK,CAChC,MAAY,CACV,OAAO,MACT,CACF,CAPSE,EAAAH,CAAAA,CAAA,SAAA,CAAA,KAkBII,CAAAA,CAAoBC,kBAAAA,CAC/B,mBAAA,CACCC,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAA,EAAYN,EAAQM,CAAK,CACvD,EAEaC,CAAAA,CAA2CC,iBAAAA,CAAM,CAC5DC,gBAAAA,CAAK,CACH,KAAMC,mBAAAA,CAAQ,OAAO,EACrB,UAAA,CAAYN,CACd,CAAC,CAAA,CACDK,gBAAAA,CAAK,CACH,IAAA,CAAMC,mBAAAA,CAAQ,cAAc,CAAA,CAC5B,SAAA,CAAWC,oBACb,CAAC,CACH,CAAC,CAAA,CAGYC,EAAqDH,gBAAAA,CAAK,CACrE,KAAMC,mBAAAA,CAAQ,cAAc,EAC5B,SAAA,CAAWC,kBAAAA,EACb,CAAC","file":"color-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"]}
|
package/dist/color-config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import l from'color-string';import {define,union,type,literal,string}from'superstruct';var g=Object.defineProperty;var n=(o,r)=>g(o,"name",{value:r,configurable:true});function C(o){if(typeof o!="string")return false;try{return !!l.get(o)}catch{return false}}n(C,"isColor");var c=define("ColorStringStruct",o=>typeof o=="string"&&C(o)),
|
|
1
|
+
import l from'color-string';import {define,union,type,literal,string}from'superstruct';var g=Object.defineProperty;var n=(o,r)=>g(o,"name",{value:r,configurable:true});function C(o){if(typeof o!="string")return false;try{return !!l.get(o)}catch{return false}}n(C,"isColor");var c=define("ColorStringStruct",o=>typeof o=="string"&&C(o)),k=union([type({type:literal("value"),colorValue:c}),type({type:literal("design-token"),tokenName:string()})]),a=type({type:literal("design-token"),tokenName:string()});export{k as ColorConfigStruct,c as ColorStringStruct,a as ColorTokenConfigStruct};//# sourceMappingURL=color-config.mjs.map
|
|
2
2
|
//# sourceMappingURL=color-config.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/color-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct"],"mappings":"uFAAA,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,
|
|
1
|
+
{"version":3,"sources":["../src/color-config.ts"],"names":["isColor","color","colorString","__name","ColorStringStruct","define","value","ColorConfigStruct","union","type","literal","string","ColorTokenConfigStruct"],"mappings":"uFAAA,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,CAWA,SAASA,EAAQC,CAAAA,CAAiC,CAChD,GAAI,OAAOA,CAAAA,EAAU,SAAU,OAAO,MAAA,CACtC,GAAI,CACF,OAAO,CAAC,CAACC,CAAAA,CAAY,IAAID,CAAK,CAChC,MAAY,CACV,OAAO,MACT,CACF,CAPSE,EAAAH,CAAAA,CAAA,SAAA,CAAA,KAkBII,CAAAA,CAAoBC,MAAAA,CAC/B,mBAAA,CACCC,CAAAA,EAAU,OAAOA,CAAAA,EAAU,QAAA,EAAYN,EAAQM,CAAK,CACvD,EAEaC,CAAAA,CAA2CC,KAAAA,CAAM,CAC5DC,IAAAA,CAAK,CACH,KAAMC,OAAAA,CAAQ,OAAO,EACrB,UAAA,CAAYN,CACd,CAAC,CAAA,CACDK,IAAAA,CAAK,CACH,IAAA,CAAMC,OAAAA,CAAQ,cAAc,CAAA,CAC5B,SAAA,CAAWC,QACb,CAAC,CACH,CAAC,CAAA,CAGYC,EAAqDH,IAAAA,CAAK,CACrE,KAAMC,OAAAA,CAAQ,cAAc,EAC5B,SAAA,CAAWC,MAAAA,EACb,CAAC","file":"color-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"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Role } from './user-roles';
|
|
2
|
+
import type { ApiRoute } from './api-routes';
|
|
3
|
+
/**
|
|
4
|
+
* A fake API route that Playwright intercepts to provide a fake session config.
|
|
5
|
+
* Used to have UI tests work in Playwright without having to set up a real auth0 tenant.
|
|
6
|
+
* Since an actual auth token is never made or used, this works for UI tests but will fail if you try to use it in an API call.
|
|
7
|
+
*/
|
|
8
|
+
export type E2eUserRole = Extract<Role, 'ADMIN' | 'CONTRIBUTOR' | 'CONSUMER' | 'VIEWER' | 'ANONYMOUS'>;
|
|
9
|
+
export type E2eSessionConfigApi = ApiRoute<{
|
|
10
|
+
path: '/fake-e2e-api/get-session-config';
|
|
11
|
+
method: 'GET';
|
|
12
|
+
/** No query params */
|
|
13
|
+
input?: Record<string, never>;
|
|
14
|
+
output: {
|
|
15
|
+
user: {
|
|
16
|
+
userRole: E2eUserRole;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=e2e-session-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e-session-config.d.ts","sourceRoot":"","sources":["../src/e2e-session-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAC/B,IAAI,EACJ,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAC9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,IAAI,EAAE,kCAAkC,CAAC;IACzC,MAAM,EAAE,KAAK,CAAC;IACd,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9B,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,QAAQ,EAAE,WAAW,CAAC;SACvB,CAAC;KAEH,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"e2e-session-config.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"e2e-session-config.mjs"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"aAAO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.js","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"AAAO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.mjs","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export * from './color-config';
|
|
|
23
23
|
export * from './typography-config';
|
|
24
24
|
export * from './nav-customization-config';
|
|
25
25
|
export * from './user-roles';
|
|
26
|
-
export * from './
|
|
26
|
+
export * from './e2e-session-config';
|
|
27
27
|
export * from './api-routes';
|
|
28
28
|
export * from './app-api-routes';
|
|
29
29
|
export * from './intercepts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var t=require('superstruct'),Ne=require('color-string'),v4Mini=require('zod/v4-mini'),utils=require('@knapsack/utils'),immer=require('immer'),zod=require('zod'),urls=require('@knapsack/utils/urls');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var Ne__default=/*#__PURE__*/_interopDefault(Ne);var ve=Object.defineProperty;var n=(e,r)=>ve(e,"name",{value:r,configurable:true});function Be(e){if(typeof e!="string")return false;try{return !!Ne__default.default.get(e)}catch{return false}}n(Be,"isColor");var F=t.define("ColorStringStruct",e=>typeof e=="string"&&Be(e)),l=t.union([t.type({type:t.literal("value"),colorValue:F}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),dn=t.type({type:t.literal("design-token"),tokenName:t.string()});var kn=["h1","h2","h3","h4","h5","h6"],fe=t.object({unit:t.enums(["rem","px"]),value:t.number()}),me=t.union([t.string(),t.number()]),Me=(a=>(a.woff2="woff2",a.woff="woff",a))(Me||{}),je=t.enums(["woff2","woff"]),ze=t.type({format:je,type:t.literal("url"),path:t.string()}),w=t.type({family:t.optional(t.string()),weight:t.optional(t.union([me,t.size(t.array(me),2)])),src:t.optional(t.array(ze)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),We=(f=>(f.inherit="As typed",f.capitalize="Capitalize",f.lowercase="Lowercase",f.uppercase="Uppercase",f))(We||{}),Le=(u=>(u["ultra-condensed"]="Ultra-condensed",u["extra-condensed"]="Extra-condensed",u.condensed="Condensed",u["semi-condensed"]="Semi-condensed",u.normal="Normal",u["semi-expanded"]="Semi-expanded",u.expanded="Expanded",u["extra-expanded"]="Extra-expanded",u["ultra-expanded"]="Ultra-expanded",u))(Le||{}),O=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(l),hoverColor:t.optional(l),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),_e=t.type({min:fe,max:t.optional(fe)}),s=t.type({fontSize:t.optional(_e),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(l),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},ye={},Sn={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:ye},bn={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:ye};var R=t.union([s,t.type({accentColor:t.optional(l)})]),W=t.union([R,t.type({hoverColor:t.optional(l),backgroundColor:t.optional(l)})]),L=t.union([R,t.type({backgroundColor:t.optional(l)})]),Ge={},$e={},Ye={},Rn={primaryNav:Ye,secondaryNav:$e,tabs:Ge};var jn=t.object({version:t.literal(1),oldSillySidebarBgColor:F}),zn=t.object({version:t.literal(2),anotherSillySidebarBgColor:F}),Wn=t.object({version:t.literal(3),sidebarBgColor:F}),Ln=t.object({version:t.literal(4),primaryColor:l,darkColor:l,lightColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),_n=t.object({version:t.literal(5),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Gn=t.object({version:t.literal(6),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),$n=t.object({version:t.literal(7),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Yn=t.object({version:t.literal(8),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Hn=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),He=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(R)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingXLarge:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),headingXSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Jn=He;var Qn=["large","medium","small"],eo=["large","medium","small"];var no={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var ro=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Je(e){return typeof e!="string"?false:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Je,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function qe(e){return !Je(e)}n(qe,"isNotTokenReference");var c=t__namespace.define("Token Reference",e=>typeof e!="string"?false:qe(e)?"Must start and end with curly braces":true),Xe={border:"border",shadow:"shadow",transition:"transition"},Ze=Object.values(Xe),Qe={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},et=Object.values(Qe);function J(e){return Ze.includes(e)}n(J,"isTokenTypeComposite");function ke(e){return et.includes(e)}n(ke,"isTokenTypeSingular");utils.expectType([{inset:false,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:true}]);var d=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function To(e){return J(e.type)}n(To,"isTokenDataComposite");utils.expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:false},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:false},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:true,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function nt(e){return typeof e=="string"&&!x(e)}n(nt,"isTokenValueColor");var A=t__namespace.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":x(e)?"Value must not contain {} (token references)":true),ot=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),d),rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function q(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(q,"isTokenValueDimension");var h=t__namespace.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":true),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("static"),originalValue:h}),d),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function ko(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(ko,"isTokenValueDuration");var E=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?true:'Value must be a number followed by "ms" (e.g., "100ms")'),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("static"),originalValue:E}),d),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:E,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function So(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(So,"isTokenValueFontWeight");var se=t__namespace.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":x(e)?"Value must not contain {} (token references)":true),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:se,kind:t__namespace.literal("static"),originalValue:se}),d),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:se,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),G=t__namespace.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":true:"Value must be an array"),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("static"),originalValue:G}),d),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function gt(e){return utils.isObject(e)&&nt(e.color)&&q(e.offsetX)&&q(e.offsetY)&&q(e.blur)&&q(e.spread)}n(gt,"isTokenValueShadow");var Se=t__namespace.define("Shadow Value",e=>gt(e)?true:`Expected a shadow value, got ${JSON.stringify(e)}`),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:Se,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),offsetX:t__namespace.union([h,c]),offsetY:t__namespace.union([h,c]),blur:t__namespace.union([h,c]),spread:t__namespace.union([h,c]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),c])})}),d),mt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:Se,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),K=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function yt(e){return utils.isObject(e)&&A.is(e.color)&&K.is(e.style)&&h.is(e.width)}n(yt,"isTokenValueBorder");var be=t__namespace.define("Border Value",yt),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:be,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),style:t__namespace.union([K,c]),width:t__namespace.union([h,c])})}),d),kt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:be,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function St(e){return utils.isObject(e)&&G.is(e.timingFunction)&&E.is(e.duration)&&E.is(e.delay)}n(St,"isTokenValueTransition");var Ce=t__namespace.define("Transition Value",St),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Ce,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([G,c]),duration:t__namespace.union([E,c]),delay:t__namespace.union([E,c])})}),d),Ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:Ce,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),d),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("static"),originalValue:K}),d),It=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:K}),d),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),d),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),d),Et=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),bo=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,a=e.kind;try{switch(r){case "boolean":a==="ref"?Et.assert(e):Rt.assert(e);return;case "border":a==="ref"?kt.assert(e):Tt.assert(e);return;case "color":a==="ref"?rt.assert(e):ot.assert(e);return;case "cubicBezier":a==="ref"?ut.assert(e):dt.assert(e);return;case "dimension":a==="ref"?it.assert(e):at.assert(e);return;case "duration":a==="ref"?pt.assert(e):st.assert(e);return;case "fontWeight":a==="ref"?ct.assert(e):lt.assert(e);return;case "number":a==="ref"?Vt.assert(e):Pt.assert(e);return;case "shadow":a==="ref"?mt.assert(e):ft.assert(e);return;case "string":a==="ref"?ht.assert(e):xt.assert(e);return;case "strokeStyle":a==="ref"?It.assert(e):Dt.assert(e);return;case "transition":a==="ref"?Ct.assert(e):bt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);utils.expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Eo(e){return ke(e?.type)}n(Eo,"isTokenSrcValueInfoSingular");function vo(e){return J(e?.type)}n(vo,"isTokenSrcValueInfoComposite");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Nt(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(Nt,"isTokenSrcExtensions");utils.expectType(["#ddd",true,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:true,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function Ao(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(Ao,"isTokenSrc");function wt(e){return utils.isObject(e)&&!Nt(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(wt,"isTokenGroup");function Ko(e){if(wt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return true}return false}n(Ko,"isTokenTypeVarRef");function jo(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(jo,"getPrimitiveValue");var zo=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function Wo(e){let{value:r,unit:a}=utils.parseNumberWithUnit(e);if(!a)return {value:r};if(a!=="px"&&a!=="rem"&&a!=="em"&&a!=="%")throw new Error(`Invalid unit "${a}" for value: ${r}`);return {value:r,unit:a}}n(Wo,"parseTokenDimensionValue");function Go(e){return e?.type==="data"||e?.type==="data-w-template-info"}n(Go,"isDemoWithData");function $o(e){return e?.type==="data"}n($o,"isDataDemo");function Yo(e){return e?.type==="template"}n(Yo,"isTemplateDemo");function Ho(e){return typeof e=="object"&&!e.isInferred}n(Ho,"isSpecNotInferred");var Xo={designSrc:"Design Source",subPage:"Subpage",template:"Template"};var xe=(T=>(T.auto="auto",T.small="small",T.medium="medium",T.large="large",T.full="full",T))(xe||{});var rr={patternsState:{patterns:{},renderers:{},statusSets:[]},customPagesState:{pages:{}},assetSetsState:{},navsState:{byId:{},order:[]},tokensSrc:{},filesState:{files:{}},db:{blocks:{byId:{},settings:{tokens:{rootFontSize:"16px"}}},demos:{byId:{},settings:{}},tabs:{byId:{},settings:{}},blockCollections:{byId:{},settings:{}},settings:{title:"",logoUrl:""}}};function At(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(At,"isKsAppClientDataNoMeta");var ar=t.define("KsAppClientDataNoMeta",At),Kt=v4Mini.z.strictObject({assetSetsState:v4Mini.z.object({}),customPagesState:v4Mini.z.object({pages:v4Mini.z.object({})}),navsState:v4Mini.z.object({byId:v4Mini.z.object(),order:v4Mini.z.array(v4Mini.z.string())}),patternsState:v4Mini.z.object({patterns:v4Mini.z.object({}),renderers:v4Mini.z.object({}),statusSets:v4Mini.z.array(v4Mini.z.object())}),tokensSrc:v4Mini.z.object({}),filesState:v4Mini.z.object({files:v4Mini.z.object({})}),db:v4Mini.z.object({blocks:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),demos:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),tabs:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),blockCollections:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),templatesConfig:v4Mini.z.optional(v4Mini.z.object({})),settings:v4Mini.z.object({title:v4Mini.z.optional(v4Mini.z.string()),hideTitleInNavigation:v4Mini.z.optional(v4Mini.z.boolean()),logoUrl:v4Mini.z.optional(v4Mini.z.string())})})}),ir=v4Mini.z.custom().check(e=>{let{error:r}=Kt.safeParse(e.value);r&&e.issues.push(...r.issues);});function Ut(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(a=>utils.isObjKey(a,e)):false}n(Ut,"isKsAppClientDataAndMeta");var sr=t.define("KsAppClientDataAndMeta",Ut),Ft=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),pr=Ft.is;function jt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(jt,"isKsAppClientDataNoMetaV3");var Pr=t.define("KsAppClientDataNoMeta",jt);function zt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(a=>utils.isObjKey(a,e)):false}n(zt,"isKsAppClientDataAndMetaV3");var Vr=t.define("KsAppClientDataAndMeta",zt),Wt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),Rr=Wt.is;var Ve={version:"4.1.7",checkIfNeeded:n(e=>true,"checkIfNeeded"),migrate:n(e=>{if(!immer.isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([a,u])=>{r.data.slots[a]=u.map(f=>typeof f=="string"?{type:"text",text:f}:(f.type==="template-reference"||f.type==="text"||(f.type="template-demo"),f));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:a,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:f,demoIds:T=[]}of u)if(T.includes(r.id)){r.patternId=a,r.templateId=f;return}})());});},"migrate")};var Ar=[Ve];var _t={ROOT:"ROOT",DESIGN:"Design",DEVELOP:"Develop",DOCUMENT:"Documentation",PROTOTYPE:"Prototype",SETTINGS:"Settings"},Ur=Object.values(_t);var Gt=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.arrayOfNumbers="arrayOfNumbers",k.unknown="unknown",k))(Gt||{}),Mr=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),jr=n(e=>"type"in e&&e.type==="number","isNumberProp"),zr=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),Wr=n(e=>"enum"in e,"isOptionsProp"),Lr=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),_r=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Gr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),$r=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Yr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Hr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var Re=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),$t=Re,Xr=n(e=>$t.is(e),"isPatch"),ce=t__namespace.array(Re),Yt=ce,Zr=n(e=>Yt.is(e),"isPatches"),Ee=t__namespace.type({patches:ce,inversePatches:t__namespace.optional(ce),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Ht=Ee,Qr=n(e=>Ht.is(e),"isKsRemoteChange"),Jt=t__namespace.array(Ee),qt=Jt,ea=n(e=>qt.is(e),"isKsRemoteChanges");var ra={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html"},aa=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 ia(e){return "codeSrcPath"in e}n(ia,"isTemplateInfoWithCodeSrcPath");function Xt(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)}`)}}}n(Xt,"createTemplateInfoId");function sa(e){return {...e,id:Xt(e)}}n(sa,"addIdToTemplateInfo");function pa({rendererId:e,alias:r,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:r||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:r};case "web-components":return {rendererId:e,elementName:r};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}n(pa,"normalizeTemplateInfo");function la(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)}`)}}}n(la,"convertTemplateInfoToOldWay");var Zt=(r=>(r.ready="ready",r))(Zt||{}),ua="ks-meta";var fa={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var Qt=(T=>(T.GitHub="GitHub",T.GitLab="GitLab",T.GitLabRest="GitLabRest",T.Bitbucket="Bitbucket",T.Azure="Azure",T))(Qt||{}),en=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(en||{}),tn=(f=>(f.Create="CREATE",f.Move="MOVE",f.Update="UPDATE",f.Chmod="CHMOD",f))(tn||{}),nn=(a=>(a.Base64="BASE64",a.Text="TEXT",a))(nn||{});var on={ADMIN:{id:"ADMIN",title:"Admin",hierarchy:4,permissions:{canManageUsers:true,canDelete:true,canEdit:true,canPublish:true,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true}}},CONTRIBUTOR:{id:"CONTRIBUTOR",title:"Contributor",hierarchy:3,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true}}},CONSUMER:{id:"CONSUMER",title:"Consumer",hierarchy:2,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:false,canView:false}}},VIEWER:{id:"VIEWER",title:"Viewer",hierarchy:1,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false}}},ANONYMOUS:{id:"ANONYMOUS",title:"Anonymous",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false}}},EDITOR:{id:"EDITOR",title:"Editor",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false}}},MANAGER:{id:"MANAGER",title:"Manager",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false}}}},Ta=Object.values(on);function ba({path:e,queryParams:r,origin:a}){return urls.createUrlWithParams({url:e,queryParams:r,origin:a})}n(ba,"createUrlForRoute");function an(e){return Object.fromEntries(e.entries())}n(an,"getParams");function Ca(e){return an(e)}n(Ca,"getParamsForRoute");Object.defineProperty(exports,"isObjKey",{enumerable:true,get:function(){return utils.isObjKey}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function(){return utils.isObject}});exports.BlockSizes=Qn;exports.BlockSpacings=eo;exports.CodeSrcUserConfigSchema=aa;exports.ColorConfigStruct=l;exports.ColorStringStruct=F;exports.ColorTokenConfigStruct=dn;exports.FontFaceConfigStruct=w;exports.FontFaceFormatsEnumStruct=je;exports.FontFaceSourceFormats=Me;exports.FontFaceSourceStruct=ze;exports.FontFaceWeightStruct=me;exports.FontSizeConfigStruct=_e;exports.FontSizeConfigValStruct=fe;exports.FontStretches=Le;exports.GitProviderType=Qt;exports.HeadingLevels=kn;exports.KsAppClientDataAndMetaStruct=sr;exports.KsAppClientDataAndMetaStructV3=Vr;exports.KsAppClientDataNoMetaStruct=ar;exports.KsAppClientDataNoMetaStructV3=Pr;exports.KsAppClientDataNoMetaZod=ir;exports.KsMetaStateStruct=Ft;exports.KsMetaStateStructV3=Wt;exports.KsRemoteChangesStruct=qt;exports.KsRendererClientEvents=Zt;exports.MergeableState=en;exports.NavCustomizationConfigStruct=R;exports.PageHeaderSizes=xe;exports.PrimaryNavCustomizationConfigStruct=W;exports.PropTypeNames=Gt;exports.RestActions=tn;exports.SecondaryNavCustomizationConfigStruct=L;exports.TextEncoding=nn;exports.TextTransforms=We;exports.TokenReferenceStruct=c;exports.TokenValueColorStruct=A;exports.TokenValueCubicBezierStruct=G;exports.TokenValueDimensionStruct=h;exports.TokenValueDurationStruct=E;exports.TokenValueFontWeightStruct=se;exports.TokenValueStrokeStyleStruct=K;exports.TypographyConfigStruct=s;exports.TypographyLinkConfigStruct=O;exports.UiConfigStruct=Jn;exports.UiConfigV10Struct=He;exports.UiConfigV1Struct=jn;exports.UiConfigV2Struct=zn;exports.UiConfigV3Struct=Wn;exports.UiConfigV4Struct=Ln;exports.UiConfigV5Struct=_n;exports.UiConfigV6Struct=Gn;exports.UiConfigV7Struct=$n;exports.UiConfigV8Struct=Yn;exports.UiConfigV9Struct=Hn;exports.WS_EVENTS=fa;exports.addIdToTemplateInfo=sa;exports.appSections=Ur;exports.appSectionsById=_t;exports.assertTokenData=bo;exports.convertTemplateInfoToOldWay=la;exports.createTemplateInfoId=Xt;exports.createUrlForRoute=ba;exports.customizableNavElements=Rn;exports.emptyAppClientData=rr;exports.getParams=an;exports.getParamsForRoute=Ca;exports.getPrimitiveValue=jo;exports.hasTokenReferences=x;exports.isArrayOfNumbersProp=Hr;exports.isArrayOfObjectsProp=Gr;exports.isArrayOfStringsProp=Yr;exports.isBooleanProp=zr;exports.isCustomTypeScriptProp=_r;exports.isDataDemo=$o;exports.isDemoWithData=Go;exports.isDimensionString=zo;exports.isFunctionProp=Lr;exports.isKsAppClientDataAndMeta=Ut;exports.isKsAppClientDataAndMetaV3=zt;exports.isKsAppClientDataNoMeta=At;exports.isKsAppClientDataNoMetaV3=jt;exports.isKsMetaState=pr;exports.isKsMetaStateV3=Rr;exports.isKsRemoteChange=Qr;exports.isKsRemoteChanges=ea;exports.isNotTokenReference=qe;exports.isNumberProp=jr;exports.isObjectProp=$r;exports.isOptionsProp=Wr;exports.isPatch=Xr;exports.isPatches=Zr;exports.isSpecNotInferred=Ho;exports.isStringProp=Mr;exports.isTemplateDemo=Yo;exports.isTemplateInfoWithCodeSrcPath=ia;exports.isTokenDataComposite=To;exports.isTokenGroup=wt;exports.isTokenReference=Je;exports.isTokenSrc=Ao;exports.isTokenSrcExtensions=Nt;exports.isTokenSrcValueInfoComposite=vo;exports.isTokenSrcValueInfoSingular=Eo;exports.isTokenTypeComposite=J;exports.isTokenTypeSingular=ke;exports.isTokenTypeVarRef=Ko;exports.isTokenValueBorder=yt;exports.isTokenValueColor=nt;exports.isTokenValueDimension=q;exports.isTokenValueDuration=ko;exports.isTokenValueFontWeight=So;exports.isTokenValueShadow=gt;exports.isTokenValueTransition=St;exports.ksRendererClientMetaId=ua;exports.migrations=Ar;exports.normalizeTemplateInfo=pa;exports.pageElements=Sn;exports.pageElementsV2=bn;exports.parseTokenDimensionValue=Wo;exports.patternTabTypes=Xo;exports.rendererIds=ra;exports.roles=Ta;exports.rolesById=on;exports.strokeStyleValues=ro;exports.tokenNameDisplayFormats=no;exports.tokenTypeComposites=Ze;exports.tokenTypeSingulars=et;//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var t=require('superstruct'),Oe=require('color-string'),v4Mini=require('zod/v4-mini'),utils=require('@knapsack/utils'),immer=require('immer'),zod=require('zod'),urls=require('@knapsack/utils/urls');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var Oe__default=/*#__PURE__*/_interopDefault(Oe);var we=Object.defineProperty;var n=(e,r)=>we(e,"name",{value:r,configurable:true});function Ke(e){if(typeof e!="string")return false;try{return !!Oe__default.default.get(e)}catch{return false}}n(Ke,"isColor");var M=t.define("ColorStringStruct",e=>typeof e=="string"&&Ke(e)),l=t.union([t.type({type:t.literal("value"),colorValue:M}),t.type({type:t.literal("design-token"),tokenName:t.string()})]),gn=t.type({type:t.literal("design-token"),tokenName:t.string()});var Sn=["h1","h2","h3","h4","h5","h6"],me=t.object({unit:t.enums(["rem","px"]),value:t.number()}),ye=t.union([t.string(),t.number()]),ze=(a=>(a.woff2="woff2",a.woff="woff",a))(ze||{}),We=t.enums(["woff2","woff"]),Le=t.type({format:We,type:t.literal("url"),path:t.string()}),w=t.type({family:t.optional(t.string()),weight:t.optional(t.union([ye,t.size(t.array(ye),2)])),src:t.optional(t.array(Le)),style:t.optional(t.string()),display:t.optional(t.enums(["auto","block","swap","fallback","optional"])),variationSettings:t.optional(t.string()),unicodeRange:t.optional(t.string())}),_e=(g=>(g.inherit="As typed",g.capitalize="Capitalize",g.lowercase="Lowercase",g.uppercase="Uppercase",g))(_e||{}),Ge=(u=>(u["ultra-condensed"]="Ultra-condensed",u["extra-condensed"]="Extra-condensed",u.condensed="Condensed",u["semi-condensed"]="Semi-condensed",u.normal="Normal",u["semi-expanded"]="Semi-expanded",u.expanded="Expanded",u["extra-expanded"]="Extra-expanded",u["ultra-expanded"]="Ultra-expanded",u))(Ge||{}),O=t.type({fontWeight:t.optional(t.union([t.string(),t.number()])),textColor:t.optional(l),hoverColor:t.optional(l),underline:t.optional(t.boolean()),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),$e=t.type({min:me,max:t.optional(me)}),s=t.type({fontSize:t.optional($e),lineHeight:t.optional(t.union([t.string(),t.number()])),fontWeight:t.optional(t.union([t.string(),t.number()])),letterSpacing:t.optional(t.string()),fontFamily:t.optional(t.string()),textColor:t.optional(l),textTransform:t.optional(t.enums(["inherit","capitalize","lowercase","uppercase"])),fontStretch:t.optional(t.enums(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"]))}),m={},Te={},bn={pageTitle:m,pageDescription:m,headingLarge:m,headingMedium:m,headingSmall:m,bodyText:m,link:Te},Cn={pageTitle:m,pageDescription:m,headingXLarge:m,headingLarge:m,headingMedium:m,headingSmall:m,headingXSmall:m,bodyText:m,link:Te};var E=t.union([s,t.type({accentColor:t.optional(l)})]),W=t.union([E,t.type({hoverColor:t.optional(l),backgroundColor:t.optional(l)})]),L=t.union([E,t.type({backgroundColor:t.optional(l)})]),He={},Ye={},qe={},Pn={primaryNav:qe,secondaryNav:Ye,tabs:He};var wn=t.object({version:t.literal(1),oldSillySidebarBgColor:M}),On=t.object({version:t.literal(2),anotherSillySidebarBgColor:M}),Bn=t.object({version:t.literal(3),sidebarBgColor:M}),An=t.object({version:t.literal(4),primaryColor:l,darkColor:l,lightColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Kn=t.object({version:t.literal(5),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true))}),Fn=t.object({version:t.literal(6),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Mn=t.object({version:t.literal(7),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,enableSidebarIcons:t.optional(t.defaulted(t.boolean(),true)),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(E)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Un=t.object({version:t.literal(8),primaryColor:l,darkColor:l,lightColor:l,linkColor:l,appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(E)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),jn=t.object({version:t.literal(9),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(E)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),Je=t.object({version:t.literal(10),appearance:t.type({customFonts:t.optional(t.array(w)),navigation:t.optional(t.type({primaryNav:t.optional(W),secondaryNav:t.optional(L),tabs:t.optional(E)})),pageElements:t.type({pageTitle:t.optional(s),pageDescription:t.optional(s),headingXLarge:t.optional(s),headingLarge:t.optional(s),headingMedium:t.optional(s),headingSmall:t.optional(s),headingXSmall:t.optional(s),bodyText:t.optional(s),link:t.optional(O)})})}),zn=Je;var Gn=["large","medium","small"],$n=["large","medium","small"];var Yn={default:"Default",android:"Android",cssVar:"CSS Var",json:"JSON",less:"Less",scss:"SCSS",swift:"Swift"};var Jn=["solid","dashed","dotted","double","groove","ridge","outset","inset"];function Xe(e){return typeof e!="string"?false:e.split("{").length-1===1&&e.startsWith("{")&&e.endsWith("}")}n(Xe,"isTokenReference");function x(e){return typeof e=="string"&&e.includes("{")}n(x,"hasTokenReferences");function Ze(e){return !Xe(e)}n(Ze,"isNotTokenReference");var c=t__namespace.define("Token Reference",e=>typeof e!="string"?false:Ze(e)?"Must start and end with curly braces":true),Qe={border:"border",shadow:"shadow",transition:"transition"},et=Object.values(Qe),tt={string:"string",number:"number",boolean:"boolean",color:"color",dimension:"dimension",duration:"duration",fontWeight:"fontWeight",strokeStyle:"strokeStyle",cubicBezier:"cubicBezier"},nt=Object.values(tt);function q(e){return et.includes(e)}n(q,"isTokenTypeComposite");function Se(e){return nt.includes(e)}n(Se,"isTokenTypeSingular");utils.expectType([{inset:false,color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px"},{color:"#000",offsetX:"0px",offsetY:"0px",spread:"0px",blur:"0px",inset:true}]);var d=t__namespace.type({id:t__namespace.string(),description:t__namespace.optional(t__namespace.string()),references:t__namespace.optional(t__namespace.array(t__namespace.array(t__namespace.string()))),tokenConfig:t__namespace.optional(t__namespace.type({purpose:t__namespace.optional(t__namespace.string())}))});utils.expectType([{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"static"},{type:"duration",value:"1ms",kind:"ref",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"duration",value:"1ms",originalValue:"1ms",id:"1",kind:"ref"},{type:"duration",value:"1ms",kind:"static",id:"1",originalValue:"{a.b}",referencedTokenId:"1"},{type:"color",value:"#000",kind:"static",id:"1",originalValue:"#000"},{type:"color",value:"#000",kind:"ref",id:"1",originalValue:"{c.b}",referencedTokenId:"c.b"},{type:"cubicBezier",kind:"static",value:[0,0,0,1],originalValue:[0,0,0,1],id:"1"}]);function to(e){return q(e.type)}n(to,"isTokenDataComposite");utils.expectType([{type:"border",kind:"static",id:"1",value:{color:"#000",style:"solid",width:"1px"},originalValue:{color:"#000",style:"solid",width:"1px"}},{type:"border",kind:"ref",referencedTokenId:"a.b",id:"1",value:{color:"red",style:"dashed",width:"2px"},originalValue:"{a.b}"},{type:"shadow",value:{color:"#000",offsetX:"1px",offsetY:"1px",blur:"1px",spread:"1px",inset:false},originalValue:{color:"#000",offsetX:"{a.a}",offsetY:"1px",blur:"1px",spread:"1px",inset:false},id:"1",kind:"static"},{type:"shadow",kind:"ref",referencedTokenId:"a.b",value:{inset:true,color:"red",offsetX:"1px",blur:"2px",offsetY:"3px",spread:"4px"},originalValue:"{a.b}",id:"1"},{type:"transition",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:"{a.b}",kind:"ref",referencedTokenId:"a.b",id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"{a.c}",timingFunction:"{a.c}"},id:"1"},{type:"transition",kind:"static",value:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},originalValue:{duration:"100ms",delay:"200ms",timingFunction:[0,0,0,0]},id:"1"}]);function rt(e){return typeof e=="string"&&!x(e)}n(rt,"isTokenValueColor");var A=t__namespace.define("Color Value",e=>typeof e!="string"?"Value must be a string":e===""?"Value must not be empty":x(e)?"Value must not contain {} (token references)":true),at=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("static"),originalValue:A}),d),it=t__namespace.assign(t__namespace.type({type:t__namespace.literal("color"),value:A,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function J(e){return typeof e=="string"&&(e.endsWith("px")||e.endsWith("rem"))&&!x(e)}n(J,"isTokenValueDimension");var h=t__namespace.define("Dimension Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":!e.endsWith("px")&&!e.endsWith("rem")&&!e.endsWith("em")&&!e.endsWith("%")?"Value must end with px, rem, em or %":true),st=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("static"),originalValue:h}),d),pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("dimension"),value:h,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function no(e){return typeof e=="string"&&e.endsWith("ms")&&!x(e)}n(no,"isTokenValueDuration");var R=t__namespace.define("Duration Value",e=>typeof e!="string"?"Value must be a string":x(e)?"Value must not contain {} (token references)":/^\d+ms$/.test(e)?true:'Value must be a number followed by "ms" (e.g., "100ms")'),lt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("static"),originalValue:R}),d),ct=t__namespace.assign(t__namespace.type({type:t__namespace.literal("duration"),value:R,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function oo(e){return (typeof e=="string"||typeof e=="number")&&!x(e)}n(oo,"isTokenValueFontWeight");var pe=t__namespace.define("Font Weight Value",e=>typeof e!="string"&&typeof e!="number"?"Value must be a string or number":x(e)?"Value must not contain {} (token references)":true),dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("static"),originalValue:pe}),d),ut=t__namespace.assign(t__namespace.type({type:t__namespace.literal("fontWeight"),value:pe,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),G=t__namespace.define("Cubic Bezier Value",e=>Array.isArray(e)?e.length!==4||!e.every(r=>typeof r=="number")?"Value must be an array of 4 numbers":e[0]<0||e[0]>1||e[2]<0||e[2]>1?"The first and third cubicBezier values must be between 0 and 1":true:"Value must be an array"),ft=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("static"),originalValue:G}),d),gt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("cubicBezier"),value:G,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function mt(e){return utils.isObject(e)&&rt(e.color)&&J(e.offsetX)&&J(e.offsetY)&&J(e.blur)&&J(e.spread)}n(mt,"isTokenValueShadow");var be=t__namespace.define("Shadow Value",e=>mt(e)?true:`Expected a shadow value, got ${JSON.stringify(e)}`),yt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),offsetX:t__namespace.union([h,c]),offsetY:t__namespace.union([h,c]),blur:t__namespace.union([h,c]),spread:t__namespace.union([h,c]),inset:t__namespace.union([t__namespace.optional(t__namespace.boolean()),c])})}),d),Tt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("shadow"),value:be,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),K=t__namespace.union([t__namespace.literal("solid"),t__namespace.literal("dashed"),t__namespace.literal("dotted"),t__namespace.literal("double"),t__namespace.literal("groove"),t__namespace.literal("ridge"),t__namespace.literal("outset"),t__namespace.literal("inset")]);function kt(e){return utils.isObject(e)&&A.is(e.color)&&K.is(e.style)&&h.is(e.width)}n(kt,"isTokenValueBorder");var Ce=t__namespace.define("Border Value",kt),St=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("static"),originalValue:t__namespace.type({color:t__namespace.union([A,c]),style:t__namespace.union([K,c]),width:t__namespace.union([h,c])})}),d),bt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("border"),value:Ce,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d);function Ct(e){return utils.isObject(e)&&G.is(e.timingFunction)&&R.is(e.duration)&&R.is(e.delay)}n(Ct,"isTokenValueTransition");var xe=t__namespace.define("Transition Value",Ct),xt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("static"),originalValue:t__namespace.type({timingFunction:t__namespace.union([G,c]),duration:t__namespace.union([R,c]),delay:t__namespace.union([R,c])})}),d),ht=t__namespace.assign(t__namespace.type({type:t__namespace.literal("transition"),value:xe,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Dt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("static"),originalValue:t__namespace.string()}),d),It=t__namespace.assign(t__namespace.type({type:t__namespace.literal("string"),value:t__namespace.string(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),Pt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("static"),originalValue:K}),d),Vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("strokeStyle"),value:K,kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:K}),d),Et=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("static"),originalValue:t__namespace.number()}),d),Rt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("number"),value:t__namespace.number(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),vt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("static"),originalValue:t__namespace.boolean()}),d),Nt=t__namespace.assign(t__namespace.type({type:t__namespace.literal("boolean"),value:t__namespace.boolean(),kind:t__namespace.literal("ref"),originalValue:c,referencedTokenId:t__namespace.string()}),d),ro=n(e=>{if(!utils.isObject(e))throw new Error(`Expected token data to be an object, got ${JSON.stringify(e)}`);if(!utils.isObjKey("type",e))throw new Error(`Expected token data to have a "type" property, got ${JSON.stringify(e)}`);if(typeof e.type!="string")throw new Error(`Expected token data "type" property to be a string, got ${JSON.stringify(e)}`);let r=e.type,a=e.kind;try{switch(r){case "boolean":a==="ref"?Nt.assert(e):vt.assert(e);return;case "border":a==="ref"?bt.assert(e):St.assert(e);return;case "color":a==="ref"?it.assert(e):at.assert(e);return;case "cubicBezier":a==="ref"?gt.assert(e):ft.assert(e);return;case "dimension":a==="ref"?pt.assert(e):st.assert(e);return;case "duration":a==="ref"?ct.assert(e):lt.assert(e);return;case "fontWeight":a==="ref"?ut.assert(e):dt.assert(e);return;case "number":a==="ref"?Rt.assert(e):Et.assert(e);return;case "shadow":a==="ref"?Tt.assert(e):yt.assert(e);return;case "string":a==="ref"?It.assert(e):Dt.assert(e);return;case "strokeStyle":a==="ref"?Vt.assert(e):Pt.assert(e);return;case "transition":a==="ref"?ht.assert(e):xt.assert(e);return;default:{throw new Error(`Unknown token data type: ${r}`)}}}catch(u){throw u instanceof t__namespace.StructError?new Error(`Invalid token data for type "${r}": ${u.message}. Received this data: "${JSON.stringify(e)}"`):u}},"assertTokenData");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"dimension",kind:"ref",referencedTokenId:"a.b"}]);utils.expectType([{type:"border",kind:"ref",referencedTokenId:"a.b"},{type:"border",kind:"static",value:{color:{kind:"static",type:"color",value:"red"},style:{kind:"ref",type:"strokeStyle",referencedTokenId:""},width:{kind:"static",type:"dimension",value:"2px"}}}]);utils.expectType([{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function lo(e){return Se(e?.type)}n(lo,"isTokenSrcValueInfoSingular");function co(e){return q(e?.type)}n(co,"isTokenSrcValueInfoComposite");utils.expectType([{type:"dimension",kind:"static",value:"1px"},{type:"transition",kind:"ref",referencedTokenId:"a.b"},{type:"transition",kind:"ref",value:"1px"},{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]},{type:"transition",kind:"static",value:{delay:{kind:"static",type:"duration",value:"1ms"},duration:{kind:"ref",type:"duration",referencedTokenId:"animation.slow"},timingFunction:{kind:"static",type:"cubicBezier",value:[.4,0,.2,1]}}}]);function Ot(e){return utils.isObject(e)&&utils.isObjKey("cloud.knapsack",e)}n(Ot,"isTokenSrcExtensions");utils.expectType(["#ddd",true,[83,1,1,1],{color:"#000",style:"solid",width:"1px"},{inset:true,color:"#000",offsetX:"0px",offsetY:"{spacing.medium}",spread:"0px",blur:"0px"},{timingFunction:"{timing.ease}",duration:"{timing.duration.medium}",delay:"7ms",color:"#000"}]);function mo(e){return !!(utils.isObject(e)&&utils.isObjKey("$value",e))}n(mo,"isTokenSrc");function Bt(e){return utils.isObject(e)&&!Ot(e)&&!utils.isObjKey("$value",e)&&!utils.isObjKey("cloud.knapsack",e)}n(Bt,"isTokenGroup");function yo(e){if(Bt(e)){let r=e.$extensions["cloud.knapsack"].group.collectionInfo;if(utils.isObjKey("type",r)&&utils.isObjKey("referenceId",r))return true}return false}n(yo,"isTokenTypeVarRef");function bo(e){let r=typeof e;if(r==="string"||r==="number"||r==="boolean")return r;throw new Error(`Invalid token value type: ${JSON.stringify(r)}. Token value is: ${JSON.stringify(e)}`)}n(bo,"getPrimitiveValue");var Co=n(e=>e.includes("px")||e.includes("rem")||e.includes("em")||e.includes("%"),"isDimensionString");function xo(e){let{value:r,unit:a}=utils.parseNumberWithUnit(e);if(!a)return {value:r};if(a!=="px"&&a!=="rem"&&a!=="em"&&a!=="%")throw new Error(`Invalid unit "${a}" for value: ${r}`);return {value:r,unit:a}}n(xo,"parseTokenDimensionValue");function Io(e){return e?.type==="data"||e?.type==="data-w-template-info"}n(Io,"isDemoWithData");function Po(e){return e?.type==="data"}n(Po,"isDataDemo");function Vo(e){return e?.type==="template"}n(Vo,"isTemplateDemo");var he=["removeHtmlAttributes","removeClassName","removeStyle","removeAria","removeEventHandlers"],Eo={removeHtmlAttributes:false,removeClassName:false,removeStyle:false,removeAria:false,removeEventHandlers:false};function Ro(e){if(e)return he.filter(r=>e[r]===true).join(",")}n(Ro,"encodeInferSpecFilters");function vo(e){let r=new Set(e.split(",").map(a=>a.trim()).filter(Boolean));return Object.fromEntries(he.map(a=>[a,r.has(a)]))}n(vo,"decodeInferSpecFilters");function No(e){return typeof e=="object"&&!e.isInferred}n(No,"isSpecNotInferred");var Bo={designSrc:"Design Source",subPage:"Subpage",template:"Template"};var De=(T=>(T.auto="auto",T.small="small",T.medium="medium",T.large="large",T.full="full",T))(De||{});var jo={patternsState:{patterns:{},renderers:{},statusSets:[]},customPagesState:{pages:{}},assetSetsState:{},navsState:{byId:{},order:[]},tokensSrc:{},filesState:{files:{}},db:{blocks:{byId:{},settings:{tokens:{rootFontSize:"16px"}}},demos:{byId:{},settings:{}},tabs:{byId:{},settings:{}},blockCollections:{byId:{},settings:{}},settings:{title:"",logoUrl:""}}};function Ft(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","db"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Ft,"isKsAppClientDataNoMeta");var zo=t.define("KsAppClientDataNoMeta",Ft),Mt=v4Mini.z.strictObject({assetSetsState:v4Mini.z.object({}),customPagesState:v4Mini.z.object({pages:v4Mini.z.object({})}),navsState:v4Mini.z.object({byId:v4Mini.z.object(),order:v4Mini.z.array(v4Mini.z.string())}),patternsState:v4Mini.z.object({patterns:v4Mini.z.object({}),renderers:v4Mini.z.object({}),statusSets:v4Mini.z.array(v4Mini.z.object())}),tokensSrc:v4Mini.z.object({}),filesState:v4Mini.z.object({files:v4Mini.z.object({})}),db:v4Mini.z.object({blocks:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),demos:v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})}),tabs:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),blockCollections:v4Mini.z.optional(v4Mini.z.object({byId:v4Mini.z.object({}),settings:v4Mini.z.object({})})),templatesConfig:v4Mini.z.optional(v4Mini.z.object({})),settings:v4Mini.z.object({title:v4Mini.z.optional(v4Mini.z.string()),hideTitleInNavigation:v4Mini.z.optional(v4Mini.z.boolean()),logoUrl:v4Mini.z.optional(v4Mini.z.string())})})}),Wo=v4Mini.z.custom().check(e=>{let{error:r}=Mt.safeParse(e.value);r&&e.issues.push(...r.issues);});function Ut(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","tokensSrc","metaState","db"].every(a=>utils.isObjKey(a,e)):false}n(Ut,"isKsAppClientDataAndMeta");var Lo=t.define("KsAppClientDataAndMeta",Ut),jt=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),_o=jt.is;function Wt(e){return !utils.isObject(e)||!["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState"].every(a=>utils.isObjKey(a,e))?false:!utils.isObjKey("metaState",e)}n(Wt,"isKsAppClientDataNoMetaV3");var sr=t.define("KsAppClientDataNoMeta",Wt);function Lt(e){return utils.isObject(e)?["assetSetsState","customPagesState","navsState","patternsState","settingsState","tokensState","metaState"].every(a=>utils.isObjKey(a,e)):false}n(Lt,"isKsAppClientDataAndMetaV3");var pr=t.define("KsAppClientDataAndMeta",Lt),_t=t.type({isLocalDev:t.boolean(),plugins:t.array(t.type({id:t.string(),hasContent:t.boolean(),clientPluginPath:t.optional(t.string()),cssPath:t.optional(t.string())})),meta:t.optional(t.type({version:t.optional(t.string()),hasKnapsackCloud:t.boolean(),knapsackCloudSiteId:t.optional(t.string()),serverPort:t.optional(t.number()),websocketsPort:t.optional(t.number()),https:t.optional(t.boolean()),cacheDir:t.optional(t.string()),ksVersions:t.type({app:t.string()})}))}),lr=_t.is;var Re={version:"4.1.7",checkIfNeeded:n(e=>true,"checkIfNeeded"),migrate:n(e=>{if(!immer.isDraft(e))throw new Error("Tried to run migrations on appClientData but it is not an Immer Draft");Object.values(e.patternsState.patterns).forEach(r=>{delete r.demoSize;}),Object.values(e.db.demos.byId).forEach(r=>{r.type==="data"&&(Object.entries(r.data.slots??{}).forEach(([a,u])=>{r.data.slots[a]=u.map(g=>typeof g=="string"?{type:"text",text:g}:(g.type==="template-reference"||g.type==="text"||(g.type="template-demo"),g));}),!(r.patternId&&r.templateId)&&(()=>{for(let{id:a,templates:u=[]}of Object.values(e.patternsState.patterns))for(let{id:g,demoIds:T=[]}of u)if(T.includes(r.id)){r.patternId=a,r.templateId=g;return}})());});},"migrate")};var yr=[Re];var $t={ROOT:"ROOT",DESIGN:"Design",DEVELOP:"Develop",DOCUMENT:"Documentation",MCP:"MCP",PROTOTYPE:"Prototype",SETTINGS:"Settings"},kr=Object.values($t);var Ht=(k=>(k.string="string",k.boolean="boolean",k.number="number",k.object="object",k.options="options",k.function="function",k.customTypeScript="customTypeScript",k.array="array",k.arrayOfObjects="arrayOfObjects",k.arrayOfStrings="arrayOfStrings",k.arrayOfNumbers="arrayOfNumbers",k.unknown="unknown",k))(Ht||{}),br=n(e=>"type"in e&&e.type==="string"&&!("enum"in e),"isStringProp"),Cr=n(e=>"type"in e&&e.type==="number","isNumberProp"),xr=n(e=>"type"in e&&e.type==="boolean","isBooleanProp"),hr=n(e=>"enum"in e,"isOptionsProp"),Dr=n(e=>"typeof"in e&&e?.typeof==="function","isFunctionProp"),Ir=n(e=>!("typeof"in e)&&"tsType"in e,"isCustomTypeScriptProp"),Pr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="object","isArrayOfObjectsProp"),Vr=n(e=>"type"in e&&e.type==="object"&&"properties"in e&&Object.keys(e.properties).length>0,"isObjectProp"),Er=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="string","isArrayOfStringsProp"),Rr=n(e=>"type"in e&&e.type==="array"&&"items"in e&&e.items.type==="number","isArrayOfNumbersProp");var ve=t__namespace.object({op:t__namespace.union([t__namespace.literal("replace"),t__namespace.literal("remove"),t__namespace.literal("add")]),path:t__namespace.array(t__namespace.union([t__namespace.string(),t__namespace.number()])),value:t__namespace.optional(t__namespace.any())}),Yt=ve,wr=n(e=>Yt.is(e),"isPatch"),de=t__namespace.array(ve),qt=de,Or=n(e=>qt.is(e),"isPatches"),Ne=t__namespace.type({patches:de,inversePatches:t__namespace.optional(de),event:t__namespace.optional(t__namespace.object({type:t__namespace.string()})),id:t__namespace.string(),date:t__namespace.string(),userId:t__namespace.optional(t__namespace.string())}),Jt=Ne,Br=n(e=>Jt.is(e),"isKsRemoteChange"),Xt=t__namespace.array(Ne),Zt=Xt,Ar=n(e=>Zt.is(e),"isKsRemoteChanges");var oe={react:"react",vue:"vue","web-components":"web-components",twig:"twig",hbs:"hbs",angular:"angular",html:"html",ios:"ios",android:"android"},Ur=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 jr(e){return "codeSrcPath"in e}n(jr,"isTemplateInfoWithCodeSrcPath");function Qt(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)}`)}}}n(Qt,"createTemplateInfoId");function zr(e){return {...e,id:Qt(e)}}n(zr,"addIdToTemplateInfo");function Wr({rendererId:e,alias:r,path:a}){return (()=>{switch(e){case "react":case "angular":return {rendererId:e,codeSrcPath:a,exportName:r||"default"};case "vue":case "hbs":case "html":return {rendererId:e,codeSrcPath:a};case "twig":return {rendererId:e,namespacePath:r};case "web-components":return {rendererId:e,elementName:r};case "ios":return {rendererId:e,moduleName:a,symbolName:r};case "android":return {rendererId:e,packageName:a,componentName:r};default:{throw new Error(`Invalid renderer ID: ${e}`)}}})()}n(Wr,"normalizeTemplateInfo");function Lr(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)}`)}}}n(Lr,"convertTemplateInfoToOldWay");var _r={id:oe.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},Gr={id:oe.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},en=[oe.ios,oe.android];function tn(e){return en.includes(e)}n(tn,"isRendererIdForNativeMobile");function $r(e){return tn(e.rendererId)}n($r,"isTemplateInfoForNativeMobile");var nn=(r=>(r.ready="ready",r))(nn||{}),qr="ks-meta";var Xr={PATTERN_TEMPLATE_CHANGED:"PATTERN_TEMPLATE_CHANGED",PATTERN_ASSET_CHANGED:"PATTERN_ASSET_CHANGED",DESIGN_TOKENS_CHANGED:"DESIGN_TOKENS_CHANGED",RENDERER_CLIENT_RELOAD:"RENDERER_CLIENT_RELOAD",APP_CLIENT_DATA_CHANGED:"APP_CLIENT_DATA_CHANGED"};var on=(T=>(T.GitHub="GitHub",T.GitLab="GitLab",T.GitLabRest="GitLabRest",T.Bitbucket="Bitbucket",T.Azure="Azure",T))(on||{}),rn=(u=>(u.Conflicting="CONFLICTING",u.Mergeable="MERGEABLE",u.Unknown="UNKNOWN",u))(rn||{}),an=(g=>(g.Create="CREATE",g.Move="MOVE",g.Update="UPDATE",g.Chmod="CHMOD",g))(an||{}),sn=(a=>(a.Base64="BASE64",a.Text="TEXT",a))(sn||{});var pn={ADMIN:{id:"ADMIN",title:"Admin",description:"Full access. Can manage users, publish changes, and configure all settings.",hierarchy:4,permissions:{canManageUsers:true,canDelete:true,canEdit:true,canPublish:true,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:true,canView:true}}},CONTRIBUTOR:{id:"CONTRIBUTOR",title:"Contributor",description:"Can view and edit content across Design, Develop, and Prototype. Cannot publish or manage users.",hierarchy:3,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:true,canView:true},DESIGN:{canEdit:true,canView:true},DEVELOP:{canEdit:true,canView:true},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:true,canView:true},MCP:{canEdit:false,canView:false}}},CONSUMER:{id:"CONSUMER",title:"Consumer",description:"Can view documentation and edit prototypes. Cannot access Design or Develop sections.",hierarchy:2,permissions:{canManageUsers:false,canDelete:false,canEdit:true,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:true,canView:true},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},VIEWER:{id:"VIEWER",title:"Viewer",description:"Read-only access to documentation. Cannot edit anything.",hierarchy:1,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},ANONYMOUS:{id:"ANONYMOUS",title:"Anonymous",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:true},sectionAccess:{ROOT:{canEdit:false,canView:true},DOCUMENT:{canEdit:false,canView:true},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},EDITOR:{id:"EDITOR",title:"Editor",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}},MANAGER:{id:"MANAGER",title:"Manager",description:"",hierarchy:0,permissions:{canManageUsers:false,canDelete:false,canEdit:false,canPublish:false,canView:false},sectionAccess:{ROOT:{canEdit:false,canView:false},DOCUMENT:{canEdit:false,canView:false},DESIGN:{canEdit:false,canView:false},DEVELOP:{canEdit:false,canView:false},PROTOTYPE:{canEdit:false,canView:false},SETTINGS:{canEdit:false,canView:false},MCP:{canEdit:false,canView:false}}}},ea=Object.values(pn);function oa({path:e,queryParams:r,origin:a}){return urls.createUrlWithParams({url:e,queryParams:r,origin:a})}n(oa,"createUrlForRoute");function cn(e){return Object.fromEntries(e.entries())}n(cn,"getParams");function ra(e){return cn(e)}n(ra,"getParamsForRoute");Object.defineProperty(exports,"isObjKey",{enumerable:true,get:function(){return utils.isObjKey}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function(){return utils.isObject}});exports.ALL_INFER_SPEC_FILTER_KEYS=he;exports.BlockSizes=Gn;exports.BlockSpacings=$n;exports.CodeSrcUserConfigSchema=Ur;exports.ColorConfigStruct=l;exports.ColorStringStruct=M;exports.ColorTokenConfigStruct=gn;exports.DEFAULT_INFER_SPEC_FILTERS=Eo;exports.FontFaceConfigStruct=w;exports.FontFaceFormatsEnumStruct=We;exports.FontFaceSourceFormats=ze;exports.FontFaceSourceStruct=Le;exports.FontFaceWeightStruct=ye;exports.FontSizeConfigStruct=$e;exports.FontSizeConfigValStruct=me;exports.FontStretches=Ge;exports.GitProviderType=on;exports.HeadingLevels=Sn;exports.KsAppClientDataAndMetaStruct=Lo;exports.KsAppClientDataAndMetaStructV3=pr;exports.KsAppClientDataNoMetaStruct=zo;exports.KsAppClientDataNoMetaStructV3=sr;exports.KsAppClientDataNoMetaZod=Wo;exports.KsMetaStateStruct=jt;exports.KsMetaStateStructV3=_t;exports.KsRemoteChangesStruct=Zt;exports.KsRendererClientEvents=nn;exports.MergeableState=rn;exports.NavCustomizationConfigStruct=E;exports.PageHeaderSizes=De;exports.PrimaryNavCustomizationConfigStruct=W;exports.PropTypeNames=Ht;exports.RestActions=an;exports.SecondaryNavCustomizationConfigStruct=L;exports.TextEncoding=sn;exports.TextTransforms=_e;exports.TokenReferenceStruct=c;exports.TokenValueColorStruct=A;exports.TokenValueCubicBezierStruct=G;exports.TokenValueDimensionStruct=h;exports.TokenValueDurationStruct=R;exports.TokenValueFontWeightStruct=pe;exports.TokenValueStrokeStyleStruct=K;exports.TypographyConfigStruct=s;exports.TypographyLinkConfigStruct=O;exports.UiConfigStruct=zn;exports.UiConfigV10Struct=Je;exports.UiConfigV1Struct=wn;exports.UiConfigV2Struct=On;exports.UiConfigV3Struct=Bn;exports.UiConfigV4Struct=An;exports.UiConfigV5Struct=Kn;exports.UiConfigV6Struct=Fn;exports.UiConfigV7Struct=Mn;exports.UiConfigV8Struct=Un;exports.UiConfigV9Struct=jn;exports.WS_EVENTS=Xr;exports.addIdToTemplateInfo=zr;exports.appSections=kr;exports.appSectionsById=$t;exports.assertTokenData=ro;exports.convertTemplateInfoToOldWay=Lr;exports.createTemplateInfoId=Qt;exports.createUrlForRoute=oa;exports.customizableNavElements=Pn;exports.decodeInferSpecFilters=vo;exports.emptyAppClientData=jo;exports.encodeInferSpecFilters=Ro;exports.getParams=cn;exports.getParamsForRoute=ra;exports.getPrimitiveValue=bo;exports.hasTokenReferences=x;exports.isArrayOfNumbersProp=Rr;exports.isArrayOfObjectsProp=Pr;exports.isArrayOfStringsProp=Er;exports.isBooleanProp=xr;exports.isCustomTypeScriptProp=Ir;exports.isDataDemo=Po;exports.isDemoWithData=Io;exports.isDimensionString=Co;exports.isFunctionProp=Dr;exports.isKsAppClientDataAndMeta=Ut;exports.isKsAppClientDataAndMetaV3=Lt;exports.isKsAppClientDataNoMeta=Ft;exports.isKsAppClientDataNoMetaV3=Wt;exports.isKsMetaState=_o;exports.isKsMetaStateV3=lr;exports.isKsRemoteChange=Br;exports.isKsRemoteChanges=Ar;exports.isNotTokenReference=Ze;exports.isNumberProp=Cr;exports.isObjectProp=Vr;exports.isOptionsProp=hr;exports.isPatch=wr;exports.isPatches=Or;exports.isRendererIdForNativeMobile=tn;exports.isSpecNotInferred=No;exports.isStringProp=br;exports.isTemplateDemo=Vo;exports.isTemplateInfoForNativeMobile=$r;exports.isTemplateInfoWithCodeSrcPath=jr;exports.isTokenDataComposite=to;exports.isTokenGroup=Bt;exports.isTokenReference=Xe;exports.isTokenSrc=mo;exports.isTokenSrcExtensions=Ot;exports.isTokenSrcValueInfoComposite=co;exports.isTokenSrcValueInfoSingular=lo;exports.isTokenTypeComposite=q;exports.isTokenTypeSingular=Se;exports.isTokenTypeVarRef=yo;exports.isTokenValueBorder=kt;exports.isTokenValueColor=rt;exports.isTokenValueDimension=J;exports.isTokenValueDuration=no;exports.isTokenValueFontWeight=oo;exports.isTokenValueShadow=mt;exports.isTokenValueTransition=Ct;exports.ksRendererClientMetaId=qr;exports.metaForAndroidRenderer=Gr;exports.metaForIosRenderer=_r;exports.migrations=yr;exports.normalizeTemplateInfo=Wr;exports.pageElements=bn;exports.pageElementsV2=Cn;exports.parseTokenDimensionValue=xo;exports.patternTabTypes=Bo;exports.rendererIds=oe;exports.rendererIdsForNativeMobile=en;exports.roles=ea;exports.rolesById=pn;exports.strokeStyleValues=Jn;exports.tokenNameDisplayFormats=Yn;exports.tokenTypeComposites=et;exports.tokenTypeSingulars=nt;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|