-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sets and scales first class values (#65)
- Loading branch information
Showing
27 changed files
with
119 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...libs/designer-decisions/src/primitives/color/oklab-chroma-scale/createOklabChromaScale.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import type { DecisionValueContext, OklabChromaScale, OklabChromaValue } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createOklabChromaScale = ( | ||
context: DecisionValueContext, | ||
input: OklabChromaValue[], | ||
): OklabChromaScale => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
5 changes: 4 additions & 1 deletion
5
packages/libs/designer-decisions/src/primitives/color/oklab-hue-set/createOklabHueSet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import type { DecisionValueContext, OklabHueSet, OklabHueValue } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createOklabHueSet = ( | ||
context: DecisionValueContext, | ||
input: OklabHueValue[], | ||
): OklabHueSet => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/libs/designer-decisions/src/primitives/color/set/createColorSet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import type { ColorSet, ColorValue, DecisionValueContext } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createColorSet = (context: DecisionValueContext, input: ColorValue[]): ColorSet => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
5 changes: 4 additions & 1 deletion
5
packages/libs/designer-decisions/src/primitives/color/srgb-hue-set/createSRGBHueSet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import type { DecisionValueContext, SRGBHueSet, SRGBHueValue } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createSRGBHueSet = ( | ||
context: DecisionValueContext, | ||
input: SRGBHueValue[], | ||
): SRGBHueSet => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
5 changes: 4 additions & 1 deletion
5
.../designer-decisions/src/primitives/color/srgb-lightness-scale/createSRGBLightnessScale.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import type { DecisionValueContext, SRGBLightnessScale, SRGBLightnessValue } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createSRGBLightnessScale = ( | ||
context: DecisionValueContext, | ||
input: SRGBLightnessValue[], | ||
): SRGBLightnessScale => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/libs/designer-decisions/src/primitives/set/createItemSet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { SetItems } from '../../types'; | ||
|
||
export const createItemSet = <T>(items: T[]): SetItems<T> => ({ | ||
items: () => items, | ||
item: index => items[index], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @index(['./*.{ts,tsx}', './!(private|parts|functions)*/index.{ts,tsx}'], f => `export * from '${f.path.replace(/\/index$/, '')}';`) | ||
export * from './createItemSet'; |
5 changes: 4 additions & 1 deletion
5
packages/libs/designer-decisions/src/primitives/space/scale/createSpaceScale.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import type { DecisionValueContext, SpaceScale, SpaceValue } from '../../../types'; | ||
import { createItemSet } from '../../set'; | ||
|
||
export const createSpaceScale = ( | ||
context: DecisionValueContext, | ||
input: SpaceValue[], | ||
): SpaceScale => { | ||
context.consume(input); | ||
|
||
const items = createItemSet(input); | ||
|
||
return { | ||
get: () => input, | ||
get: () => items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
packages/libs/designer-decisions/src/values/errors/createRefMatchError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/libs/designer-functions/src/cli/helpers/getDecisionStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.