@macrostrat/column-views 3.6.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +144 -0
  2. package/dist/animated-age-window.cjs +51 -0
  3. package/dist/animated-age-window.cjs.map +1 -0
  4. package/dist/animated-age-window.d.ts +51 -0
  5. package/dist/animated-age-window.js +51 -0
  6. package/dist/animated-age-window.js.map +1 -0
  7. package/dist/column-views.css +118 -89
  8. package/dist/column.cjs +12 -3
  9. package/dist/column.cjs.map +1 -1
  10. package/dist/column.d.ts +11 -0
  11. package/dist/column.js +12 -3
  12. package/dist/column.js.map +1 -1
  13. package/dist/column.module.sass.cjs +15 -15
  14. package/dist/column.module.sass.js +15 -15
  15. package/dist/correlation-chart/main.cjs +156 -42
  16. package/dist/correlation-chart/main.cjs.map +1 -1
  17. package/dist/correlation-chart/main.d.ts +40 -2
  18. package/dist/correlation-chart/main.js +138 -23
  19. package/dist/correlation-chart/main.js.map +1 -1
  20. package/dist/correlation-chart/main.module.sass.cjs +23 -20
  21. package/dist/correlation-chart/main.module.sass.cjs.map +1 -1
  22. package/dist/correlation-chart/main.module.sass.js +23 -20
  23. package/dist/correlation-chart/main.module.sass.js.map +1 -1
  24. package/dist/correlation-chart/prepare-data.cjs +0 -1
  25. package/dist/correlation-chart/prepare-data.cjs.map +1 -1
  26. package/dist/correlation-chart/prepare-data.js +0 -1
  27. package/dist/correlation-chart/prepare-data.js.map +1 -1
  28. package/dist/data-provider/store.cjs +17 -4
  29. package/dist/data-provider/store.cjs.map +1 -1
  30. package/dist/data-provider/store.d.ts +6 -1
  31. package/dist/data-provider/store.js +17 -4
  32. package/dist/data-provider/store.js.map +1 -1
  33. package/dist/data-provider/unit-selection.cjs +4 -1
  34. package/dist/data-provider/unit-selection.cjs.map +1 -1
  35. package/dist/data-provider/unit-selection.d.ts +1 -1
  36. package/dist/data-provider/unit-selection.js +4 -1
  37. package/dist/data-provider/unit-selection.js.map +1 -1
  38. package/dist/index.cjs +16 -4
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +5 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/maps/column-correlation/core.cjs +127 -6
  44. package/dist/maps/column-correlation/core.cjs.map +1 -1
  45. package/dist/maps/column-correlation/core.js +128 -7
  46. package/dist/maps/column-correlation/core.js.map +1 -1
  47. package/dist/maps/column-correlation/state.cjs +63 -2
  48. package/dist/maps/column-correlation/state.cjs.map +1 -1
  49. package/dist/maps/column-correlation/state.d.ts +31 -1
  50. package/dist/maps/column-correlation/state.js +63 -2
  51. package/dist/maps/column-correlation/state.js.map +1 -1
  52. package/dist/maps/layers/columns.cjs +5 -1
  53. package/dist/maps/layers/columns.cjs.map +1 -1
  54. package/dist/maps/layers/columns.js +5 -1
  55. package/dist/maps/layers/columns.js.map +1 -1
  56. package/dist/prepare-units/composite-scale.cjs +94 -8
  57. package/dist/prepare-units/composite-scale.cjs.map +1 -1
  58. package/dist/prepare-units/composite-scale.d.ts +39 -0
  59. package/dist/prepare-units/composite-scale.js +96 -10
  60. package/dist/prepare-units/composite-scale.js.map +1 -1
  61. package/dist/prepare-units/helpers.cjs +0 -1
  62. package/dist/prepare-units/helpers.cjs.map +1 -1
  63. package/dist/prepare-units/helpers.js +0 -1
  64. package/dist/prepare-units/helpers.js.map +1 -1
  65. package/dist/prepare-units/index.cjs +33 -12
  66. package/dist/prepare-units/index.cjs.map +1 -1
  67. package/dist/prepare-units/index.js +34 -13
  68. package/dist/prepare-units/index.js.map +1 -1
  69. package/dist/prepare-units/types.cjs.map +1 -1
  70. package/dist/prepare-units/types.d.ts +13 -0
  71. package/dist/prepare-units/types.js.map +1 -1
  72. package/dist/section.cjs +10 -2
  73. package/dist/section.cjs.map +1 -1
  74. package/dist/section.d.ts +5 -0
  75. package/dist/section.js +10 -2
  76. package/dist/section.js.map +1 -1
  77. package/dist/unit-details/age-range.cjs +2 -1
  78. package/dist/unit-details/age-range.cjs.map +1 -1
  79. package/dist/unit-details/age-range.js +2 -1
  80. package/dist/unit-details/age-range.js.map +1 -1
  81. package/dist/unit-details/index.d.ts +1 -1
  82. package/dist/unit-details/panel.cjs +2 -3
  83. package/dist/unit-details/panel.cjs.map +1 -1
  84. package/dist/unit-details/panel.js +1 -2
  85. package/dist/unit-details/panel.js.map +1 -1
  86. package/dist/unit-details/panel.module.sass.cjs +18 -22
  87. package/dist/unit-details/panel.module.sass.cjs.map +1 -1
  88. package/dist/unit-details/panel.module.sass.js +18 -22
  89. package/dist/unit-details/panel.module.sass.js.map +1 -1
  90. package/dist/unit-details/strat-names.cjs +1 -2
  91. package/dist/unit-details/strat-names.cjs.map +1 -1
  92. package/dist/unit-details/strat-names.js +1 -2
  93. package/dist/unit-details/strat-names.js.map +1 -1
  94. package/dist/units/boxes.cjs +20 -36
  95. package/dist/units/boxes.cjs.map +1 -1
  96. package/dist/units/boxes.js +22 -38
  97. package/dist/units/boxes.js.map +1 -1
  98. package/dist/units/composite.cjs +12 -12
  99. package/dist/units/composite.cjs.map +1 -1
  100. package/dist/units/composite.js +12 -12
  101. package/dist/units/composite.js.map +1 -1
  102. package/package.json +9 -9
  103. package/src/animated-age-window.ts +120 -0
  104. package/src/column.module.sass +6 -0
  105. package/src/column.ts +24 -0
  106. package/src/correlation-chart/main.module.sass +46 -2
  107. package/src/correlation-chart/main.ts +210 -17
  108. package/src/correlation-chart/prepare-data.ts +0 -1
  109. package/src/data-provider/store.ts +21 -2
  110. package/src/data-provider/unit-selection.ts +13 -2
  111. package/src/index.ts +1 -0
  112. package/src/maps/column-correlation/column-correlation-map.stories.ts +12 -0
  113. package/src/maps/column-correlation/core.ts +155 -9
  114. package/src/maps/column-correlation/state.ts +110 -2
  115. package/src/maps/layers/columns.ts +7 -1
  116. package/src/prepare-units/composite-scale.ts +210 -10
  117. package/src/prepare-units/helpers.ts +0 -2
  118. package/src/prepare-units/index.ts +68 -14
  119. package/src/prepare-units/types.ts +13 -0
  120. package/src/section.ts +15 -1
  121. package/src/unit-details/age-range.ts +3 -1
  122. package/src/unit-details/index.ts +7 -1
  123. package/src/unit-details/panel.module.sass +0 -8
  124. package/src/unit-details/panel.ts +6 -6
  125. package/src/unit-details/strat-names.ts +1 -1
  126. package/src/units/boxes.ts +33 -53
  127. package/src/units/composite.ts +21 -12
  128. package/dist/correlation-chart/stories/utils.d.ts +0 -6
  129. package/dist/unit-details/identifiers.cjs +0 -56
  130. package/dist/unit-details/identifiers.cjs.map +0 -1
  131. package/dist/unit-details/identifiers.d.ts +0 -31
  132. package/dist/unit-details/identifiers.js +0 -54
  133. package/dist/unit-details/identifiers.js.map +0 -1
  134. package/src/correlation-chart/stories/correlation-chart.stories.ts +0 -228
  135. package/src/correlation-chart/stories/namibia-correlation.stories.ts +0 -151
  136. package/src/correlation-chart/stories/stories.module.sass +0 -18
  137. package/src/correlation-chart/stories/utils.ts +0 -24
  138. package/src/unit-details/identifiers.ts +0 -67
