Skip to content

Commit

Permalink
fix: Change core type export to index-types.ts pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
rpechuk committed Feb 12, 2025
1 parent f423519 commit 7ea04f0
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 61 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"module": "src/index.js",
"jsdelivr": "dist/mosaic-core.min.js",
"unpkg": "dist/mosaic-core.min.js",
"types": "dist/types/index.d.ts",
"types": "dist/types/index-types.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/uwdata/mosaic.git"
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './index.js';
export * from './types.js';
15 changes: 0 additions & 15 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,3 @@ export { toDataColumns } from './util/to-data-columns.js';
export { queryFieldInfo } from './util/field-info.js';
export { jsType } from './util/js-type.js';
export { isActivatable } from './util/is-activatable.js';

/**
* @typedef {import('./util/selection-types.js').ClauseMetadata} ClauseMetadata
* @typedef {import('./util/selection-types.js').PointMetadata} PointMetadata
* @typedef {import('./util/selection-types.js').MatchMethod} MatchMethod
* @typedef {import('./util/selection-types.js').MatchMetadata} MatchMetadata
* @typedef {import('./util/selection-types.js').ScaleType} ScaleType
* @typedef {import('./util/selection-types.js').Extent} Extent
* @typedef {import('./util/selection-types.js').Scale} Scale
* @typedef {import('./util/selection-types.js').BinMethod} BinMethod
* @typedef {import('./util/selection-types.js').IntervalMetadata} IntervalMetadata
* @typedef {import('./util/selection-types.js').SelectionClause} SelectionClause
*
* @typedef {import('./Activatable.js').Activatable} Activatable
*/
5 changes: 4 additions & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { DescribeQuery, ExprNode, Query } from '@uwdata/mosaic-sql';

export * from './util/selection-types.js';
export * from './Activatable.js';

/** Query type accepted by a coordinator. */
export type QueryType =
| string
Expand Down Expand Up @@ -51,4 +54,4 @@ export interface ColumnDescription {
column_name: string,
column_type: string,
null: 'YES' | 'NO'
}
}
5 changes: 1 addition & 4 deletions packages/inputs/src/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { MosaicClient, Param, isParam, isSelection, clausePoint } from '@uwdata/
import { Query } from '@uwdata/mosaic-sql';
import { input } from './input.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

const isObject = v => {
return v && typeof v === 'object' && !Array.isArray(v);
};
Expand All @@ -15,6 +11,7 @@ export const menu = options => input(Menu, options);
/**
* A HTML select based dropdown menu input.
*
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Menu extends MosaicClient {
Expand Down
5 changes: 1 addition & 4 deletions packages/inputs/src/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import { MosaicClient, Param, isParam, isSelection, clauseMatch } from '@uwdata/
import { Query } from '@uwdata/mosaic-sql';
import { input } from './input.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

let _id = 0;

export const search = options => input(Search, options);

/**
* A HTML input based text search input.
*
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Search extends MosaicClient {
Expand Down
5 changes: 1 addition & 4 deletions packages/inputs/src/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import { MosaicClient, Param, clauseInterval, clausePoint, isParam, isSelection
import { Query, max, min } from '@uwdata/mosaic-sql';
import { input } from './input.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

let _id = 0;

export const slider = options => input(Slider, options);

/**
* A HTML range based slider input.
*
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Slider extends MosaicClient {
Expand Down
5 changes: 1 addition & 4 deletions packages/inputs/src/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { Query, desc } from '@uwdata/mosaic-sql';
import { formatDate, formatLocaleAuto, formatLocaleNumber } from './util/format.js';
import { input } from './input.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

let _id = -1;

export const table = options => input(Table, options);
Expand All @@ -15,6 +11,7 @@ export const table = options => input(Table, options);
/**
* A HTML table based table component.
*
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Table extends MosaicClient {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { and, isAggregateExpression } from '@uwdata/mosaic-sql';
import { getDatum } from './util/get-datum.js';
import { sanitizeStyles } from './util/sanitize-styles.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

function configureMark(mark) {
const { channels } = mark;
const dims = new Set;
Expand Down Expand Up @@ -39,6 +35,7 @@ function configureMark(mark) {
}

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Highlight {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Interval1D.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { invert } from './util/invert.js';
import { sanitizeStyles } from './util/sanitize-styles.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Interval1D {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Interval2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { invert } from './util/invert.js';
import { sanitizeStyles } from './util/sanitize-styles.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Interval2D {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Nearest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { select, pointer, min } from 'd3';
import { getField } from './util/get-field.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Nearest {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/PanZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ import { Selection, clauseInterval } from '@uwdata/mosaic-core';
import { select, zoom, ZoomTransform } from 'd3';
import { getField } from './util/get-field.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

const asc = (a, b) => a - b;

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class PanZoom {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Region.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import { neqSome } from './util/neq.js';
import { getDatum } from './util/get-datum.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Region {
Expand Down
5 changes: 1 addition & 4 deletions packages/plot/src/interactors/Toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { getDatum } from './util/get-datum.js';
import { neq, neqSome } from './util/neq.js';

/**
* @typedef {import('@uwdata/mosaic-core').Activatable} Activatable
*/

/**
* @import {Activatable} from '@uwdata/mosaic-core'
* @implements {Activatable}
*/
export class Toggle {
Expand Down

0 comments on commit 7ea04f0

Please sign in to comment.