gosling.js 0.14.0 → 0.15.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.
package/dist/gosling.js CHANGED
@@ -52,7 +52,7 @@ import require$$0 from "react-dom";
52
52
  import { HiGlassComponent } from "higlass";
53
53
  import { ResizeSensor } from "css-element-queries";
54
54
  const name = "gosling.js";
55
- const version = "0.14.0";
55
+ const version = "0.15.0";
56
56
  const $ref$2 = "#/definitions/GoslingSpec";
57
57
  const $schema$2 = "http://json-schema.org/draft-07/schema#";
58
58
  const definitions$2 = {
@@ -24764,7 +24764,7 @@ const factory$1 = (HGC, context, options) => {
24764
24764
  setMask(position, dimensions) {
24765
24765
  this.pMask.clear();
24766
24766
  this.pMask.beginFill();
24767
- if (this.options.spec.layout === "circular") {
24767
+ if (this.options.spec.layout === "circular" && this.options.spec.overlayOnPreviousTrack) {
24768
24768
  const [x, y] = this.position;
24769
24769
  const [width, height] = this.dimensions;
24770
24770
  const cx = x + width / 2;
@@ -26535,6 +26535,7 @@ const DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER = 300;
26535
26535
  const GoslingComponent = forwardRef((props, ref) => {
26536
26536
  var _a, _b, _c;
26537
26537
  const [viewConfig, setViewConfig] = useState();
26538
+ const [isInitialRender, setIsInitialRender] = useState(true);
26538
26539
  const [size, setSize] = useState({ width: 200, height: 200 });
26539
26540
  const wrapperSize = useRef();
26540
26541
  const wrapperParentSize = useRef();
@@ -26563,51 +26564,55 @@ const GoslingComponent = forwardRef((props, ref) => {
26563
26564
  },
26564
26565
  [viewConfig, theme]
26565
26566
  );
26566
- const compile$1 = useCallback(() => {
26567
- if (props.spec) {
26568
- const valid = validateGoslingSpec(props.spec);
26569
- if (valid.state === "error") {
26570
- console.warn("Gosling spec is not valid. Please refer to the console message.");
26571
- return;
26567
+ const compile$1 = useCallback(
26568
+ (altSpec) => {
26569
+ const spec = altSpec != null ? altSpec : props.spec;
26570
+ if (spec) {
26571
+ const valid = validateGoslingSpec(spec);
26572
+ if (valid.state === "error") {
26573
+ console.warn("Gosling spec is not valid. Please refer to the console message.");
26574
+ return;
26575
+ }
26576
+ compile(
26577
+ spec,
26578
+ (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => {
26579
+ var _a2, _b2;
26580
+ if (prevSpec.current && isEqual(omitDeep(prevSpec.current, ["linkingId"]), omitDeep(newGoslingSpec, ["linkingId"]))) {
26581
+ return;
26582
+ }
26583
+ (_a2 = props.compiled) == null ? void 0 : _a2.call(props, spec, newHiGlassSpec, { _processedSpec: newGoslingSpec });
26584
+ setSize(newSize);
26585
+ const isMountedOnce = typeof viewConfig !== "undefined";
26586
+ if (((_b2 = props.experimental) == null ? void 0 : _b2.reactive) && isMountedOnce) {
26587
+ setTimeout(() => {
26588
+ var _a3, _b3;
26589
+ preverseZoomStatus(
26590
+ newHiGlassSpec,
26591
+ (_a3 = hgRef.current) == null ? void 0 : _a3.api.getViewConfig()
26592
+ );
26593
+ (_b3 = hgRef.current) == null ? void 0 : _b3.api.setViewConfig(newHiGlassSpec);
26594
+ }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER);
26595
+ } else {
26596
+ setViewConfig(newHiGlassSpec);
26597
+ }
26598
+ publishOnNewView(newTracksAndViews);
26599
+ prevSpec.current = newGoslingSpec;
26600
+ tracksAndViews.current = newTracksAndViews;
26601
+ idTable.current = newIdTable;
26602
+ },
26603
+ [...GoslingTemplates],
26604
+ // TODO: allow user definitions
26605
+ theme,
26606
+ {
26607
+ containerSize: wrapperSize.current,
26608
+ containerParentSize: wrapperParentSize.current
26609
+ },
26610
+ props.urlToFetchOptions
26611
+ );
26572
26612
  }
26573
- compile(
26574
- props.spec,
26575
- (newHiGlassSpec, newSize, newGoslingSpec, newTracksAndViews, newIdTable) => {
26576
- var _a2, _b2;
26577
- if (prevSpec.current && isEqual(omitDeep(prevSpec.current, ["linkingId"]), omitDeep(newGoslingSpec, ["linkingId"]))) {
26578
- return;
26579
- }
26580
- (_a2 = props.compiled) == null ? void 0 : _a2.call(props, props.spec, newHiGlassSpec, { _processedSpec: newGoslingSpec });
26581
- setSize(newSize);
26582
- const isMountedOnce = typeof viewConfig !== "undefined";
26583
- if (((_b2 = props.experimental) == null ? void 0 : _b2.reactive) && isMountedOnce) {
26584
- setTimeout(() => {
26585
- var _a3, _b3;
26586
- preverseZoomStatus(
26587
- newHiGlassSpec,
26588
- (_a3 = hgRef.current) == null ? void 0 : _a3.api.getViewConfig()
26589
- );
26590
- (_b3 = hgRef.current) == null ? void 0 : _b3.api.setViewConfig(newHiGlassSpec);
26591
- }, DELAY_FOR_CONTAINER_RESIZE_BEFORE_RERENDER);
26592
- } else {
26593
- setViewConfig(newHiGlassSpec);
26594
- }
26595
- publishOnNewView(newTracksAndViews);
26596
- prevSpec.current = newGoslingSpec;
26597
- tracksAndViews.current = newTracksAndViews;
26598
- idTable.current = newIdTable;
26599
- },
26600
- [...GoslingTemplates],
26601
- // TODO: allow user definitions
26602
- theme,
26603
- {
26604
- containerSize: wrapperSize.current,
26605
- containerParentSize: wrapperParentSize.current
26606
- },
26607
- props.urlToFetchOptions
26608
- );
26609
- }
26610
- }, [props.spec, theme]);
26613
+ },
26614
+ [props.spec, theme]
26615
+ );
26611
26616
  useEffect(() => {
26612
26617
  var _a2;
26613
26618
  if (!((_a2 = props.spec) == null ? void 0 : _a2.responsiveSize))
@@ -26636,8 +26641,16 @@ const GoslingComponent = forwardRef((props, ref) => {
26636
26641
  };
26637
26642
  });
26638
26643
  useEffect(() => {
26639
- compile$1();
26640
- }, [props.spec, theme]);
26644
+ if (isInitialRender) {
26645
+ compile$1({
26646
+ title: " ",
26647
+ tracks: [{}]
26648
+ });
26649
+ setIsInitialRender(false);
26650
+ } else {
26651
+ compile$1();
26652
+ }
26653
+ }, [props.spec, theme, isInitialRender]);
26641
26654
  const responsiveHeight = typeof ((_b = props.spec) == null ? void 0 : _b.responsiveSize) !== "object" ? (_c = props.spec) == null ? void 0 : _c.responsiveSize : props.spec.responsiveSize.height;
26642
26655
  const higlassComponent = useMemo(
26643
26656
  () => {