@@ -1,151 +0,0 @@
1
- import "@macrostrat/style-system";
2
- import { MergeSectionsMode, UnitComponent } from "../..";
3
- import { Meta } from "@storybook/react-vite";
4
-
5
- import h from "./stories.module.sass";
6
- import { CorrelationChart } from "../main";
7
- import { BaseUnit } from "@macrostrat/api-types";
8
- import { useGeologicPattern } from "@macrostrat/column-components";
9
-
10
- export default {
11
- title: "Column views/Correlation chart",
12
- component: CorrelationChart,
13
- parameters: {
14
- layout: "fullscreen",
15
- docs: {
16
- description: {
17
- component: "Correlation chart for Macrostrat columns",
18
- },
19
- story: {
20
- inline: false,
21
- iframeHeight: 500,
22
- },
23
- },
24
- },
25
- args: {},
26
- } as Meta<typeof CorrelationChart>;
27
-
28
- const nosib = {
29
- b_age: 900,
30
- t_age: 800,
31
- name: "Nosib",
32
- color: "#ffd4ba",
33
- };
34
-
35
- const namUnits: (BaseUnit | BaseUnit[])[] = [
36
- [
37
- nosib,
38
- { b_age: 746, t_age: 720, name: "Chuos", color: "#d0b4ff" },
39
- {
40
- b_age: 720,
41
- t_age: 600,
42
- name: "Otavi",
43
- color: "dodgerblue",
44
- },
45
- ],
46
- [
47
- nosib,
48
- {
49
- b_age: 740,
50
- t_age: 600,
51
- name: "Swakop",
52
- color: "#aaa",
53
- },
54
- ],
55
- [
56
- nosib,
57
- {
58
- b_age: 670,
59
- t_age: 580,
60
- name: "Witvlei",
61
- color: "#fffc4e",
62
- },
63
- ],
64
- [
65
- {
66
- b_age: 610,
67
- t_age: 575,
68
- name: "Zebra Series",
69
- color: "#fdbcf0",
70
- },
71
- {
72
- b_age: 660,
73
- t_age: 610,
74
- name: "Naukluft complex",
75
- color: "#fdbcbc",
76
- },
77
- ],
78
- {
79
- b_age: 550,
80
- t_age: 520,
81
- name: "Nama",
82
- color: "#baf1a7",
83
- },
84
- // {
85
- // unit_id: 0,
86
- // b_age: 900,
87
- // t_age: 0,
88
- // unit_name: "",
89
- // column: 8,
90
- // },
91
- ];
92
-
93
- export function NamibiaCorrelationChart() {
94
- return h(
95
- "div",
96
- {
97
- style: {
98
- "--column-unit-font-size": "14px",
99
- "--column-unit-font-style": "bold",
100
- "--column-text-color": "white",
101
- },
102
- },
103
- [
104
- h(CorrelationChart, {
105
- id: 432,
106
- data: namUnits.map((u, i) => {
107
- let units: any = null;
108
- if (Array.isArray(u)) {
109
- units = u.map((u) => buildUnit(u, i));
110
- } else {
111
- units = [buildUnit(u, i)];
112
- }
113
- return {
114
- columnID: i,
115
- units,
116
- };
117
- }),
118
- columnSpacing: 10,
119
- t_age: 450,
120
- b_age: 850,
121
- //width: 400,
122
- //columnWidth: 400,
123
- pixelScale: 2,
124
- //showLabelColumn: false,
125
- mergeSections: MergeSectionsMode.ALL,
126
- unitComponent: ProvidedColorUnitComponent,
127
- }),
128
- ],
129
- );
130
- }
131
-
132
- function buildUnit(unit, i) {
133
- return {
134
- unit_id: i,
135
- col_id: i,
136
- ...unit,
137
- unit_name: unit.name,
138
- };
139
- }
140
-
141
- function ProvidedColorUnitComponent(props) {
142
- /** A unit component that is colored by its own properties. */
143
-
144
- const fill = useGeologicPattern(props.division.patternID);
145
-
146
- return h(UnitComponent, {
147
- fill,
148
- backgroundColor: props.division.color ?? null,
149
- ...props,
150
- });
151
- }
@@ -1,18 +0,0 @@
1
- .column-ui
2
- height: 100%
3
- width: 100%
4
- overflow: scroll
5
-
6
- .correlation-container
7
- padding: 2em calc(350px + 2em) 2em 2em
8
- width: fit-content
9
-
10
- .right-column
11
- width: 350px
12
- position: fixed
13
- top: 0
14
- right: 0
15
- padding: 1em
16
-
17
- .column-selector-map, .correlation-map
18
- height: 350px
@@ -1,24 +0,0 @@
1
- import { useArgs } from "storybook/preview-api";
2
- import { useCallback } from "react";
3
- import { parseLineFromString, stringifyLine } from "../hash-string";
4
-
5
- export function useCorrelationLine() {
6
- const [{ focusedLine, selectedUnit }, updateArgs] = useArgs();
7
- const setFocusedLine = (line) => {
8
- updateArgs({ focusedLine: stringifyLine(line) });
9
- };
10
-
11
- const setSelectedUnit = useCallback(
12
- (selectedUnit) => {
13
- updateArgs({ selectedUnit });
14
- },
15
- [updateArgs],
16
- );
17
-
18
- return {
19
- focusedLine: parseLineFromString(focusedLine),
20
- setFocusedLine,
21
- selectedUnit,
22
- setSelectedUnit,
23
- };
24
- }
@@ -1,67 +0,0 @@
1
- import { isClickable, ItemInteractionProps } from "@macrostrat/data-components";
2
- import h from "./panel.module.sass";
3
- import { ReactNode } from "react";
4
- import classNames from "classnames";
5
-
6
- export function ClickableText({
7
- className,
8
- ...rest
9
- }: {
10
- className?: string;
11
- children: ReactNode;
12
- } & ItemInteractionProps) {
13
- /** An optionally clickable text element */
14
- const clickable = isClickable(rest);
15
- const tag = clickable ? "a" : "span";
16
- return h(tag, { className: classNames(className, { clickable }), ...rest });
17
- }
18
-
19
- export function Identifier({
20
- id,
21
- className,
22
- ...rest
23
- }: {
24
- id: number | string;
25
- className?: string;
26
- } & ItemInteractionProps) {
27
- /** An item that displays a numeric identifier, optionally clickable */
28
- return h(
29
- ClickableText,
30
- {
31
- className: classNames("identifier", className),
32
- ...rest,
33
- },
34
- id,
35
- );
36
- }
37
-
38
- export type UnitInfo = {
39
- unitID: number;
40
- colID?: number;
41
- name?: string;
42
- };
43
-
44
- export function UnitIdentifier({
45
- unitID,
46
- colID,
47
- name,
48
- ...interactionProps
49
- }: UnitInfo & ItemInteractionProps) {
50
- if (name != null) {
51
- return h(
52
- ClickableText,
53
- {
54
- className: "unit-name",
55
- ...interactionProps,
56
- },
57
- name,
58
- );
59
- }
60
-
61
- return h(Identifier, {
62
- className: "unit-id",
63
- key: unitID,
64
- id: unitID,
65
- ...interactionProps,
66
- });
67
- }