Skip to content

Commit

Permalink
Merge branch 'main' into obsidian-docs
Browse files Browse the repository at this point in the history
* main: (151 commits)
  Created a small script to set repository configuration
  Major improvements to correlation diagrams
  merged correctly
  test
  fixed yarn lock
  moved around
  added new links
  locations changes
  merged with start
  Added gap-bound packages
  Updated correlation diagram
  Removed unused label
  Slightly simplified
  Duplicated components for scale
  Starting point to separate scale
  Hoisted some data fetching
  Updated column types
  Brought column module into the system
  Made everything more compact
  Updated column colors
  ...
  • Loading branch information
davenquinn committed Jul 3, 2024
2 parents 5baf64b + db1f5e0 commit 32bfe69
Show file tree
Hide file tree
Showing 127 changed files with 7,064 additions and 1,352 deletions.
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ docker-compose.yaml
!.yarn/sdks
!.yarn/versions

.vite
# IntelliJ
.idea/workspace.xml
.idea/tasks.xml


# For ignoring static files
*.png
*.jpg

.vite
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/runConfigurations/Run_with_Chrome_Debugger.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/web.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ pnpFallbackMode: all
pnpMode: loose

yarnPath: .yarn/releases/yarn-4.2.2.cjs

packageExtensions:
debug@*:
dependencies:
supports-color: "*"

vite@*:
dependencies:
supports-color: "*"
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Initialize the development environment with common settings
all:
git config --local submodule.recurse true
git submodule update --init --recursive
yarn install
7 changes: 0 additions & 7 deletions babel.config.js

This file was deleted.

29 changes: 21 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"clean": "rm -rf dist/*",
"dev": "NODE_NO_WARNINGS=1 yarn run server:dev",
"build": "vite build",
"server": "node ./server/index.js",
"server:dev": "node --env-file=.env ./server/index.js",
"server": "tsx ./server/index.ts",
"server:dev": "tsx --env-file=.env ./server/index.ts",
"format": "prettier --write src packages",
"server:prod": "NODE_NO_WARNINGS=1 NODE_ENV=production yarn run server",
"dev:storybook": "yarn workspace @macrostrat/storybook run dev",
"start": "yarn run build && yarn run server"
"start": "yarn run build && yarn run server",
"test": "vitest"
},
"workspaces": [
"deps/web-components/packages/*",
Expand All @@ -35,14 +36,17 @@
"@macrostrat/revision-info-webpack": "^1.0.0",
"@macrostrat/storybook": "workspace:*",
"@mdx-js/rollup": "^2.3.0",
"@types/esprima": "^4",
"@types/underscore": "^1",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"@yarnpkg/sdks": "^3.1.0",
"prettier": "^2.7.1",
"sass": "^1.49.0",
"stylus": "^0.55.0",
"typescript": "^5.1.6",
"vite-plugin-rewrite-all": "^1.0.1"
"vite-plugin-rewrite-all": "^1.0.1",
"vitest": "^1.6.0"
},
"dependencies": {
"@blueprintjs/core": "^5.10.2",
Expand All @@ -60,6 +64,7 @@
"@macrostrat-web/settings": "workspace:*",
"@macrostrat-web/sift": "workspace:*",
"@macrostrat-web/text-toolchain": "workspace:*",
"@macrostrat-web/utility-functions": "workspace:*",
"@macrostrat/api-utils": "workspace:*",
"@macrostrat/api-views": "workspace:*",
"@macrostrat/auth-components": "workspace:*",
Expand All @@ -83,14 +88,18 @@
"@turf/bbox": "^6.5.0",
"@turf/boolean-contains": "^6.5.0",
"@turf/buffer": "^6.5.0",
"@turf/centroid": "^6.5.0",
"@turf/centroid": "^7.0.0",
"@turf/distance": "^7.0.0",
"@turf/line-intersect": "^7.0.0",
"@turf/nearest-point-on-line": "^7.0.0",
"@types/compression": "^1.7.2",
"@types/express": "^4.17.17",
"@types/geojson": "^7946.0.10",
"@types/node": "^20.4.10",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@types/react-redux": "^7.1.7",
"@universal-middleware/express": "^0.0.2",
"@visx/axis": "^2.14.0",
"@visx/scale": "^2.2.2",
"@vitejs/plugin-react": "^4.0.4",
Expand All @@ -109,6 +118,7 @@
"d3-shape": "^3.2.0",
"esbuild": "^0.20.0",
"esbuild-register": "^3.5.0",
"esprima": "^4.0.1",
"express": "^4.18.2",
"hex-to-css-filter": "^5.4.0",
"history": "^5.3.0",
Expand All @@ -131,13 +141,16 @@
"swagger-ui-react": "^5.12.3",
"topojson-client": "^3.0.0",
"transition-hook": "^1.5.2",
"tsx": "^4.11.2",
"underscore": "^1.13.6",
"use-debounce": "^9.0.4",
"use-react-router-breadcrumbs": "^3.2.1",
"use-resize-observer": "^9.1.0",
"vike": "^0.4.159",
"vike-react": "^0.4.2",
"vite": "^5.0.12",
"vike": "^0.4.172",
"vike-react": "^0.4.11",
"vite": "^5.2.11",
"vite-plugin-cesium": "^1.2.22",
"vite-plugin-inspect": "^0.8.4",
"zustand": "^4.5.1"
},
"prettier": {
Expand Down
5 changes: 5 additions & 0 deletions packages/utility-functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@macrostrat-web/utility-functions",
"version": "1.0.0",
"main": "src/index.ts"
}
68 changes: 68 additions & 0 deletions packages/utility-functions/src/chronostratigraphy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
export type AgeRange = [number, number];

