Skip to content

Commit

Permalink
Version 0.9.11
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-gordon committed Sep 26, 2023
1 parent f16bd05 commit c87538f
Show file tree
Hide file tree
Showing 25 changed files with 2,716 additions and 2,746 deletions.
22 changes: 1 addition & 21 deletions examples/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,7 @@ html {
}

body {
background-blend-mode: normal;
background-color: #0000;
background-image: repeating-radial-gradient(
circle at -62% 25%,
#ffffff1f,
#ffffff1f 60px,
#d1d1d187 60px 62px
),
repeating-radial-gradient(
circle at -63% -220%,
#ffffff1f,
#ffffff1f 60px,
#d1d1d187 60px 62px
),
linear-gradient(23deg, #aaaaaa70, #aaaaaa70 0%, #d1d1d187 100%);
background-position: 0 0;
background-repeat: repeat, repeat, repeat;
background-size: 102% 100%;
background-attachment: scroll, scroll, scroll;
background-origin: padding-box, padding-box, padding-box;
background-clip: border-box, border-box, border-box;
background-color: #e1edff;
}

@media (min-width: 640px) {
Expand Down
16 changes: 6 additions & 10 deletions examples/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Home() {
return (
<div className="page max-w-5xl p-4 mx-auto grid gap-12 min-h-screen content-start">
<header className="grid items-baseline justify-between grid-flow-col">
<h1 className="text-xl text-purple-700 font-bold">Graph Selector</h1>
<h1 className="text-xl text-indigo-700 font-bold">Graph Selector</h1>
<div className="right flex gap-3 items-center text-[0px]">
<a
href="https://twitter.com/tone_row_"
Expand Down Expand Up @@ -115,12 +115,8 @@ export default function Home() {
function Banner() {
return (
<div className="banner grid gap-4 max-w-xl">
<h2 className="text-3xl font-bold">
Describe graphs and their associated data in an{" "}
<span className="text-purple-600 italic">
expressive, agnostic syntax
</span>
.
<h2 className="text-2xl tracking-tight">
Describe graphs and their associated data in an expressive, agnostic syntax.
</h2>
<p className="text-sm">
Graph Selector is a language for expressing graphs, such as nodes and
Expand All @@ -131,14 +127,14 @@ function Banner() {
</p>
<div className="flex justify-start gap-2">
<a
className="flex justify-start items-center gap-2 py-2 px-4 bg-purple-700 text-white rounded active:bg-purple-900 hover:bg-purple-800"
className="flex justify-start items-center gap-2 py-2 px-4 bg-indigo-700 text-white rounded active:bg-indigo-900 hover:bg-indigo-800"
href="#installation"
>
Get started <FaArrowRight size={16} />
</a>
<a
href="https://github.com/tone-row/graph-selector"
className="flex justify-start items-center gap-2 py-2 px-4 bg-white text-purple-700 rounded border-2 border-purple-700 hover:bg-purple-700 hover:text-white active:bg-purple-800"
className="flex justify-start items-center gap-2 py-2 px-4 bg-white text-indigo-700 rounded border-2 border-indigo-700 hover:bg-indigo-700 hover:text-white active:bg-indigo-800"
>
<FaGithub size={20} />
Github
Expand All @@ -148,7 +144,7 @@ function Banner() {
Made with ❤️ by{" "}
<a
href="https://twitter.com/tone_row_"
className="text-purple-600 hover:underline"
className="text-indigo-600 hover:underline"
>
Tone Row
</a>
Expand Down
2 changes: 1 addition & 1 deletion examples/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function Nav() {
};
return (
<div className="sticky top-[-1px] pt-3 z-10 -mt-3" ref={navRef}>
<nav className="rounded bg-white p-3 border-2 border-black mt-[1px]">
<nav className="rounded bg-white p-3 mt-[1px]">
<button
className="text-xs flex content-center items-center gap-2 w-full justify-end -mt-2 p-2 pb-0 text-neutral-500 hover:text-neutral-700 sm:hidden"
onClick={() => {
Expand Down
6 changes: 0 additions & 6 deletions graph-selector/jest.config.js

This file was deleted.

66 changes: 33 additions & 33 deletions graph-selector/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
{
"name": "graph-selector",
"type": "module",
"version": "0.9.10",
"source": "src/index.ts",
"version": "0.9.11",
"description": "Parse indented text (flowchart.fun syntax) into a graph",
"source": "src/graph-selector.ts",
"main": "dist/graph-selector.js",
"umd:main": "dist/graph-selector.umd.js",
"module": "dist/graph-selector.mjs",
"exports": {
"require": "./dist/graph-selector.cjs",
"types": "./dist/index.d.ts",
"default": "./dist/graph-selector.modern.js"
"types": "./dist/graph-selector.d.ts",
"require": "./dist/graph-selector.js",
"default": "./dist/graph-selector.modern.mjs"
},
"main": "./dist/graph-selector.cjs",
"types": "./dist/index.d.ts",
"module": "./dist/graph-selector.module.js",
"unpkg": "./dist/graph-selector.umd.js",
"description": "Parser flowchart fun syntax into a generalized graph syntax",
"types": "dist/graph-selector.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "microbundle",
"build": "rm -rf dist && microbundle",
"dev": "microbundle watch",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:coverage:open": "jest --coverage && open coverage/lcov-report/index.html",
"test": "vitest",
"test:ci": "vitest run",
"test:coverage": "vitest --coverage",
"check": "tsc --noEmit",
"lint": "eslint 'src/**/*.{js,cjs,ts}' --quiet --fix",
"lint:staged": "eslint --fix",
"lint:ci": "eslint 'src/**/*.{js,cjs,ts}'",
Expand All @@ -29,25 +31,23 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@types/cytoscape": "^3.19.7",
"@types/jest": "^28.1.7",
"@types/strip-comments": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^8.21.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.1.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.3",
"microbundle": "^0.15.0",
"monaco-editor": "^0.34.0",
"prettier": "^2.7.1",
"ts-jest": "^28.0.8",
"typescript": "^4.7.4"
"@types/strip-comments": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-no-lookahead-lookbehind-regexp": "^0.3.0",
"eslint-plugin-prettier": "^5.0.0",
"microbundle": "^0.15.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vitest": "^0.34.5"
},
"dependencies": {
"@tone-row/strip-comments": "^2.0.6",
"html-entities": "^2.3.3"
"@types/cytoscape": "^3.19.11",
"html-entities": "^2.4.0",
"monaco-editor": "^0.43.0",
"strip-comments": "^2.0.1"
},
"browserslist": [
"defaults"
Expand Down
2 changes: 2 additions & 0 deletions graph-selector/src/getFeatureData.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from "vitest";

import { getFeatureData } from "./getFeatureData";

describe("getFeatureData", () => {
Expand Down
12 changes: 8 additions & 4 deletions graph-selector/src/getFeatureData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { featuresRe } from "./regexps";
import { Data, Descriptor } from "./types";

// TODO: not sure if getFeatureData still needs to remove the features from the line and return what's left of the line
/**
* Given a line, it returns the feaures from the line
*/
export function getFeatureData(_line: string) {
let line = _line.slice(0).trim();
let match: RegExpExecArray | null;
Expand Down Expand Up @@ -32,22 +34,24 @@ export function getFeatureData(_line: string) {
let attrMatch: RegExpExecArray | null;
while ((attrMatch = attrRe.exec(attributes)) != null) {
if (!attrMatch.groups) continue;
const key = attrMatch.groups.key;
if (!key) continue;
const hasAttributeValue = attrMatch.groups.attributeValue !== undefined;
// if it doesn't have an attribute value, set to true and move on
if (!hasAttributeValue) {
data[attrMatch.groups.key] = true;
data[key] = true;
continue;
}

let value: Descriptor =
attrMatch.groups.value1 ?? attrMatch.groups.value2 ?? attrMatch.groups.value3;
attrMatch.groups.value1 ?? attrMatch.groups.value2 ?? attrMatch.groups.value3 ?? "";
const userSuppliedString = attrMatch.groups.rawValue !== value;
// if value is a number and user didn't supply a string (e.g. [hello=1] instead of [hello="1"])
// then parse it as a number
if (!userSuppliedString && !isNaN(Number(value))) {
value = Number(value);
}
data[attrMatch.groups.key] = value;
data[key] = value;
}
}

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions graph-selector/src/matchAndRemovePointers.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from "vitest";

import { matchAndRemovePointers } from "./matchAndRemovePointers";

describe("matchAndRemovePointers", () => {
Expand Down
2 changes: 2 additions & 0 deletions graph-selector/src/operate/addClassesToEdge.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it, test } from "vitest";

import { addClassesToEdge } from "./addClassesToEdge";

describe("addClassesToEdge", () => {
Expand Down
2 changes: 2 additions & 0 deletions graph-selector/src/operate/addClassesToNode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from "vitest";

import { addClassesToNode } from "./addClassesToNode";

describe("addClassesToNode", () => {
Expand Down
2 changes: 2 additions & 0 deletions graph-selector/src/operate/addDataAttributeToNode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from "vitest";

import { addDataAttributeToNode } from "./addDataAttributeToNode";

describe("addDataAttributeToNode", () => {
Expand Down
2 changes: 2 additions & 0 deletions graph-selector/src/operate/dataToString.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from "vitest";

import { dataToString } from "./dataToString";

describe("dataToString", () => {
Expand Down
1 change: 1 addition & 0 deletions graph-selector/src/operate/operate.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, test } from "vitest";
import { operate } from "./operate";

describe("operate", () => {
Expand Down
1 change: 1 addition & 0 deletions graph-selector/src/operate/removeClassesFromEdge.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, test } from "vitest";
import { removeClassesFromEdge } from "./removeClassesFromEdge";

describe("removeClassesFromEdge", () => {
Expand Down
1 change: 1 addition & 0 deletions graph-selector/src/operate/removeClassesFromNode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, expect, it, test } from "vitest";
import { removeClassesFromNode } from "./removeClassesFromNode";

describe("removeClassFromNode", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from "vitest";

import { removeDataAttributeFromNode } from "./removeDataAttributeFromNode";

describe("removeDataAttributeFromNode", () => {
Expand Down
Loading

0 comments on commit c87538f

Please sign in to comment.