Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3348eff
Rename fossils stories
davenquinn Dec 8, 2025
0357fc5
Re-added a setting to relatively reposition the note connector
davenquinn Dec 8, 2025
aad88ee
Updated style of unit-matching props
davenquinn Dec 8, 2025
142bcb3
Hoist unit grouping
davenquinn Dec 8, 2025
7d74544
Create some helper functions for measurement heights
davenquinn Dec 9, 2025
964bc13
Updated location of measurement files
davenquinn Dec 9, 2025
05bc1f3
Separate out measurements
davenquinn Dec 9, 2025
5d0df23
Simplify taxon ranges
davenquinn Dec 9, 2025
0d2c348
Simplify measurements column
davenquinn Dec 9, 2025
0896ce0
Improve the layout of detrital zircon measurements
davenquinn Dec 9, 2025
4ae54f8
Add approach to set fossil occurances to exact heights
davenquinn Dec 9, 2025
fce1940
Correctly calculate heights of eODP fossil locales
davenquinn Dec 9, 2025
789289d
Fix PBDB collection links
davenquinn Dec 9, 2025
bc31384
Starting point function to group close-together notes
davenquinn Dec 9, 2025
ed26b86
Collapse fossil collections that are close together in height
davenquinn Dec 10, 2025
c2ca250
Streamline pixel-height collapsing logic
davenquinn Dec 10, 2025
b95fbf8
Small improvements to measurements
davenquinn Dec 10, 2025
e65630f
Slightly adjust tick spacing
davenquinn Dec 10, 2025
f596c0d
Improve computation of total height when scale is predefined
davenquinn Dec 10, 2025
ab20cfa
Started working on expandable notes
davenquinn Dec 10, 2025
a8ed645
Started streamlining notes css
davenquinn Dec 10, 2025
5d233be
Starting point for focused notes
davenquinn Dec 10, 2025
cb585cf
Continued simplifications to note editing/focused notes
davenquinn Dec 10, 2025
e6589d9
Prevent interactions when not focused
davenquinn Dec 10, 2025
61f6125
Added basic focusing of note elements
davenquinn Dec 10, 2025
8567c44
Update note styling
davenquinn Dec 10, 2025
ac49ca3
Merge branch 'focused-notes' into column-updates
davenquinn Dec 10, 2025
405f3f5
Update column notes attachment style
davenquinn Dec 10, 2025
ba7199d
Some small updates
davenquinn Dec 10, 2025
3c3990f
Updated changelogs and package versions
davenquinn Dec 10, 2025
3e72a67
Apply formatting changes
davenquinn Dec 10, 2025
49643f4
Updated local package URLs
davenquinn Dec 10, 2025
6da4863
Merge remote-tracking branch 'origin/column-updates' into column-updates
davenquinn Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/column-components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2025-12-10

- Major update to `Note` and note-related components
- Add a `FocusableNoteColumn` mode based on the `EditableNoteColumn` component
- Removed outdated note-related styles and simplified CSS scopes

## [1.3.1] - 2025-11-28

