Skip to content

Commit

Permalink
Tour
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Mar 18, 2024
1 parent fd1b991 commit 431d70a
Show file tree
Hide file tree
Showing 11 changed files with 284 additions and 42 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"gen-schema": "npx ts-json-schema-generator --path src/lib/lint-language/lint-type.ts --type LintProgram > public/lint-schema.json --minify && ts-node-esm scripts/pretty-schema.ts"
"gen-schema": "npx ts-json-schema-generator --path src/lib/lint-language/lint-type.ts --type LintProgram > public/lint-schema.json --minify && vite-node scripts/pretty-schema.ts"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.0",
Expand All @@ -31,7 +31,6 @@
"svelte": "^4.2.3",
"svelte-check": "^3.6.0",
"ts-json-schema-generator": "^1.5.0",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vega-typings": "^1.0.1",
Expand All @@ -45,6 +44,7 @@
"colorjs.io": "^0.5.0",
"d3-scale": "^4.0.2",
"d3-shape": "^3.2.0",
"driver.js": "^1.3.1",
"fracturedjsonjs": "^3.1.0",
"idb-keyval": "^6.2.1",
"jsonc-parser": "^3.2.1",
Expand Down
54 changes: 46 additions & 8 deletions public/lint-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@
"required": ["first"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"middle": {
"anyOf": [
{"$ref": "#/definitions/LintVariable"} ,
{ "items": {"$ref": "#/definitions/LintValue"}, "type": "array" },
{"$ref": "#/definitions/LintMap"}
]
}
},
"required": ["middle"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -187,7 +201,11 @@
"channel": {"$ref": "#/definitions/ColorChannel"},
"space": {"$ref": "#/definitions/ColorSpace"},
"toSpace": {
"anyOf": [ {"$ref": "#/definitions/LintVariable"}, {"$ref": "#/definitions/LintColor"} ]
"anyOf": [
{"$ref": "#/definitions/LintVariable" },
{"$ref": "#/definitions/LintColor" },
{"$ref": "#/definitions/LintAggregate"}
]
}
},
"required": ["toSpace", "space", "channel"],
Expand All @@ -196,7 +214,11 @@
{"$ref": "#/definitions/LintColorTagCheck"},
{
"additionalProperties": {
"anyOf": [ {"$ref": "#/definitions/LintVariable"}, {"type": "string"} ]
"anyOf": [
{"$ref": "#/definitions/LintVariable" },
{"$ref": "#/definitions/LintAggregate" },
{ "type": "string"}
]
},
"type": "object"
}
Expand Down Expand Up @@ -388,7 +410,7 @@
{
"additionalProperties": false,
"properties": {
"filter": {"$ref": "#/definitions/alias-1448761563-3892-3953-1448761563-0-6459"},
"filter": {"$ref": "#/definitions/alias-1448761563-3969-4030-1448761563-0-6599"},
"func" : {"$ref": "#/definitions/LintExpression"} ,
"varb" : {"type": "string"}
},
Expand All @@ -399,7 +421,7 @@
"additionalProperties": false,
"properties": {
"func": {"$ref": "#/definitions/LintValue"} ,
"map" : {"$ref": "#/definitions/alias-1448761563-3892-3953-1448761563-0-6459"},
"map" : {"$ref": "#/definitions/alias-1448761563-3969-4030-1448761563-0-6599"},
"varb": {"type": "string"}
},
"required": ["map", "func", "varb"],
Expand All @@ -408,7 +430,7 @@
{
"additionalProperties": false,
"properties": {
"reverse": {"$ref": "#/definitions/alias-1448761563-3892-3953-1448761563-0-6459"}
"reverse": {"$ref": "#/definitions/alias-1448761563-3969-4030-1448761563-0-6599"}
},
"required": ["reverse"],
"type": "object"
Expand All @@ -417,15 +439,15 @@
"additionalProperties": false,
"properties": {
"func": {"$ref": "#/definitions/LintValue"} ,
"sort": {"$ref": "#/definitions/alias-1448761563-3892-3953-1448761563-0-6459"},
"sort": {"$ref": "#/definitions/alias-1448761563-3969-4030-1448761563-0-6599"},
"varb": {"type": "string"}
},
"required": ["sort", "func", "varb"],
"type": "object"
},
{
"additionalProperties": false,
"properties": { "speed": {"$ref": "#/definitions/alias-1448761563-3892-3953-1448761563-0-6459"} },
"properties": { "speed": {"$ref": "#/definitions/alias-1448761563-3969-4030-1448761563-0-6599"} },
"required": ["speed"],
"type": "object"
}
Expand Down Expand Up @@ -497,6 +519,22 @@
"required": ["/"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"//": {
"additionalProperties": false,
"properties": {
"left" : {"$ref": "#/definitions/LintValue"},
"right": {"$ref": "#/definitions/LintValue"}
},
"required": ["left", "right"],
"type": "object"
}
},
"required": ["//"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -740,7 +778,7 @@
"description": "A LintValue is a JSON object that represents a value. It can be a string, a number, a boolean, a LintColor, a LintVariable, a LintMathOps, a LintPairOps, a LintAggregate, a LintColorFunction or a LintExpression"
},
"LintVariable": {"type": "string"},
"alias-1448761563-3892-3953-1448761563-0-6459": {
"alias-1448761563-3969-4030-1448761563-0-6599": {
"anyOf": [
{"$ref": "#/definitions/LintVariable"} ,
{ "items": {"$ref": "#/definitions/LintValue"}, "type": "array" },
Expand Down
15 changes: 14 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import SetSimulation from "./controls/SetSimulation.svelte";
import Zoom from "./controls/Zoom.svelte";
import Browse from "./content-modules/Browse.svelte";
import TourProvider from "./content-modules/TourProvider.svelte";
import { buttonStyle } from "./lib/styles";
const tabs = ["examples", "compare", "eval"];
// const tabs = ["examples", "compare", "eval", "browse"];
Expand Down Expand Up @@ -76,6 +78,14 @@
<div class="w-full flex bg-stone-800 px-2 py-3 text-white">
<SetSimulation />
<Zoom />
<div>
<button
class={buttonStyle}
on:click={() => configStore.setTour(true)}
>
Tour
</button>
</div>
</div>
{#if $configStore.route !== "browse"}
{#if palPresent}
Expand All @@ -91,7 +101,7 @@
{/if}
</div>

<div class="grow">
<div class="grow" id="right-col">
<div class="bg-stone-800">
<div class="flex">
<Nav
Expand Down Expand Up @@ -125,6 +135,9 @@

<KeyboardHooks />
<svelte:window bind:innerWidth />
{#if $configStore.tour}
<TourProvider />
{/if}

<style>
.main-content {
Expand Down
4 changes: 2 additions & 2 deletions src/content-modules/LeftPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="text-4xl font-bold bg-stone-800 text-white px-2 py-1">
Color Buddy 𑁍
</div>
<section class="flex flex-col flex-none">
<section class="flex flex-col flex-none" id="top-controls">
<div class="flex w-full justify-between items-start">
<div class="flex ml-1">
<NewPal />
Expand All @@ -45,7 +45,7 @@
<div class="flex justify-center z-50"></div>
</section>

<section class="flex flex-col flex-1 overflow-auto p-1">
<section class="flex flex-col flex-1 overflow-auto p-1" id="left-panel">
<div class="flex justify-center items-center">
<Nav
tabs={leftPanelTabs}
Expand Down
2 changes: 1 addition & 1 deletion src/content-modules/MainColumn.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
: currentPal.colors.map((x) => simulate_cvd(selectedCVDType, x.color))}
/>

<div class="flex flex-wrap">
<div class="flex flex-wrap" id="scatterplot-controls">
<button
class={`${buttonStyle} pl-0`}
on:click={() => configStore.setScatterplotMode("putting")}
Expand Down
Loading

0 comments on commit 431d70a

Please sign in to comment.