@milaboratories/uikit 2.2.44 → 2.2.46

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 (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/pl-uikit.js +7708 -5293
  3. package/dist/pl-uikit.umd.cjs +12 -8
  4. package/dist/src/components/PlChartHistogram/PlChartHistogram.vue.d.ts +6 -0
  5. package/dist/src/components/PlChartHistogram/createGridlines.d.ts +3 -0
  6. package/dist/src/components/PlChartHistogram/createLabels.d.ts +3 -0
  7. package/dist/src/components/PlChartHistogram/createSvgContainer.d.ts +3 -0
  8. package/dist/src/components/PlChartHistogram/drawBins.d.ts +2 -0
  9. package/dist/src/components/PlChartHistogram/drawThreshold.d.ts +2 -0
  10. package/dist/src/components/PlChartHistogram/histogram.d.ts +4 -0
  11. package/dist/src/components/PlChartHistogram/index.d.ts +1 -0
  12. package/dist/src/components/PlChartHistogram/logspace.d.ts +1 -0
  13. package/dist/src/components/PlChartHistogram/normalizeBins.d.ts +2 -0
  14. package/dist/src/components/PlChartHistogram/scales.spec.d.ts +1 -0
  15. package/dist/src/components/PlChartHistogram/types.d.ts +58 -0
  16. package/dist/src/composition/useComponentProp.d.ts +33 -0
  17. package/dist/src/index.d.ts +2 -0
  18. package/dist/src/types.d.ts +2 -1
  19. package/dist/style.css +1 -1
  20. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  21. package/package.json +7 -5
  22. package/src/colors/__tests__/colors.spec.ts +0 -2
  23. package/src/components/PlChartHistogram/PlChartHistogram.vue +90 -0
  24. package/src/components/PlChartHistogram/createGridlines.ts +42 -0
  25. package/src/components/PlChartHistogram/createLabels.ts +32 -0
  26. package/src/components/PlChartHistogram/createSvgContainer.ts +23 -0
  27. package/src/components/PlChartHistogram/drawBins.ts +55 -0
  28. package/src/components/PlChartHistogram/drawThreshold.ts +19 -0
  29. package/src/components/PlChartHistogram/histogram.ts +136 -0
  30. package/src/components/PlChartHistogram/index.ts +1 -0
  31. package/src/components/PlChartHistogram/logspace.ts +13 -0
  32. package/src/components/PlChartHistogram/normalizeBins.ts +19 -0
  33. package/src/components/PlChartHistogram/scales.spec.ts +10 -0
  34. package/src/components/PlChartHistogram/types.ts +66 -0
  35. package/src/components/PlDropdownMulti/PlDropdownMulti.vue +0 -2
  36. package/src/components/PlDropdownMultiRef/__tests__/PlDropdownMultiRef.spec.ts +1 -3
  37. package/src/components/PlEditableTitle/pl-editable-title.module.scss +1 -1
  38. package/src/components/PlProgressCell/PlProgressCell.vue +0 -2
  39. package/src/composition/useComponentProp.ts +36 -0
  40. package/src/helpers/index.ts +1 -1
  41. package/src/index.ts +2 -0
  42. package/src/types.ts +3 -1
@@ -0,0 +1,6 @@
1
+ import type { PlChartHistogramSettings } from './types';
2
+ type __VLS_Props = {
3
+ settings: PlChartHistogramSettings;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import * as d3 from 'd3';
2
+ import type { ChartOptions, Scales } from './types';
3
+ export declare function createGridlines(svg: d3.Selection<SVGGElement, unknown, null, undefined>, options: ChartOptions, scales: Scales, xTicks: (d: d3.Axis<d3.NumberValue>) => d3.Axis<d3.NumberValue>): void;
@@ -0,0 +1,3 @@
1
+ import type * as d3 from 'd3';
2
+ import type { ChartOptions } from './types';
3
+ export declare function createLabels(svg: d3.Selection<SVGGElement, unknown, null, undefined>, options: ChartOptions): void;
@@ -0,0 +1,3 @@
1
+ import * as d3 from 'd3';
2
+ import type { ChartOptions } from './types';
3
+ export declare function createSvgContainer(el: HTMLElement, options: ChartOptions): d3.Selection<SVGGElement, unknown, null, undefined>;
@@ -0,0 +1,2 @@
1
+ import type { BinLike, ChartOptions, Scales, SVG } from './types';
2
+ export declare function drawBins(svg: SVG, bins: BinLike[], dimension: ChartOptions, scales: Scales): void;
@@ -0,0 +1,2 @@
1
+ import type { ChartOptions, Scales, SVG } from './types';
2
+ export declare function drawThreshold(svg: SVG, scales: Scales, options: ChartOptions): void;
@@ -0,0 +1,4 @@
1
+ import type { AnyBin, ChartOptions } from './types';
2
+ export declare function createHistogramLinear(el: HTMLElement, options: ChartOptions, data: number[]): void;
3
+ export declare function createHistogramLog(el: HTMLElement, options: ChartOptions, data: number[]): void;
4
+ export declare function createHistogramFromBins(el: HTMLElement, options: ChartOptions, _bins: AnyBin[]): void;
@@ -0,0 +1 @@
1
+ export { default as PlChartHistogram } from './PlChartHistogram.vue';
@@ -0,0 +1 @@
1
+ export declare function logspace(startExp: number, stopExp: number, num?: number, base?: number): number[];
@@ -0,0 +1,2 @@
1
+ import type { AnyBin, BinLike } from './types';
2
+ export declare function normalizeBins(bins: (d3.Bin<number, number> | AnyBin)[]): BinLike[];
@@ -0,0 +1,58 @@
1
+ export type Margin = {
2
+ top: number;
3
+ right: number;
4
+ bottom: number;
5
+ left: number;
6
+ };
7
+ export type ChartOptions = {
8
+ width: number;
9
+ height: number;
10
+ margin: Margin;
11
+ nBins?: number;
12
+ yAxisLabel?: string;
13
+ xAxisLabel?: string;
14
+ threshold?: number;
15
+ compact?: boolean;
16
+ };
17
+ export type Scales = {
18
+ x: d3.ScaleSymLog<number, number, never> | d3.ScaleLinear<number, number>;
19
+ y: d3.ScaleLinear<number, number, never>;
20
+ };
21
+ export type SVG = d3.Selection<SVGGElement, unknown, null, undefined>;
22
+ export type CustomBin = {
23
+ from: number;
24
+ to: number;
25
+ weight: number;
26
+ };
27
+ export type BinLike = {
28
+ x0: number;
29
+ x1: number;
30
+ length: number;
31
+ };
32
+ export type AnyBin = CustomBin | BinLike;
33
+ /**
34
+ * Common case: array of numbers
35
+ */
36
+ export type PlChartHistogramBasicSettings = {
37
+ type: 'basic';
38
+ threshold?: number;
39
+ numbers: number[];
40
+ log?: boolean;
41
+ nBins?: number;
42
+ };
43
+ /**
44
+ * For precalculated bins on log x scale
45
+ */
46
+ export type PlChartHistogramLogBinsSettings = {
47
+ type: 'log-bins';
48
+ threshold?: number;
49
+ bins: AnyBin[];
50
+ };
51
+ export type PlChartHistogramSettings = (PlChartHistogramBasicSettings | PlChartHistogramLogBinsSettings) & {
52
+ title?: string;
53
+ yAxisLabel?: string;
54
+ xAxisLabel?: string;
55
+ totalWidth?: number;
56
+ totalHeight?: number;
57
+ compact?: boolean;
58
+ };
@@ -0,0 +1,33 @@
1
+ import type { InferComponentProps } from '../types';
2
+ import { type Component, type ComputedRef } from 'vue';
3
+ /**
4
+ * A utility function that creates a reactive computed property
5
+ * based on a specific prop of a Vue component.
6
+ *
7
+ *
8
+ * @template C - The Vue component type.
9
+ * @template P - The prop name.
10
+ *
11
+ * @param cb - A factory function that returns the value of the prop from the inferred component props.
12
+ *
13
+ * @returns A `ComputedRef` of the specified prop
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { ref, defineComponent } from 'vue';
18
+ * import { useComponentProp } from '@platforma-sdk/ui-vue';
19
+ *
20
+ * const MyComponent = defineComponent({
21
+ * props: {
22
+ * myProp: {
23
+ * type: String,
24
+ * required: true
25
+ * }
26
+ * }
27
+ * });
28
+ *
29
+ * const propValue = useComponentProp<typeof MyComponent, 'myProp'>(() => 'example');
30
+ * console.log(propValue.value); // Outputs: 'example'
31
+ * ```
32
+ */
33
+ export declare function useComponentProp<C extends Component, P extends keyof InferComponentProps<C>>(cb: () => InferComponentProps<C>[P]): ComputedRef<InferComponentProps<C>[P]>;
@@ -55,6 +55,7 @@ export * from './components/PlMaskIcon24';
55
55
  export * from './components/PlIcon16';
56
56
  export * from './components/PlIcon24';
57
57
  export * from './components/PlChartStackedBar';
58
+ export * from './components/PlChartHistogram';
58
59
  export * from './colors';
59
60
  import DropdownListItem from './components/DropdownListItem.vue';
60
61
  import ContextProvider from './components/ContextProvider.vue';
@@ -79,6 +80,7 @@ export { useInterval } from './composition/useInterval';
79
80
  export { useFormState } from './composition/useFormState';
80
81
  export { useQuery } from './composition/useQuery.ts';
81
82
  export { useDraggable } from './composition/useDraggable';
83
+ export { useComponentProp } from './composition/useComponentProp';
82
84
  /**
83
85
  * Utils/Partials
84
86
  */
@@ -1,5 +1,5 @@
1
1
  import type { ImportFileHandle, Platforma, StorageHandle, PlRef as ModelRef } from '@platforma-sdk/model';
2
- import type { Ref, ComputedRef } from 'vue';
2
+ import type { Ref, ComputedRef, Component } from 'vue';
3
3
  import { maskIcons16 } from './generated/icons-16';
4
4
  import { maskIcons24 } from './generated/icons-24';
5
5
  export type Size = 'small' | 'medium' | 'large';
@@ -56,6 +56,7 @@ export type ImportedFiles = {
56
56
  storageHandle?: StorageHandle;
57
57
  files: ImportFileHandle[];
58
58
  };
59
+ export type InferComponentProps<C extends Component> = C extends Component<infer P> ? P : never;
59
60
  declare global {
60
61
  const platforma: Platforma | undefined;
61
62
  interface Window {