- Update axis components
Expand Down
2 changes: 1 addition & 1 deletion packages/column-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@macrostrat/column-components",
"version": "1.3.1",
"version": "1.4.0",
"description": "React rendering primitives for stratigraphic columns",
"keywords": [
"geology",
Expand Down
19 changes: 14 additions & 5 deletions packages/column-components/src/axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,21 @@ export function AgeAxis(props: AgeAxisProps) {

let tickValues: number[] = undefined;

let ticks = Math.max(Math.round(pixelHeight / tickSpacing), 2);
if (pixelHeight < 3 * tickSpacing || scale.ticks(2).length < 2) {
// Push ticks towards extrema
const t0 = scale.ticks(4);
let ticks = Math.round(pixelHeight / tickSpacing);
if (pixelHeight < 3 * tickSpacing) {
// Push ticks towards extrema (we need more than 2 to be resolved)

let t0: number[] = [];
while (t0.length <= 2) {
ticks += 1;
t0 = scale.ticks(ticks);
}

tickValues = [t0[0], t0[t0.length - 1]];
tickValues = t0;
if (pixelHeight < 2 * tickSpacing) {
// Only show first and last ticks
tickValues = [t0[0], t0[t0.length - 1]];
}
}

if (pixelHeight < minTickSpacing) {
Expand Down
7 changes: 6 additions & 1 deletion packages/column-components/src/hyper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { hyperStyled } from "@macrostrat/hyper";
import styles from "./main.module.scss";
import noteStyles from "./notes/notes.module.sass";

const h = hyperStyled(styles);
const styles1 = { ...styles, ...noteStyles };

const h = hyperStyled(styles1);

console.log("Styles", styles1);

export default h;
67 changes: 0 additions & 67 deletions packages/column-components/src/main.module.scss
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
.column-notes .col-note-label {
cursor: pointer;
}
.column-notes .note-editor.bp5-editable-text {
user-select: none;
}
.column-notes .note-editor.bp5-editable-text:before {
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.position-editor .handle {
background-color: #d2e9ff;
border: 1px solid #1e90ff;
}
.position-editor .add-span-handle {
background-color: #e9f4ff;
border: 1px dotted #1e90ff;
}
.position-editor .top-handle,
.position-editor .bottom-handle,
.position-editor .add-span-handle {
border-radius: 3px;
}
.note-editor .note-connector {
stroke: #1e90ff;
stroke-width: 3;
}
.col-note-label {
padding-left: 0.3em;
border-left: 1px solid var(--note-color);
margin: 1px 0;
font-style: italic;
z-index: 15;
}
g.height-range line {
stroke: var(--note-color);
stroke-width: 1.2px;
}

.column-image {
position: absolute;
top: 0;
Expand Down Expand Up @@ -79,32 +38,6 @@ g.height-range line {
}

:global {
g.note,
g.note-editor {
--note-color: var(
--column-note-color,
var(--column-stroke-color, var(--text-color, #000))
);
}
g.note circle,
g.note-editor circle {
fill: var(--note-color);
}
g.note .link,
g.note-editor .link {
stroke: var(--note-color);
stroke-width: 1;
fill: none;
}
.new-note circle {
fill: #1e90ff;
}
.new-note line {
stroke: #1e90ff;
stroke-width: 3;
marker-start: url("#new_arrow_start");
marker-end: url("#new_arrow_end");
}
#new_arrow_start,
#new_arrow_end {
fill: #1e90ff;
Expand Down
1 change: 0 additions & 1 deletion packages/column-components/src/notes/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const NotePositioner = forwardRef(function (
{
ref,
onClick,
style: { margin: outerPad },
},
children,
),
Expand Down
54 changes: 34 additions & 20 deletions packages/column-components/src/notes/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const NoteTextEditor = function (props: NoteEditorProps) {
interface NoteEditorProviderProps {
inEditMode: boolean;
noteEditor: ComponentType<NoteEditorProps>;
onUpdateNote: (n: NoteData) => void;
onDeleteNote: (n: NoteData) => void;
onCreateNote: Function;
onUpdateNote?: (n: NoteData) => void;
onDeleteNote?: (n: NoteData) => void;
onCreateNote?: Function;
children?: React.ReactNode;
}

Expand All @@ -50,7 +50,7 @@ function NoteEditorProvider(props: NoteEditorProviderProps) {
const deleteNote = function () {
const val = editingNote;
setEditingNote(null);
return props.onDeleteNote(val);
return props.onDeleteNote?.(val);
};

const onCreateNote = function (pos) {
Expand All @@ -76,7 +76,7 @@ function NoteEditorProvider(props: NoteEditorProviderProps) {
if (notes.includes(n)) {
return;
}
return props.onUpdateNote(n);
return props.onUpdateNote?.(n);
};

//# Model editor provider gives us a nice store
Expand Down Expand Up @@ -257,22 +257,19 @@ function PositionEditorInner(props) {
);
}

const NoteEditorUnderlay = function ({ padding }) {
const { width } = useContext(NoteLayoutContext);
const { setEditingNote } = useContext(NoteEditorContext) as any;
function NoteEditorUnderlay() {
return h(NoteRect, {
fill: "rgba(255,255,255,0.8)",
style: { pointerEvents: "none" },
className: "underlay",
});
};
}

const NoteEditor = function (props) {
function NoteEditor(props) {
const { allowPositionEditing } = props;
const { noteEditor } = useContext(NoteEditorContext) as any;
const { noteEditor, setEditingNote } = useContext(NoteEditorContext) as any;
const { notes, nodes, elementHeights, createNodeForNote } =
useContext(NoteLayoutContext);
const { editedModel } = useModelEditor();
const { editedModel, model } = useModelEditor();
if (editedModel == null) {
return null;
}
Expand All @@ -297,6 +294,8 @@ const NoteEditor = function (props) {
node = newNode;
}

const edited = editedModel === model;

return h(ErrorBoundary, [
h("g.note-editor.note", [
h(NoteEditorUnderlay),
Expand All @@ -305,15 +304,30 @@ const NoteEditor = function (props) {
note: editedModel,
node,
}),
h(NotePositioner, { offsetY: node.currentPos, noteHeight }, [
h(noteEditor, {
note: editedModel,
key: index,
}),
]),
h(
NotePositioner,
{
offsetY: node.currentPos,
noteHeight,
onClick(evt) {
if (edited) {
setEditingNote(null);
evt.stopPropagation();
}
},
},
[
h(noteEditor, {
note: editedModel,
key: index,
focused: true,
edited,
}),
],
),
]),
]);
};
}

export type { NoteData };
export { NoteEditorProvider, NoteEditorContext, NoteTextEditor, NoteEditor };
10 changes: 8 additions & 2 deletions packages/column-components/src/notes/height-range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface HeightRangeAnnotationProps {
offsetX?: number;
color?: string;
lineInset?: number;
circleRadius?: number;
}

function HeightRangeAnnotation(props: HeightRangeAnnotationProps) {
Expand All @@ -18,6 +19,7 @@ function HeightRangeAnnotation(props: HeightRangeAnnotationProps) {
offsetX = 0,
color,
lineInset = 1,
circleRadius = 2,
...rest
} = props;

Expand All @@ -28,7 +30,11 @@ function HeightRangeAnnotation(props: HeightRangeAnnotationProps) {
}
const topHeight = bottomHeight - pxHeight;

const isLine = pxHeight > 2 * lineInset;
/* Use a value slightly greater than the circle diameter as the cutoff
to switch between line and circle, to account for a circle's greater
visual weight than the equivalent line height
*/
const isLine = pxHeight > 3 * Math.max(lineInset, circleRadius);

const transform = `translate(${offsetX},${topHeight})`;

Expand All @@ -40,7 +46,7 @@ function HeightRangeAnnotation(props: HeightRangeAnnotationProps) {
y2: pxHeight - lineInset,
}),
h.if(!isLine)("circle", {
r: 2,
r: circleRadius,
transform: `translate(0,${pxHeight / 2})`,
}),
]);
Expand Down
Loading