enum MergeMode {
Inner,
Outer,
}

export function mergeAgeRanges(
ranges: AgeRange[],
mergeMode: MergeMode = MergeMode.Outer
): AgeRange {
/** Merge a set of age ranges to get the inner or outer bounds */
let min = Infinity;
let max = 0;
// Negative ages are not handled

if (mergeMode === MergeMode.Inner) {
min = Math.min(...ranges.map((d) => d[0]));
max = Math.max(...ranges.map((d) => d[1]));
} else {
min = Math.max(...ranges.map((d) => d[0]));
max = Math.min(...ranges.map((d) => d[1]));
}

// Age ranges should start with the oldest (largest) age
if (min < max) {
return [max, min];
}
return [min, max];
}

enum AgeRangeRelationship {
Disjoint,
Contains,
Contained,
Identical,
}

function convertToForwardOrdinal(a: AgeRange): AgeRange {
/** Age ranges are naturally expressed as [b_age, t_age] where
* b_age is the older age and t_age is the younger age. This function
* converts the age range to [min, max] where min is the oldest age,
* expressed as negative numbers. This assists with intuitive ordering
* in certain cases.
*/
return [-a[0], -a[1]];
}

export function compareAgeRanges(
a: AgeRange,
b: AgeRange
): AgeRangeRelationship {
const a1 = convertToForwardOrdinal(a);
const b1 = convertToForwardOrdinal(b);
/** Compare two age ranges */
if (a1[0] > b1[1] || a1[1] < b1[0]) {
return AgeRangeRelationship.Disjoint;
}
if (a1[0] === b1[0] && a1[1] === b1[1]) {
return AgeRangeRelationship.Identical;
}
if (a1[0] <= b1[0] && a1[1] >= b1[1]) {
return AgeRangeRelationship.Contains;
}
if (a1[0] >= b1[0] && a1[1] <= b1[1]) {
return AgeRangeRelationship.Contained;
}
}
1 change: 1 addition & 0 deletions packages/utility-functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./chronostratigraphy";
Loading

0 comments on commit 32bfe69

Please sign in to comment.