Skip to content

Commit

Permalink
Lint worker (#16)
Browse files Browse the repository at this point in the history
* todo updates

* most of linter story

* fix tests

* moving some stuff around, the way that the suggest fixes needs to get clean up stull, and paramoptions is in the process of being ripped out

* add tests, convert almost all the rest of the lints

* size discrim as lang

* add in gamut

* fix types

* catch a bug
  • Loading branch information
mcnuttandrew authored Feb 14, 2024
1 parent 52ccdc3 commit 40359b1
Show file tree
Hide file tree
Showing 46 changed files with 1,289 additions and 1,162 deletions.
3 changes: 3 additions & 0 deletions LintLanguageDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Math Operations:
+: {left: Number | Variable, right: Number | Variable}
/: {left: Number | Variable, right: Number | Variable}
-: {left: Number | Variable, right: Number | Variable}
absDiff: {left: Number | Variable, right: Number | Variable}

Value Comparisons:
{dist: {left: Color | Variable, right: Color | Variable}, space: COLOR_SPACE }
Expand All @@ -44,10 +45,12 @@ Color Manipulations:
{toColor: variableName, space: 'lab' | 'hsl' | etc, channel: 'a' | 'b' | 'l' | etc}
{cvdSim: variableName, type: 'protanomaly' | 'deuteranomaly' | 'tritanopia' | 'grayscale'}
{name: variableName}
{inGamut: variableName | Color}

Maps:
{map: Variable | Value[], func: Operation, varb: Variable}
{sort: Variable | Value[], func: Operation, varb: Variable}
{reverse: Variable | Value[]}
{filter: Variable | Value[], func: EXPR, varb: Variable}

```yaml
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,47 @@ First time you start it up you should also run `yarn prep data`

# User study burn down

- [ ] Make lints fast / non blocking as much as possible
- [ ] Get most of the lints converted
- [ ] Tour?
- [ ] roles, palette level semantics
- [ ] Design adjustments for smaller screens
- [ ] Language Docs??
- [x] Get most of the lints converted
- [x] Make lints fast / non blocking as much as possible

# Language todos

- [ ] Clone Rule
- [ ] Affect rules
- [ ] Add more blame robustness, may pay to try to reason across all of the operator families (insight: keep a list of the blamable variables in the environment to support tracing)
- [ ] per cols 4 all: color blindness metric should maybe be sensitive to task?
- [ ] Sequential check fix is incorrect for things with equi-ligthness
- [ ] Macros story: "not similar", "sequences", "where": { "!=": {"left": "index(a)", "right": "index(b)"} },
- [x] "No out of gamut"

# General Todos

- [ ] Its really annoying to have to update schema, types, docs whenever a lang change is made. Can this be automated?
- [ ] Compact more compact
- [ ] Merge the info and fixes tooltips in the lints
- [ ] Color Space selections should persist
- [ ] Make name discrim hueristc fix more resilient, see switching to basic colors
- [ ] Search palettes-by-lint screen
- [ ] Drag to re-order points?
- [ ] off by one persistance error in undo/redo
- [ ] Changing spaces is pretty bad on lab <-> oklab, cf ("#35ffbf", "#87b995", "#e84f82")
- [ ] "Easy on ramp" progressive disclosure
- [ ] Labels, tooltips, etc
- [ ] Handles get stuck on channel picker again, ugh
- [ ] Bug: Color channel usage slightly cursed (doesn't update positions correctly)
- [ ] Bug: rotate in polar coordinates doesn't work right
- [ ] Performance stuff for linter (separate message generation into something very throttled, maybe move to web workers? Cache as hard as possible)
- [ ] LCH colors upside down god damn it

Parameterization epic:

- [ ] Allow no palettes, allows renaming of non-current palettes, which would be enable by:
- [ ] Parameterize the scatter column completely, allow edits to the compare stuff
- [ ] Hover broken on compare
- [ ] Hover broken on compare, also make sure it takes the right stringify (same as the color channel)
- [ ] Select compare from palettes drop down menu

# Nice to have
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@types/color-namer": "^1.3.3",
"@types/d3": "^7.4.3",
"@vitest/coverage-v8": "^1.2.2",
"@vitest/web-worker": "^1.2.2",
"autoprefixer": "^10.4.16",
"jsdom": "^24.0.0",
"netlify-cli": "^17.10.1",
Expand Down
58 changes: 49 additions & 9 deletions public/lint-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^(\\+|\\-|\\*|\\/)$": {
"^(\\+|\\-|\\*|\\/|absDiff)$": {
"anyOf": [
{ "type": "number" },
{ "$ref": "#/definitions/LintVariable" }
Expand Down Expand Up @@ -70,6 +70,7 @@
"contrast": {
"type": "object",
"additionalProperties": false,
"description": "Compute the contrast between two colors using a given algorithm. The algorithm can be APCA, WCAG21, Michelson, Weber, Lstar or DeltaPhi.",
"properties": {
"left": { "$ref": "#/definitions/LintRef" },
"right": { "$ref": "#/definitions/LintRef" },
Expand All @@ -92,13 +93,46 @@
]
},
"LintMap": {
"type": "object",
"additionalProperties": false,
"properties": {
"filter": { "$ref": "#/definitions/LintVariable" },
"func": { "$ref": "#/definitions/LintExpression" }
},
"required": ["filter", "func"]
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"filter": { "$ref": "#/definitions/LintVariable" },
"func": { "$ref": "#/definitions/LintExpression" },
"varb": { "$ref": "#/definitions/LintVariable" }
},
"required": ["filter", "func", "varb"]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"map": { "$ref": "#/definitions/LintVariable" },
"func": { "$ref": "#/definitions/LintExpression" },
"varb": { "$ref": "#/definitions/LintVariable" }
},
"required": ["map", "func", "varb"]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"reduce": { "$ref": "#/definitions/LintVariable" }
},
"required": ["reverse"]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"sort": { "$ref": "#/definitions/LintVariable" },
"func": { "$ref": "#/definitions/LintExpression" },
"varb": { "$ref": "#/definitions/LintVariable" }
},
"required": ["sort", "func", "varb"]
}
]
},
"LintReduce": {
"type": "object",
Expand All @@ -118,6 +152,7 @@
{
"type": "object",
"additionalProperties": false,
"description": "Simulate color vision deficiency. The type can be protanomaly, deuteranomaly, tritanopia or grayscale.",
"properties": {
"cvdSim": { "$ref": "#/definitions/LintVariable" },
"type": {
Expand All @@ -131,7 +166,12 @@
},
"required": ["cvdSim", "type"]
},
{ "$ref": "#/definitions/LintVariable" },
{
"type": "object",
"additionalProperties": false,
"properties": { "inGamut": { "$ref": "#/definitions/LintVariable" } },
"required": ["inGamut"]
},
{
"type": "object",
"additionalProperties": false,
Expand Down
Loading

0 comments on commit 40359b1

Please sign in to comment.