@cratis/components 0.1.16 → 0.1.18
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/cjs/PivotViewer/PivotViewer.css +70 -21
- package/dist/cjs/PivotViewer/PivotViewer.js +15 -5
- package/dist/cjs/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/cjs/PivotViewer/components/AxisLabels.js +5 -8
- package/dist/cjs/PivotViewer/components/AxisLabels.js.map +1 -1
- package/dist/cjs/PivotViewer/components/DetailPanel.js +9 -2
- package/dist/cjs/PivotViewer/components/DetailPanel.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotCanvas.js +62 -55
- package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js +16 -5
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/cjs/PivotViewer/components/Toolbar.js +34 -2
- package/dist/cjs/PivotViewer/components/Toolbar.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/animation.js +4 -3
- package/dist/cjs/PivotViewer/components/pivot/animation.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/constants.js +5 -5
- package/dist/cjs/PivotViewer/components/pivot/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/groups.js +151 -0
- package/dist/cjs/PivotViewer/components/pivot/groups.js.map +1 -0
- package/dist/cjs/PivotViewer/components/pivot/sprites.js +11 -42
- package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/visibility.js +57 -26
- package/dist/cjs/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/cjs/PivotViewer/constants.js +0 -2
- package/dist/cjs/PivotViewer/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/engine/layout.js +11 -7
- package/dist/cjs/PivotViewer/engine/layout.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useCardSelection.js +2 -1
- package/dist/cjs/PivotViewer/hooks/useCardSelection.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/usePanning.js +8 -4
- package/dist/cjs/PivotViewer/hooks/usePanning.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
- package/dist/cjs/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
- package/dist/cjs/PivotViewer/hooks/useZoomState.js +4 -0
- package/dist/cjs/PivotViewer/hooks/useZoomState.js.map +1 -1
- package/dist/cjs/PivotViewer/types.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/animations.js +11 -3
- package/dist/cjs/PivotViewer/utils/animations.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/cardPosition.js +0 -3
- package/dist/cjs/PivotViewer/utils/cardPosition.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/constants.js +3 -3
- package/dist/cjs/PivotViewer/utils/constants.js.map +1 -1
- package/dist/cjs/PivotViewer/utils/selection.js +8 -1
- package/dist/cjs/PivotViewer/utils/selection.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.css +70 -21
- package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.js +16 -6
- package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts +0 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.stories.js +10 -9
- package/dist/esm/PivotViewer/PivotViewer.stories.js.map +1 -1
- package/dist/esm/PivotViewer/components/AxisLabels.d.ts +2 -1
- package/dist/esm/PivotViewer/components/AxisLabels.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/AxisLabels.js +6 -9
- package/dist/esm/PivotViewer/components/AxisLabels.js.map +1 -1
- package/dist/esm/PivotViewer/components/DetailPanel.d.ts +3 -1
- package/dist/esm/PivotViewer/components/DetailPanel.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/DetailPanel.js +10 -3
- package/dist/esm/PivotViewer/components/DetailPanel.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +5 -2
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.js +63 -56
- package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts +5 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.js +16 -5
- package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/esm/PivotViewer/components/Toolbar.d.ts +3 -1
- package/dist/esm/PivotViewer/components/Toolbar.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/Toolbar.js +34 -2
- package/dist/esm/PivotViewer/components/Toolbar.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/animation.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/animation.js +4 -3
- package/dist/esm/PivotViewer/components/pivot/animation.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/constants.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/constants.js +5 -5
- package/dist/esm/PivotViewer/components/pivot/constants.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/groups.d.ts +6 -0
- package/dist/esm/PivotViewer/components/pivot/groups.d.ts.map +1 -0
- package/dist/esm/PivotViewer/components/pivot/groups.js +129 -0
- package/dist/esm/PivotViewer/components/pivot/groups.js.map +1 -0
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts +10 -2
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/sprites.js +12 -42
- package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.d.ts +4 -0
- package/dist/esm/PivotViewer/components/pivot/visibility.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/visibility.js +57 -26
- package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
- package/dist/esm/PivotViewer/constants.js +1 -2
- package/dist/esm/PivotViewer/constants.js.map +1 -1
- package/dist/esm/PivotViewer/engine/layout.js +11 -7
- package/dist/esm/PivotViewer/engine/layout.js.map +1 -1
- package/dist/esm/PivotViewer/engine/types.d.ts +1 -0
- package/dist/esm/PivotViewer/engine/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.js +2 -1
- package/dist/esm/PivotViewer/hooks/useCardSelection.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useCurrentFilters.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.d.ts +1 -1
- package/dist/esm/PivotViewer/hooks/useFilteredData.js +4 -4
- package/dist/esm/PivotViewer/hooks/useFilteredData.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePanning.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/usePanning.js +8 -4
- package/dist/esm/PivotViewer/hooks/usePanning.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js +4 -3
- package/dist/esm/PivotViewer/hooks/useViewModeScrollHandling.js.map +1 -1
- package/dist/esm/PivotViewer/hooks/useZoomState.d.ts +1 -0
- package/dist/esm/PivotViewer/hooks/useZoomState.d.ts.map +1 -1
- package/dist/esm/PivotViewer/hooks/useZoomState.js +4 -0
- package/dist/esm/PivotViewer/hooks/useZoomState.js.map +1 -1
- package/dist/esm/PivotViewer/types.d.ts +5 -1
- package/dist/esm/PivotViewer/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/types.js.map +1 -1
- package/dist/esm/PivotViewer/utils/animations.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/animations.js +11 -3
- package/dist/esm/PivotViewer/utils/animations.js.map +1 -1
- package/dist/esm/PivotViewer/utils/cardPosition.js +1 -4
- package/dist/esm/PivotViewer/utils/cardPosition.js.map +1 -1
- package/dist/esm/PivotViewer/utils/constants.d.ts +5 -5
- package/dist/esm/PivotViewer/utils/constants.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/constants.js +3 -3
- package/dist/esm/PivotViewer/utils/constants.js.map +1 -1
- package/dist/esm/PivotViewer/utils/selection.d.ts.map +1 -1
- package/dist/esm/PivotViewer/utils/selection.js +8 -1
- package/dist/esm/PivotViewer/utils/selection.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/PivotViewer/components/pivot/buckets.js +0 -124
- package/dist/cjs/PivotViewer/components/pivot/buckets.js.map +0 -1
- package/dist/esm/PivotViewer/components/pivot/buckets.d.ts +0 -6
- package/dist/esm/PivotViewer/components/pivot/buckets.d.ts.map +0 -1
- package/dist/esm/PivotViewer/components/pivot/buckets.js +0 -102
- package/dist/esm/PivotViewer/components/pivot/buckets.js.map +0 -1
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
4
5
|
var utils = require('../utils/utils.js');
|
|
5
6
|
|
|
6
|
-
function Toolbar({ hasFilters, filtersOpen, filteredCount, viewMode, zoomLevel, activeDimensionKey, dimensions, activeFilterCount, onFiltersToggle, onViewModeChange, onZoomIn, onZoomOut, onZoomSlider, onDimensionChange, filterButtonRef, }) {
|
|
7
|
+
function Toolbar({ hasFilters, filtersOpen, filteredCount, viewMode, zoomLevel, activeDimensionKey, dimensions, activeFilterCount, onFiltersToggle, onViewModeChange, onZoomIn, onZoomOut, onZoomSlider, onZoomReset, onZoomChange, onDimensionChange, filterButtonRef, }) {
|
|
7
8
|
const labelText = 'Sort by';
|
|
8
|
-
|
|
9
|
+
const [isEditingZoom, setIsEditingZoom] = React.useState(false);
|
|
10
|
+
const [zoomInputValue, setZoomInputValue] = React.useState('');
|
|
11
|
+
const handleZoomClick = () => {
|
|
12
|
+
setIsEditingZoom(true);
|
|
13
|
+
setZoomInputValue(String(Math.round(zoomLevel * 100)));
|
|
14
|
+
};
|
|
15
|
+
const handleZoomInputChange = (e) => {
|
|
16
|
+
const value = e.target.value;
|
|
17
|
+
if (value === '' || /^\d+$/.test(value)) {
|
|
18
|
+
setZoomInputValue(value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const handleZoomInputKeyDown = (e) => {
|
|
22
|
+
if (e.key === 'Enter') {
|
|
23
|
+
applyZoomInput();
|
|
24
|
+
}
|
|
25
|
+
else if (e.key === 'Escape') {
|
|
26
|
+
setIsEditingZoom(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const handleZoomInputBlur = () => {
|
|
30
|
+
applyZoomInput();
|
|
31
|
+
};
|
|
32
|
+
const applyZoomInput = () => {
|
|
33
|
+
const numValue = parseInt(zoomInputValue, 10);
|
|
34
|
+
if (!isNaN(numValue)) {
|
|
35
|
+
const clampedValue = Math.max(10, Math.min(300, numValue));
|
|
36
|
+
onZoomChange(clampedValue / 100);
|
|
37
|
+
}
|
|
38
|
+
setIsEditingZoom(false);
|
|
39
|
+
};
|
|
40
|
+
return (jsxRuntime.jsxs("header", { className: "pv-toolbar", children: [jsxRuntime.jsxs("div", { className: "pv-toolbar-left", children: [hasFilters && (jsxRuntime.jsxs("button", { ref: filterButtonRef, type: "button", className: `pv-filter-icon-button ${filtersOpen ? 'active' : ''}`, onClick: onFiltersToggle, title: "Filters", children: [jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntime.jsx("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" }) }), activeFilterCount > 0 && (jsxRuntime.jsx("span", { className: "pv-filter-badge", children: activeFilterCount }))] })), jsxRuntime.jsx("h1", { children: "Pivot Viewer" }), jsxRuntime.jsxs("span", { className: "pv-count", children: [filteredCount, " events"] })] }), jsxRuntime.jsxs("div", { className: "pv-toolbar-right", children: [jsxRuntime.jsxs("div", { className: "pv-zoom-controls", children: [jsxRuntime.jsx("button", { type: "button", onClick: onZoomOut, disabled: zoomLevel <= utils.ZOOM_MIN, title: "Zoom out", children: "\u2212" }), jsxRuntime.jsx("input", { type: "range", className: "pv-zoom-slider", min: utils.ZOOM_MIN, max: utils.ZOOM_MAX, step: utils.ZOOM_STEP, value: zoomLevel, onChange: onZoomSlider, title: `Zoom: ${Math.round(zoomLevel * 100)}%` }), isEditingZoom ? (jsxRuntime.jsx("input", { type: "text", className: "pv-zoom-level-input", value: zoomInputValue, onChange: handleZoomInputChange, onKeyDown: handleZoomInputKeyDown, onBlur: handleZoomInputBlur, autoFocus: true })) : (jsxRuntime.jsxs("span", { className: "pv-zoom-level", onClick: handleZoomClick, title: "Click to edit zoom level", children: [Math.round(zoomLevel * 100), "%"] })), jsxRuntime.jsx("button", { type: "button", onClick: onZoomReset, title: "Reset zoom", className: "pv-zoom-reset", children: jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntime.jsx("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }), jsxRuntime.jsx("path", { d: "M21 3v5h-5" }), jsxRuntime.jsx("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }), jsxRuntime.jsx("path", { d: "M3 21v-5h5" })] }) }), jsxRuntime.jsx("button", { type: "button", onClick: onZoomIn, disabled: zoomLevel >= utils.ZOOM_MAX, title: "Zoom in", children: "+" })] }), jsxRuntime.jsxs("div", { className: "pv-view-toggle", children: [jsxRuntime.jsx("button", { type: "button", className: viewMode === 'collection' ? 'active' : '', onClick: () => onViewModeChange('collection'), children: "Collection" }), jsxRuntime.jsx("button", { type: "button", className: viewMode === 'grouped' ? 'active' : '', onClick: () => onViewModeChange('grouped'), children: "Grouped" })] }), jsxRuntime.jsxs("label", { className: "pv-dimension-select", children: [jsxRuntime.jsx("span", { children: labelText }), jsxRuntime.jsx("select", { value: activeDimensionKey, onChange: (event) => onDimensionChange(event.target.value), children: dimensions.map((dimension) => (jsxRuntime.jsx("option", { value: dimension.key, children: dimension.label }, dimension.key))) })] })] })] }));
|
|
9
41
|
}
|
|
10
42
|
|
|
11
43
|
exports.Toolbar = Toolbar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sources":["../../../../PivotViewer/components/Toolbar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { PivotDimension } from '../types';\nimport { ZOOM_MIN, ZOOM_MAX, ZOOM_STEP } from '../utils/utils';\n\nexport type ViewMode = 'collection' | 'grouped';\n\nexport interface ToolbarProps<TItem extends object> {\n hasFilters: boolean;\n filtersOpen: boolean;\n filteredCount: number;\n viewMode: ViewMode;\n zoomLevel: number;\n activeDimensionKey: string;\n dimensions: PivotDimension<TItem>[];\n activeFilterCount: number;\n onFiltersToggle: () => void;\n onViewModeChange: (mode: ViewMode) => void;\n onZoomIn: () => void;\n onZoomOut: () => void;\n onZoomSlider: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onDimensionChange: (key: string) => void;\n filterButtonRef: React.RefObject<HTMLButtonElement | null>;\n}\n\nexport function Toolbar<TItem extends object>({\n hasFilters,\n filtersOpen,\n filteredCount,\n viewMode,\n zoomLevel,\n activeDimensionKey,\n dimensions,\n activeFilterCount,\n onFiltersToggle,\n onViewModeChange,\n onZoomIn,\n onZoomOut,\n onZoomSlider,\n onDimensionChange,\n filterButtonRef,\n}: ToolbarProps<TItem>) {\n const labelText = 'Sort by';\n\n return (\n <header className=\"pv-toolbar\">\n <div className=\"pv-toolbar-left\">\n {hasFilters && (\n <button\n ref={filterButtonRef}\n type=\"button\"\n className={`pv-filter-icon-button ${filtersOpen ? 'active' : ''}`}\n onClick={onFiltersToggle}\n title=\"Filters\"\n >\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n {activeFilterCount > 0 && (\n <span className=\"pv-filter-badge\">{activeFilterCount}</span>\n )}\n </button>\n )}\n <h1>Pivot Viewer</h1>\n <span className=\"pv-count\">{filteredCount} events</span>\n </div>\n <div className=\"pv-toolbar-right\">\n <div className=\"pv-zoom-controls\">\n <button\n type=\"button\"\n onClick={onZoomOut}\n disabled={zoomLevel <= ZOOM_MIN}\n title=\"Zoom out\"\n >\n −\n </button>\n <input\n type=\"range\"\n className=\"pv-zoom-slider\"\n min={ZOOM_MIN}\n max={ZOOM_MAX}\n step={ZOOM_STEP}\n value={zoomLevel}\n onChange={onZoomSlider}\n title={`Zoom: ${Math.round(zoomLevel * 100)}%`}\n />\n <span className=\"pv-zoom-level\">{Math.round(zoomLevel * 100)}%</span>\n <button\n type=\"button\"\n onClick={onZoomIn}\n disabled={zoomLevel >= ZOOM_MAX}\n title=\"Zoom in\"\n >\n +\n </button>\n </div>\n <div className=\"pv-view-toggle\">\n <button\n type=\"button\"\n className={viewMode === 'collection' ? 'active' : ''}\n onClick={() => onViewModeChange('collection')}\n >\n Collection\n </button>\n <button\n type=\"button\"\n className={viewMode === 'grouped' ? 'active' : ''}\n onClick={() => onViewModeChange('grouped')}\n >\n Buckets\n </button>\n </div>\n <label className=\"pv-dimension-select\">\n <span>{labelText}</span>\n <select\n value={activeDimensionKey}\n onChange={(event) => onDimensionChange(event.target.value)}\n >\n {dimensions.map((dimension) => (\n <option key={dimension.key} value={dimension.key}>\n {dimension.label}\n </option>\n ))}\n </select>\n </label>\n </div>\n </header>\n );\n}\n"],"names":["_jsxs","_jsx","ZOOM_MIN","ZOOM_MAX","ZOOM_STEP"],"mappings":";;;;;AA0BM,SAAU,OAAO,CAAuB,EAC5C,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,eAAe,GACK,EAAA;IACpB,MAAM,SAAS,GAAG,SAAS;AAE3B,IAAA,QACEA,eAAA,CAAA,QAAA,EAAA,EAAQ,SAAS,EAAC,YAAY,EAAA,QAAA,EAAA,CAC5BA,yBAAK,SAAS,EAAC,iBAAiB,EAAA,QAAA,EAAA,CAC7B,UAAU,KACTA,4BACE,GAAG,EAAE,eAAe,EACpB,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,yBAAyB,WAAW,GAAG,QAAQ,GAAG,EAAE,CAAA,CAAE,EACjE,OAAO,EAAE,eAAe,EACxB,KAAK,EAAC,SAAS,aAEfC,cAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,YAC5IA,cAAA,CAAA,SAAA,EAAA,EAAS,MAAM,EAAC,6CAA6C,EAAA,CAAG,GAC5D,EACL,iBAAiB,GAAG,CAAC,KACpBA,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,iBAAiB,YAAE,iBAAiB,EAAA,CAAQ,CAC7D,CAAA,EAAA,CACM,CACV,EACDA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SAAS,EAAE,QAAQ,KAAK,YAAY,GAAG,QAAQ,GAAG,EAAE,EACpD,OAAO,EAAE,MAAM,gBAAgB,CAAC,YAAY,CAAC,EAAA,QAAA,EAAA,YAAA,EAAA,CAGtC,EACTA,2BACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,QAAQ,KAAK,SAAS,GAAG,QAAQ,GAAG,EAAE,EACjD,OAAO,EAAE,MAAM,gBAAgB,CAAC,SAAS,CAAC,EAAA,QAAA,EAAA,SAAA,EAAA,CAGnC,CAAA,EAAA,CACL,EACND,eAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,qBAAqB,EAAA,QAAA,EAAA,CACpCC,mCAAO,SAAS,EAAA,CAAQ,EACxBA,cAAA,CAAA,QAAA,EAAA,EACE,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,CAAC,KAAK,KAAK,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAA,QAAA,EAEzD,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,MACxBA,cAAA,CAAA,QAAA,EAAA,EAA4B,KAAK,EAAE,SAAS,CAAC,GAAG,YAC7C,SAAS,CAAC,KAAK,EAAA,EADL,SAAS,CAAC,GAAG,CAEjB,CACV,CAAC,EAAA,CACK,IACH,CAAA,EAAA,CACJ,CAAA,EAAA,CACC;AAEb;;;;"}
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sources":["../../../../PivotViewer/components/Toolbar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState } from 'react';\nimport type { PivotDimension } from '../types';\nimport { ZOOM_MIN, ZOOM_MAX, ZOOM_STEP } from '../utils/utils';\n\nexport type ViewMode = 'collection' | 'grouped';\n\nexport interface ToolbarProps<TItem extends object> {\n hasFilters: boolean;\n filtersOpen: boolean;\n filteredCount: number;\n viewMode: ViewMode;\n zoomLevel: number;\n activeDimensionKey: string;\n dimensions: PivotDimension<TItem>[];\n activeFilterCount: number;\n onFiltersToggle: () => void;\n onViewModeChange: (mode: ViewMode) => void;\n onZoomIn: () => void;\n onZoomOut: () => void;\n onZoomSlider: (e: React.ChangeEvent<HTMLInputElement>) => void;\n onZoomReset: () => void;\n onZoomChange: (zoom: number) => void;\n onDimensionChange: (key: string) => void;\n filterButtonRef: React.RefObject<HTMLButtonElement | null>;\n}\n\nexport function Toolbar<TItem extends object>({\n hasFilters,\n filtersOpen,\n filteredCount,\n viewMode,\n zoomLevel,\n activeDimensionKey,\n dimensions,\n activeFilterCount,\n onFiltersToggle,\n onViewModeChange,\n onZoomIn,\n onZoomOut,\n onZoomSlider,\n onZoomReset,\n onZoomChange,\n onDimensionChange,\n filterButtonRef,\n}: ToolbarProps<TItem>) {\n const labelText = 'Sort by';\n const [isEditingZoom, setIsEditingZoom] = useState(false);\n const [zoomInputValue, setZoomInputValue] = useState('');\n\n const handleZoomClick = () => {\n setIsEditingZoom(true);\n setZoomInputValue(String(Math.round(zoomLevel * 100)));\n };\n\n const handleZoomInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n if (value === '' || /^\\d+$/.test(value)) {\n setZoomInputValue(value);\n }\n };\n\n const handleZoomInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n applyZoomInput();\n } else if (e.key === 'Escape') {\n setIsEditingZoom(false);\n }\n };\n\n const handleZoomInputBlur = () => {\n applyZoomInput();\n };\n\n const applyZoomInput = () => {\n const numValue = parseInt(zoomInputValue, 10);\n if (!isNaN(numValue)) {\n const clampedValue = Math.max(10, Math.min(300, numValue));\n onZoomChange(clampedValue / 100);\n }\n setIsEditingZoom(false);\n };\n\n return (\n <header className=\"pv-toolbar\">\n <div className=\"pv-toolbar-left\">\n {hasFilters && (\n <button\n ref={filterButtonRef}\n type=\"button\"\n className={`pv-filter-icon-button ${filtersOpen ? 'active' : ''}`}\n onClick={onFiltersToggle}\n title=\"Filters\"\n >\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polygon points=\"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3\" />\n </svg>\n {activeFilterCount > 0 && (\n <span className=\"pv-filter-badge\">{activeFilterCount}</span>\n )}\n </button>\n )}\n <h1>Pivot Viewer</h1>\n <span className=\"pv-count\">{filteredCount} events</span>\n </div>\n <div className=\"pv-toolbar-right\">\n <div className=\"pv-zoom-controls\">\n <button\n type=\"button\"\n onClick={onZoomOut}\n disabled={zoomLevel <= ZOOM_MIN}\n title=\"Zoom out\"\n >\n −\n </button>\n <input\n type=\"range\"\n className=\"pv-zoom-slider\"\n min={ZOOM_MIN}\n max={ZOOM_MAX}\n step={ZOOM_STEP}\n value={zoomLevel}\n onChange={onZoomSlider}\n title={`Zoom: ${Math.round(zoomLevel * 100)}%`}\n />\n {isEditingZoom ? (\n <input\n type=\"text\"\n className=\"pv-zoom-level-input\"\n value={zoomInputValue}\n onChange={handleZoomInputChange}\n onKeyDown={handleZoomInputKeyDown}\n onBlur={handleZoomInputBlur}\n autoFocus\n />\n ) : (\n <span className=\"pv-zoom-level\" onClick={handleZoomClick} title=\"Click to edit zoom level\">\n {Math.round(zoomLevel * 100)}%\n </span>\n )}\n <button\n type=\"button\"\n onClick={onZoomReset}\n title=\"Reset zoom\"\n className=\"pv-zoom-reset\"\n >\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M3 21v-5h5\" />\n </svg>\n </button>\n <button\n type=\"button\"\n onClick={onZoomIn}\n disabled={zoomLevel >= ZOOM_MAX}\n title=\"Zoom in\"\n >\n +\n </button>\n </div>\n <div className=\"pv-view-toggle\">\n <button\n type=\"button\"\n className={viewMode === 'collection' ? 'active' : ''}\n onClick={() => onViewModeChange('collection')}\n >\n Collection\n </button>\n <button\n type=\"button\"\n className={viewMode === 'grouped' ? 'active' : ''}\n onClick={() => onViewModeChange('grouped')}\n >\n Grouped\n </button>\n </div>\n <label className=\"pv-dimension-select\">\n <span>{labelText}</span>\n <select\n value={activeDimensionKey}\n onChange={(event) => onDimensionChange(event.target.value)}\n >\n {dimensions.map((dimension) => (\n <option key={dimension.key} value={dimension.key}>\n {dimension.label}\n </option>\n ))}\n </select>\n </label>\n </div>\n </header>\n );\n}\n"],"names":["useState","_jsxs","_jsx","ZOOM_MIN","ZOOM_MAX","ZOOM_STEP"],"mappings":";;;;;;SA6BgB,OAAO,CAAuB,EAC5C,UAAU,EACV,WAAW,EACX,aAAa,EACb,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,GACK,EAAA;IACpB,MAAM,SAAS,GAAG,SAAS;IAC3B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;IACzD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAGA,cAAQ,CAAC,EAAE,CAAC;IAExD,MAAM,eAAe,GAAG,MAAK;QAC3B,gBAAgB,CAAC,IAAI,CAAC;AACtB,QAAA,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC;AACxD,IAAA,CAAC;AAED,IAAA,MAAM,qBAAqB,GAAG,CAAC,CAAsC,KAAI;AACvE,QAAA,MAAM,KAA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
isAnimatingRef.current = false;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
animate();
|
|
74
|
+
if (animationFrameRef.current) {
|
|
75
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
77
76
|
}
|
|
77
|
+
isAnimatingRef.current = true;
|
|
78
|
+
animate();
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
exports.startAnimationLoop = startAnimationLoop;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.js","sources":["../../../../../PivotViewer/components/pivot/animation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CardSprite } from './constants';\nimport type * as PIXI from 'pixi.js';\n\nexport function updatePositions(sprites: Map<unknown, CardSprite>, isViewTransitionRef: { current: boolean }, animationSpeed = 0.15) {\n let isAnimating = false;\n const threshold = 0.5;\n const shouldAnimate = isViewTransitionRef.current;\n const now = Date.now();\n const DURATION = 600; // ms\n\n for (const sprite of sprites.values()) {\n // Handle explicit time-based animation (view transitions)\n if (sprite.animationStartTime !== undefined) {\n const elapsed = now - sprite.animationStartTime;\n const delay = sprite.animationDelay || 0;\n\n if (elapsed < delay) {\n isAnimating = true;\n continue;\n }\n\n const progress = Math.min(1, (elapsed - delay) / DURATION);\n // Ease out cubic: 1 - (1-t)^3\n const t = 1 - Math.pow(1 - progress, 3);\n\n if (sprite.startX !== undefined && sprite.startY !== undefined) {\n sprite.currentX = sprite.startX + (sprite.targetX - sprite.startX) * t;\n sprite.currentY = sprite.startY + (sprite.targetY - sprite.startY) * t;\n }\n\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n\n if (progress < 1) {\n isAnimating = true;\n } else {\n // Animation finished, clean up\n sprite.currentX = sprite.targetX;\n sprite.currentY = sprite.targetY;\n delete sprite.animationStartTime;\n delete sprite.animationDelay;\n delete sprite.startX;\n delete sprite.startY;\n }\n continue;\n }\n\n const dx = sprite.targetX - sprite.currentX;\n const dy = sprite.targetY - sprite.currentY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (shouldAnimate && distance > threshold) {\n sprite.currentX += dx * animationSpeed;\n sprite.currentY += dy * animationSpeed;\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n isAnimating = true;\n } else if (distance > 0) {\n sprite.currentX = sprite.targetX;\n sprite.currentY = sprite.targetY;\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n }\n }\n\n if (!isAnimating && isViewTransitionRef.current) {\n isViewTransitionRef.current = false;\n }\n\n return isAnimating;\n}\n\nexport function startAnimationLoop(\n refs: {\n mountedRef: { current: boolean };\n appRef: { current: PIXI.Application | null };\n animationFrameRef: { current: number };\n isAnimatingRef: { current: boolean };\n needsRenderRef: { current: boolean };\n spritesRef: { current: Map<unknown, CardSprite> };\n isViewTransitionRef: { current: boolean };\n },\n animationSpeed = 0.15,\n) {\n const { mountedRef, appRef, animationFrameRef, isAnimatingRef, needsRenderRef, spritesRef, isViewTransitionRef } = refs;\n\n const animate = () => {\n if (!mountedRef.current) return;\n\n const stillAnimating = updatePositions(spritesRef.current, isViewTransitionRef, animationSpeed);\n\n if (stillAnimating || needsRenderRef.current) {\n appRef.current?.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n\n if (stillAnimating) {\n animationFrameRef.current = requestAnimationFrame(animate);\n } else {\n isAnimatingRef.current = false;\n }\n };\n\n if (
|
|
1
|
+
{"version":3,"file":"animation.js","sources":["../../../../../PivotViewer/components/pivot/animation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CardSprite } from './constants';\nimport type * as PIXI from 'pixi.js';\n\nexport function updatePositions(sprites: Map<unknown, CardSprite>, isViewTransitionRef: { current: boolean }, animationSpeed = 0.15) {\n let isAnimating = false;\n const threshold = 0.5;\n const shouldAnimate = isViewTransitionRef.current;\n const now = Date.now();\n const DURATION = 600; // ms\n\n for (const sprite of sprites.values()) {\n // Handle explicit time-based animation (view transitions)\n if (sprite.animationStartTime !== undefined) {\n const elapsed = now - sprite.animationStartTime;\n const delay = sprite.animationDelay || 0;\n\n if (elapsed < delay) {\n isAnimating = true;\n continue;\n }\n\n const progress = Math.min(1, (elapsed - delay) / DURATION);\n // Ease out cubic: 1 - (1-t)^3\n const t = 1 - Math.pow(1 - progress, 3);\n\n if (sprite.startX !== undefined && sprite.startY !== undefined) {\n sprite.currentX = sprite.startX + (sprite.targetX - sprite.startX) * t;\n sprite.currentY = sprite.startY + (sprite.targetY - sprite.startY) * t;\n }\n\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n\n if (progress < 1) {\n isAnimating = true;\n } else {\n // Animation finished, clean up\n sprite.currentX = sprite.targetX;\n sprite.currentY = sprite.targetY;\n delete sprite.animationStartTime;\n delete sprite.animationDelay;\n delete sprite.startX;\n delete sprite.startY;\n }\n continue;\n }\n\n const dx = sprite.targetX - sprite.currentX;\n const dy = sprite.targetY - sprite.currentY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (shouldAnimate && distance > threshold) {\n sprite.currentX += dx * animationSpeed;\n sprite.currentY += dy * animationSpeed;\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n isAnimating = true;\n } else if (distance > 0) {\n sprite.currentX = sprite.targetX;\n sprite.currentY = sprite.targetY;\n sprite.container.position.set(sprite.currentX, sprite.currentY);\n }\n }\n\n if (!isAnimating && isViewTransitionRef.current) {\n isViewTransitionRef.current = false;\n }\n\n return isAnimating;\n}\n\nexport function startAnimationLoop(\n refs: {\n mountedRef: { current: boolean };\n appRef: { current: PIXI.Application | null };\n animationFrameRef: { current: number };\n isAnimatingRef: { current: boolean };\n needsRenderRef: { current: boolean };\n spritesRef: { current: Map<unknown, CardSprite> };\n isViewTransitionRef: { current: boolean };\n },\n animationSpeed = 0.15,\n) {\n const { mountedRef, appRef, animationFrameRef, isAnimatingRef, needsRenderRef, spritesRef, isViewTransitionRef } = refs;\n\n const animate = () => {\n if (!mountedRef.current) return;\n\n const stillAnimating = updatePositions(spritesRef.current, isViewTransitionRef, animationSpeed);\n\n if (stillAnimating || needsRenderRef.current) {\n appRef.current?.renderer.render(appRef.current.stage);\n needsRenderRef.current = false;\n }\n\n if (stillAnimating) {\n animationFrameRef.current = requestAnimationFrame(animate);\n } else {\n isAnimatingRef.current = false;\n }\n };\n\n // Always restart animation when called to ensure animations continue\n // Cancel any existing animation frame and start fresh\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n isAnimatingRef.current = true;\n animate();\n}\n"],"names":[],"mappings":";;AAMM,SAAU,eAAe,CAAC,OAAiC,EAAE,mBAAyC,EAAE,cAAc,GAAG,IAAI,EAAA;IACjI,IAAI,WAAW,GAAG,KAAK;IACvB,MAAM,SAAS,GAAG,GAAG;AACrB,IAAA,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO;AACjD,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IACtB,MAAM,QAAQ,GAAG,GAAG;IAEpB,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE;AAErC,QAAA,IAAI,MAAM,CAAC,kBAAkB,KAAK,SAAS,EAAE;AAC3C,YAAA,MAAM,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC,kBAAkB;AAC/C,YAAA,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,IAAI,CAAC;AAExC,YAAA,IAAI,OAAO,GAAG,KAAK,EAAE;gBACnB,WAAW,GAAG,IAAI;gBAClB;YACF;AAEA,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC;AAE1D,YAAA,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC;AAEvC,YAAA,IAAI,MAAM,C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IAAA,IAAI,iBAAiB,CAAC,OAAO,EAAE;AAC7B,QAAA,oBAAoB,CAAC,iBAAiB,CAAC,OAAO,CAAC;IACjD;AACA,IAAA,cAAc,CAAC,OAAO,GAAG,IAAI;AAC7B,IAAA,OAAO,EAAE;AACX;;;;;"}
|
|
@@ -4,12 +4,12 @@ const CARD_PADDING = 10;
|
|
|
4
4
|
const CARD_RADIUS = 12;
|
|
5
5
|
const CARD_GAP = 8;
|
|
6
6
|
const DEFAULT_COLORS = {
|
|
7
|
-
base:
|
|
8
|
-
mid:
|
|
9
|
-
gradient:
|
|
10
|
-
border:
|
|
7
|
+
base: 0x0f2745,
|
|
8
|
+
mid: 0x163359,
|
|
9
|
+
gradient: 0x0b1e36,
|
|
10
|
+
border: 0x2e66ba,
|
|
11
11
|
text: 0xffffff,
|
|
12
|
-
textSecondary:
|
|
12
|
+
textSecondary: 0xa8b2c2,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
exports.CARD_GAP = CARD_GAP;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../PivotViewer/components/pivot/constants.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type * as PIXI from 'pixi.js';\n\nexport const ANIMATION_SPEED = 0.15;\nexport const CARD_PADDING = 10;\nexport const CARD_RADIUS = 12;\nexport const CARD_GAP = 8; // Gap between cards (must match layout gap)\n\nexport const DEFAULT_COLORS = {\n base:
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../PivotViewer/components/pivot/constants.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type * as PIXI from 'pixi.js';\n\nexport const ANIMATION_SPEED = 0.15;\nexport const CARD_PADDING = 10;\nexport const CARD_RADIUS = 12;\nexport const CARD_GAP = 8; // Gap between cards (must match layout gap)\n\n// Fallbacks tuned to PrimeReact lara-dark-blue aesthetic; actual values resolved from CSS variables\nexport const DEFAULT_COLORS = {\n base: 0x0f2745, // surface-b-ish deep blue\n mid: 0x163359, // surface-a-ish\n gradient: 0x0b1e36, // ground backdrop\n border: 0x2e66ba, // primary-500 for accents\n text: 0xffffff,\n textSecondary: 0xa8b2c2,\n};\n\nexport type CardColors = typeof DEFAULT_COLORS;\n\nexport interface CardSprite {\n container: PIXI.Container;\n graphics: PIXI.Graphics;\n titleText: PIXI.Text;\n labelsText: PIXI.Text;\n valuesText: PIXI.Text;\n itemId: number | string;\n targetX: number;\n targetY: number;\n currentX: number;\n currentY: number;\n // Animation state\n animationStartTime?: number;\n animationDelay?: number;\n startX?: number;\n startY?: number;\n // Cache state to avoid unnecessary redraws\n lastSelectedId?: string | number | null;\n lastCardColors?: CardColors;\n lastTitle?: string;\n lastLabels?: string;\n lastValues?: string;\n}\n\nexport default {};\n"],"names":[],"mappings":";;AAMO,MAAM,YAAY,GAAG;AACrB,MAAM,WAAW,GAAG;AACpB,MAAM,QAAQ,GAAG;AAGjB,MAAM,cAAc,GAAG;AAC5B,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,GAAG,EAAE,QAAQ;AACb,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,aAAa,EAAE,QAAQ;;;;;;;;"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var PIXI = require('pixi.js');
|
|
4
|
+
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
var n = Object.create(null);
|
|
7
|
+
if (e) {
|
|
8
|
+
Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default') {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var PIXI__namespace = /*#__PURE__*/_interopNamespaceDefault(PIXI);
|
|
23
|
+
|
|
24
|
+
function updateGroupBackgrounds(groupsContainer, container, grouping, layout, zoomLevel, cardColors, viewMode) {
|
|
25
|
+
if (!groupsContainer)
|
|
26
|
+
return;
|
|
27
|
+
if (!container || grouping.groups.length === 0 || viewMode === 'collection') {
|
|
28
|
+
for (const child of groupsContainer.children) {
|
|
29
|
+
if (child.name !== 'highlight') {
|
|
30
|
+
child.visible = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;
|
|
36
|
+
const containerWorldHeight = Math.max((container.scrollHeight || container.clientHeight) * invScale, container.clientHeight * invScale);
|
|
37
|
+
const baseWorldHeight = Math.max(layout.totalHeight || 0, containerWorldHeight);
|
|
38
|
+
const bufferWorld = Math.max(500, baseWorldHeight * 0.5, containerWorldHeight);
|
|
39
|
+
const worldHeight = baseWorldHeight + bufferWorld * 3;
|
|
40
|
+
const startY = -bufferWorld * 2;
|
|
41
|
+
const backgroundGraphics = groupsContainer.children.filter(c => c.name !== 'highlight');
|
|
42
|
+
let bgIndex = 0;
|
|
43
|
+
for (let index = 0; index < grouping.groups.length; index++) {
|
|
44
|
+
const group = grouping.groups[index];
|
|
45
|
+
let minX = Infinity;
|
|
46
|
+
let maxX = -Infinity;
|
|
47
|
+
for (let j = 0; j < group.ids.length; j++) {
|
|
48
|
+
const id = group.ids[j];
|
|
49
|
+
const pos = layout.positions.get(id);
|
|
50
|
+
if (pos) {
|
|
51
|
+
minX = Math.min(minX, pos.x);
|
|
52
|
+
maxX = Math.max(maxX, pos.x);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (minX === Infinity && (!layout.groupXs || layout.groupXs[index] === undefined))
|
|
56
|
+
continue;
|
|
57
|
+
const bucketWidths = layout.bucketWidths || [];
|
|
58
|
+
const groupXs = layout.groupXs || [];
|
|
59
|
+
const widthFromLayout = bucketWidths[index];
|
|
60
|
+
const xFromLayout = groupXs[index];
|
|
61
|
+
const width = widthFromLayout && widthFromLayout > 0 ? widthFromLayout : ((maxX - minX) || 0);
|
|
62
|
+
const x = xFromLayout !== undefined ? xFromLayout : minX;
|
|
63
|
+
if (index % 2 === 0 && width > 0) {
|
|
64
|
+
let bg;
|
|
65
|
+
if (bgIndex < backgroundGraphics.length) {
|
|
66
|
+
bg = backgroundGraphics[bgIndex];
|
|
67
|
+
bg.clear();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
bg = new PIXI__namespace.Graphics();
|
|
71
|
+
const highlightIndex = groupsContainer.children.findIndex(c => c.name === 'highlight');
|
|
72
|
+
if (highlightIndex >= 0) {
|
|
73
|
+
groupsContainer.addChildAt(bg, highlightIndex);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
groupsContainer.addChild(bg);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
bg.rect(x, startY, width, worldHeight);
|
|
80
|
+
bg.fill(cardColors.base);
|
|
81
|
+
bg.alpha = 0.15;
|
|
82
|
+
bg.visible = true;
|
|
83
|
+
bgIndex++;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (let i = bgIndex; i < backgroundGraphics.length; i++) {
|
|
87
|
+
backgroundGraphics[i].visible = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function updateHighlight(groupsContainer, container, grouping, layout, hoveredGroupIndex, cardWidth, zoomLevel) {
|
|
91
|
+
if (!groupsContainer || !container || grouping.groups.length === 0)
|
|
92
|
+
return;
|
|
93
|
+
const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;
|
|
94
|
+
let highlight = groupsContainer.children.find(child => child.name === 'highlight');
|
|
95
|
+
if (!highlight) {
|
|
96
|
+
highlight = new PIXI__namespace.Graphics();
|
|
97
|
+
highlight.name = 'highlight';
|
|
98
|
+
groupsContainer.addChild(highlight);
|
|
99
|
+
}
|
|
100
|
+
highlight.clear();
|
|
101
|
+
if (hoveredGroupIndex === null || hoveredGroupIndex < 0) {
|
|
102
|
+
highlight.visible = false;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const group = grouping.groups[hoveredGroupIndex];
|
|
106
|
+
if (!group || group.ids.length === 0) {
|
|
107
|
+
highlight.visible = false;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const bucketWidths = layout.bucketWidths || [];
|
|
111
|
+
const groupXs = layout.groupXs || [];
|
|
112
|
+
const widthFromLayout = bucketWidths[hoveredGroupIndex];
|
|
113
|
+
const xFromLayout = groupXs[hoveredGroupIndex];
|
|
114
|
+
let rectX = 0;
|
|
115
|
+
let rectWidth = 0;
|
|
116
|
+
if (widthFromLayout !== undefined && xFromLayout !== undefined) {
|
|
117
|
+
rectX = xFromLayout;
|
|
118
|
+
rectWidth = widthFromLayout;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
let minX = Infinity;
|
|
122
|
+
let maxX = -Infinity;
|
|
123
|
+
for (let j = 0; j < group.ids.length; j++) {
|
|
124
|
+
const id = group.ids[j];
|
|
125
|
+
const pos = layout.positions.get(id);
|
|
126
|
+
if (pos) {
|
|
127
|
+
minX = Math.min(minX, pos.x);
|
|
128
|
+
maxX = Math.max(maxX, pos.x + cardWidth);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (minX === Infinity) {
|
|
132
|
+
highlight.visible = false;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
rectX = minX;
|
|
136
|
+
rectWidth = maxX - minX;
|
|
137
|
+
}
|
|
138
|
+
const containerWorldHeight = Math.max((container.scrollHeight || container.clientHeight) * invScale, container.clientHeight * invScale);
|
|
139
|
+
const baseWorldHeight = Math.max(layout.totalHeight || 0, containerWorldHeight);
|
|
140
|
+
const bufferWorld = Math.max(200, baseWorldHeight * 0.25);
|
|
141
|
+
const worldHeight = baseWorldHeight + bufferWorld * 2;
|
|
142
|
+
const startY = -bufferWorld;
|
|
143
|
+
highlight.rect(rectX, startY, rectWidth, worldHeight);
|
|
144
|
+
highlight.fill(0xffffff);
|
|
145
|
+
highlight.alpha = 0.05;
|
|
146
|
+
highlight.visible = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
exports.updateGroupBackgrounds = updateGroupBackgrounds;
|
|
150
|
+
exports.updateHighlight = updateHighlight;
|
|
151
|
+
//# sourceMappingURL=groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.js","sources":["../../../../../PivotViewer/components/pivot/groups.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport * as PIXI from 'pixi.js';\nimport type { CardColors } from './constants';\nimport type { GroupingResult, LayoutResult } from '../../engine/types';\n\nexport function updateGroupBackgrounds(\n groupsContainer: PIXI.Container | null,\n container: HTMLDivElement | null,\n grouping: GroupingResult,\n layout: LayoutResult,\n zoomLevel: number,\n cardColors: CardColors,\n viewMode: string,\n) {\n if (!groupsContainer) return;\n\n // keep parameter referenced to avoid unused param lint when callers pass zoomLevel\n void zoomLevel;\n\n if (!container || grouping.groups.length === 0 || viewMode === 'collection') {\n // If we shouldn't show anything, hide all existing backgrounds\n // We keep the highlight if it exists\n for (const child of groupsContainer.children) {\n if ((child as unknown as { name?: string }).name !== 'highlight') {\n child.visible = false;\n }\n }\n return;\n }\n\n // Derive a world-space height that always covers the visible viewport even when zoomed out.\n const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;\n const containerWorldHeight = Math.max(\n (container.scrollHeight || container.clientHeight) * invScale,\n container.clientHeight * invScale,\n );\n const baseWorldHeight = Math.max(layout.totalHeight || 0, containerWorldHeight);\n // Use larger buffer and extend further above the viewport to ensure full coverage\n // when zoomed out and cards are positioned at the bottom\n const bufferWorld = Math.max(500, baseWorldHeight * 0.5, containerWorldHeight);\n const worldHeight = baseWorldHeight + bufferWorld * 3;\n const startY = -bufferWorld * 2;\n\n // Get existing background graphics (excluding highlight)\n const backgroundGraphics = groupsContainer.children.filter(c => (c as unknown as { name?: string }).name !== 'highlight') as PIXI.Graphics[];\n let bgIndex = 0;\n\n // Instead of re-deriving bucket geometry from constants, compute bucket bounds\n // directly from the positions stored in the layout so backgrounds align exactly.\n for (let index = 0; index < grouping.groups.length; index++) {\n const group = grouping.groups[index];\n let minX = Infinity;\n let maxX = -Infinity;\n\n for (let j = 0; j < group.ids.length; j++) {\n const id = group.ids[j];\n const pos = layout.positions.get(id);\n if (pos) {\n minX = Math.min(minX, pos.x);\n maxX = Math.max(maxX, pos.x);\n }\n }\n\n if (minX === Infinity && (!layout.groupXs || layout.groupXs[index] === undefined)) continue;\n\n // Prefer explicit bucket width and position from layout when available\n const bucketWidths = layout.bucketWidths || [];\n const groupXs = layout.groupXs || [];\n const widthFromLayout = bucketWidths[index];\n const xFromLayout = groupXs[index];\n\n const width = widthFromLayout && widthFromLayout > 0 ? widthFromLayout : ((maxX - minX) || 0);\n const x = xFromLayout !== undefined ? xFromLayout : minX;\n\n if (index % 2 === 0 && width > 0) {\n let bg: PIXI.Graphics;\n\n if (bgIndex < backgroundGraphics.length) {\n bg = backgroundGraphics[bgIndex];\n bg.clear();\n } else {\n bg = new PIXI.Graphics();\n // Insert before highlight if it exists, otherwise at end\n const highlightIndex = groupsContainer.children.findIndex(c => (c as unknown as { name?: string }).name === 'highlight');\n if (highlightIndex >= 0) {\n groupsContainer.addChildAt(bg, highlightIndex);\n } else {\n groupsContainer.addChild(bg);\n }\n }\n\n bg.rect(x, startY, width, worldHeight);\n bg.fill(cardColors.base);\n bg.alpha = 0.15;\n bg.visible = true;\n bgIndex++;\n }\n }\n\n // Hide unused background graphics\n for (let i = bgIndex; i < backgroundGraphics.length; i++) {\n backgroundGraphics[i].visible = false;\n }\n}\n\nexport function updateHighlight(\n groupsContainer: PIXI.Container | null,\n container: HTMLDivElement | null,\n grouping: GroupingResult,\n layout: LayoutResult,\n hoveredGroupIndex: number | null,\n cardWidth: number,\n zoomLevel: number,\n) {\n if (!groupsContainer || !container || grouping.groups.length === 0) return;\n\n const invScale = zoomLevel && zoomLevel !== 0 ? 1 / zoomLevel : 1;\n\n let highlight = groupsContainer.children.find(child => (child as unknown as { name?: string }).name === 'highlight') as PIXI.Graphics;\n\n if (!highlight) {\n highlight = new PIXI.Graphics();\n (highlight as unknown as { name: string }).name = 'highlight';\n groupsContainer.addChild(highlight);\n }\n\n highlight.clear();\n\n if (hoveredGroupIndex === null || hoveredGroupIndex < 0) {\n highlight.visible = false;\n return;\n }\n\n const group = grouping.groups[hoveredGroupIndex];\n if (!group || group.ids.length === 0) {\n highlight.visible = false;\n return;\n }\n\n // Use layout info if available\n const bucketWidths = layout.bucketWidths || [];\n const groupXs = layout.groupXs || [];\n const widthFromLayout = bucketWidths[hoveredGroupIndex];\n const xFromLayout = groupXs[hoveredGroupIndex];\n\n let rectX = 0;\n let rectWidth = 0;\n\n if (widthFromLayout !== undefined && xFromLayout !== undefined) {\n rectX = xFromLayout;\n rectWidth = widthFromLayout;\n } else {\n // Fallback: derive from items bounding box\n let minX = Infinity;\n let maxX = -Infinity;\n\n for (let j = 0; j < group.ids.length; j++) {\n const id = group.ids[j];\n const pos = layout.positions.get(id);\n if (pos) {\n minX = Math.min(minX, pos.x);\n maxX = Math.max(maxX, pos.x + cardWidth);\n }\n }\n\n if (minX === Infinity) {\n highlight.visible = false;\n return;\n }\n rectX = minX;\n rectWidth = maxX - minX;\n }\n\n const containerWorldHeight = Math.max(\n (container.scrollHeight || container.clientHeight) * invScale,\n container.clientHeight * invScale,\n );\n const baseWorldHeight = Math.max(layout.totalHeight || 0, containerWorldHeight);\n const bufferWorld = Math.max(200, baseWorldHeight * 0.25);\n const worldHeight = baseWorldHeight + bufferWorld * 2;\n const startY = -bufferWorld;\n\n highlight.rect(rectX, startY, rectWidth, worldHeight);\n highlight.fill(0xffffff);\n highlight.alpha = 0.05;\n highlight.visible = true;\n}\n"],"names":["PIXI"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAOM,SAAU,sBAAsB,CACpC,eAAsC,EACtC,SAAgC,EAChC,QAAwB,EACxB,MAAoB,EACpB,SAAiB,EACjB,UAAsB,EACtB,QAAgB,EAAA;AAEhB,IAAA,IAAI,CAAC,eAAe;QAAE;AAKtB,IAAA,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,YAAY,EAAE;AAG3E,QAAA,KAAK,MAAM,KAAK,IAAI,eAAe,CAAC,QAAQ,EAAE;AAC5C,YAAA,IAAK,KAAsC,CAAC,IAAI,KAAK,WAAW,EAAE;AAChE,gBAAA,KAAK,CAAC,OAAO,GAAG,KAAK;YACvB;QACF;QACA;IACF;AAGA,IAAA,MAAM,QAAQ,GAAG,SAAS,IAAI,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC;IACjE,MAAM,oBAAoB,GAAG,IAAI,CAAC,GAAG,CACnC,CAAC,SAAS,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,IAAI,QAAQ,EAC7D,SAAS,CAAC,YAAY,GAAG,QAAQ,CAClC;AACD,IAAA,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,EAAE,oBAAoB,CAAC;AAG/E,IAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,GAAG,GAAG,EAAE,oBAAoB,CAAC;AAC9E,IAAA,MAAM,WAAW,GAAG,eAAe,GAAG,WAAW,GAAG,CAAC;AACrD,IAAA,MAAM,MAAM,GAAG,CAA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W,GAAG,eAAe,GAAG,WAAW,GAAG,CAAC;AACrD,IAAA,MAAM,MAAM,GAAG,CAAC,WAAW;IAE3B,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC;AACrD,IAAA,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AACxB,IAAA,SAAS,CAAC,KAAK,GAAG,IAAI;AACtB,IAAA,SAAS,CAAC,OAAO,GAAG,IAAI;AAC1B;;;;;"}
|
|
@@ -23,7 +23,7 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
var PIXI__namespace = /*#__PURE__*/_interopNamespaceDefault(PIXI);
|
|
24
24
|
|
|
25
25
|
const spritePool = [];
|
|
26
|
-
function createCardSprite(id, x, y, items, onCardClick, onPanStart, cardWidth, cardHeight, cardColors) {
|
|
26
|
+
function createCardSprite(id, x, y, items, onCardClick, onPanStart, cardWidth, cardHeight, cardColors, cardRenderer, resolveId) {
|
|
27
27
|
if (spritePool.length > 0) {
|
|
28
28
|
const sprite = spritePool.pop();
|
|
29
29
|
if (sprite.container) {
|
|
@@ -92,7 +92,7 @@ function createCardSprite(id, x, y, items, onCardClick, onPanStart, cardWidth, c
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
if (sprite.container) {
|
|
95
|
-
sprite.container._eventContext = { items, onCardClick, id };
|
|
95
|
+
sprite.container._eventContext = { items, onCardClick, id, cardRenderer, resolveId };
|
|
96
96
|
}
|
|
97
97
|
return sprite;
|
|
98
98
|
}
|
|
@@ -100,7 +100,8 @@ function createCardSprite(id, x, y, items, onCardClick, onPanStart, cardWidth, c
|
|
|
100
100
|
container.eventMode = 'static';
|
|
101
101
|
container.cursor = 'pointer';
|
|
102
102
|
container.position.set(x, y);
|
|
103
|
-
container.
|
|
103
|
+
container.hitArea = new PIXI__namespace.Rectangle(constants.CARD_GAP / 2, constants.CARD_GAP / 2, cardWidth - constants.CARD_GAP, cardHeight - constants.CARD_GAP);
|
|
104
|
+
container._eventContext = { items, onCardClick, id, cardRenderer, resolveId };
|
|
104
105
|
const graphics = new PIXI__namespace.Graphics();
|
|
105
106
|
const actualWidth = cardWidth - constants.CARD_GAP;
|
|
106
107
|
const actualHeight = cardHeight - constants.CARD_GAP;
|
|
@@ -142,7 +143,8 @@ function createCardSprite(id, x, y, items, onCardClick, onPanStart, cardWidth, c
|
|
|
142
143
|
e.stopPropagation();
|
|
143
144
|
const ctx = container._eventContext;
|
|
144
145
|
const itemsArray = ctx.items;
|
|
145
|
-
const
|
|
146
|
+
const numericId = typeof ctx.id === 'number' ? ctx.id : Number(ctx.id);
|
|
147
|
+
const item = itemsArray[numericId];
|
|
146
148
|
if (item) {
|
|
147
149
|
ctx.onCardClick(item, e.nativeEvent, ctx.id);
|
|
148
150
|
}
|
|
@@ -172,46 +174,14 @@ function destroySprite(sprite) {
|
|
|
172
174
|
}
|
|
173
175
|
spritePool.push(sprite);
|
|
174
176
|
}
|
|
175
|
-
function
|
|
176
|
-
for (const sprite of spritePool) {
|
|
177
|
-
try {
|
|
178
|
-
sprite.graphics?.destroy();
|
|
179
|
-
sprite.titleText?.destroy();
|
|
180
|
-
sprite.labelsText?.destroy();
|
|
181
|
-
sprite.valuesText?.destroy();
|
|
182
|
-
sprite.container?.destroy();
|
|
183
|
-
}
|
|
184
|
-
catch (e) {
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
spritePool.length = 0;
|
|
188
|
-
}
|
|
189
|
-
function updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColors) {
|
|
177
|
+
function updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, cardColors, cardRenderer) {
|
|
190
178
|
if (!item)
|
|
191
179
|
return;
|
|
192
|
-
const event = item;
|
|
193
|
-
const eventType = String(event.type || event.name || event.title || 'Event');
|
|
194
|
-
const timeStr = event.occurred ? new Date(event.occurred).toLocaleString('en-US', {
|
|
195
|
-
month: '2-digit',
|
|
196
|
-
day: '2-digit',
|
|
197
|
-
year: 'numeric',
|
|
198
|
-
hour: '2-digit',
|
|
199
|
-
minute: '2-digit',
|
|
200
|
-
hour12: false
|
|
201
|
-
}).replace(',', '') : '';
|
|
202
|
-
const correlation = event.correlationId || event.correlation || '';
|
|
203
|
-
const correlationShort = correlation ? String(correlation).substring(0, 12) + '...' : '';
|
|
204
|
-
const maxTitleLength = 20;
|
|
205
|
-
const titleDisplay = eventType.length > maxTitleLength
|
|
206
|
-
? eventType.substring(0, maxTitleLength) + '...'
|
|
207
|
-
: eventType;
|
|
208
|
-
const maxTypeLength = 16;
|
|
209
|
-
const typeDisplay = eventType.length > maxTypeLength
|
|
210
|
-
? eventType.substring(0, maxTypeLength) + '...'
|
|
211
|
-
: eventType;
|
|
212
180
|
const colors = cardColors;
|
|
213
|
-
const
|
|
214
|
-
const
|
|
181
|
+
const cardData = cardRenderer(item);
|
|
182
|
+
const titleDisplay = cardData.title;
|
|
183
|
+
const labelsText = cardData.labels.join('\n');
|
|
184
|
+
const valuesText = cardData.values.join('\n');
|
|
215
185
|
const colorsChanged = sprite.lastCardColors !== colors;
|
|
216
186
|
if (!sprite.titleText || sprite.titleText.destroyed)
|
|
217
187
|
return;
|
|
@@ -284,7 +254,6 @@ function updateCardContent(sprite, item, selectedId, cardWidth, cardHeight, card
|
|
|
284
254
|
}
|
|
285
255
|
}
|
|
286
256
|
|
|
287
|
-
exports.clearSpritePool = clearSpritePool;
|
|
288
257
|
exports.createCardSprite = createCardSprite;
|
|
289
258
|
exports.destroySprite = destroySprite;
|
|
290
259
|
exports.updateCardContent = updateCardContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprites.js","sources":["../../../../../PivotViewer/components/pivot/sprites.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport * as PIXI from 'pixi.js';\nimport { CARD_GAP, CARD_PADDING, CARD_RADIUS } from './constants';\nimport type { CardSprite, CardColors } from './constants';\n\nconst spritePool: CardSprite[] = [];\n\nexport function createCardSprite<TItem extends object>(\n id: number | string,\n x: number,\n y: number,\n items: TItem[],\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void,\n onPanStart: (e: MouseEvent) => void,\n cardWidth: number,\n cardHeight: number,\n cardColors: CardColors,\n): CardSprite {\n if (spritePool.length > 0) {\n const sprite = spritePool.pop()!;\n if (sprite.container) {\n sprite.container.visible = true;\n sprite.container.alpha = 1;\n sprite.container.position.set(x, y);\n }\n sprite.itemId = id;\n sprite.targetX = x;\n sprite.targetY = y;\n sprite.currentX = x;\n sprite.currentY = y;\n\n // Reset animation state\n delete sprite.animationStartTime;\n delete sprite.animationDelay;\n delete sprite.startX;\n delete sprite.startY;\n\n // Reset cache\n sprite.lastSelectedId = null;\n sprite.lastCardColors = undefined;\n sprite.lastTitle = undefined;\n sprite.lastLabels = undefined;\n sprite.lastValues = undefined;\n\n // Recreate graphics if it was destroyed\n if (!sprite.graphics || sprite.graphics.destroyed) {\n sprite.graphics = new PIXI.Graphics();\n if (sprite.container) {\n sprite.container.addChildAt(sprite.graphics, 0);\n }\n }\n\n // Recreate text objects if they were destroyed\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n \n if (!sprite.titleText || sprite.titleText.destroyed) {\n sprite.titleText = new PIXI.Text('', {\n fontSize: 13,\n fill: cardColors.text as string | number,\n fontWeight: '600',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n sprite.titleText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING);\n if (sprite.container) {\n sprite.container.addChild(sprite.titleText);\n }\n }\n\n if (!sprite.labelsText || sprite.labelsText.destroyed) {\n sprite.labelsText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.textSecondary as string | number,\n fontWeight: '400',\n lineHeight: 18,\n } as PIXI.TextStyle);\n sprite.labelsText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING + 40);\n if (sprite.container) {\n sprite.container.addChild(sprite.labelsText);\n }\n }\n\n if (!sprite.valuesText || sprite.valuesText.destroyed) {\n sprite.valuesText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.text as string | number,\n fontWeight: '500',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n sprite.valuesText.position.set(offsetX + CARD_PADDING + 65, offsetY + CARD_PADDING + 40);\n if (sprite.container) {\n sprite.container.addChild(sprite.valuesText);\n }\n }\n\n // Update event context\n if (sprite.container) {\n (sprite.container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string } })._eventContext = { items, onCardClick, id };\n }\n\n return sprite;\n }\n\n const container = new PIXI.Container();\n container.eventMode = 'static';\n container.cursor = 'pointer';\n container.position.set(x, y);\n\n // Store context for event handlers\n (container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string } })._eventContext = { items, onCardClick, id };\n\n const graphics = new PIXI.Graphics();\n\n const actualWidth = cardWidth - CARD_GAP;\n const actualHeight = cardHeight - CARD_GAP;\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n\n const gradient = new PIXI.FillGradient(0, offsetY, 0, offsetY + actualHeight);\n gradient.addColorStop(0, cardColors.mid);\n gradient.addColorStop(1, cardColors.base);\n\n graphics.roundRect(offsetX, offsetY, actualWidth, actualHeight, CARD_RADIUS);\n graphics.fill(gradient);\n\n container.addChild(graphics);\n\n const titleText = new PIXI.Text('', {\n fontSize: 13,\n fill: cardColors.text as string | number,\n fontWeight: '600',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n titleText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING);\n container.addChild(titleText);\n\n const labelsText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.textSecondary as string | number,\n fontWeight: '400',\n lineHeight: 18,\n } as PIXI.TextStyle);\n labelsText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING + 40);\n container.addChild(labelsText);\n\n const valuesText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.text as string | number,\n fontWeight: '500',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n valuesText.position.set(offsetX + CARD_PADDING + 65, offsetY + CARD_PADDING + 40);\n container.addChild(valuesText);\n\n container.on('click', (e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n const ctx = (container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string } })._eventContext;\n const itemsArray = ctx.items;\n const item = itemsArray[Number(ctx.id)];\n if (item) {\n ctx.onCardClick(item, e.nativeEvent as MouseEvent, ctx.id);\n }\n });\n\n container.on('pointerdown', (e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n // onPanStart(e.nativeEvent as MouseEvent);\n });\n\n return {\n container,\n graphics,\n titleText,\n labelsText,\n valuesText,\n itemId: id,\n targetX: x,\n targetY: y,\n currentX: x,\n currentY: y,\n };\n}\n\nexport function destroySprite(sprite: CardSprite) {\n if (sprite.container && sprite.container.parent) {\n sprite.container.parent.removeChild(sprite.container);\n }\n // Reset visibility to ensure it doesn't ghost if something goes wrong\n if (sprite.container) {\n sprite.container.visible = false;\n }\n spritePool.push(sprite);\n}\n\nexport function clearSpritePool() {\n for (const sprite of spritePool) {\n try {\n sprite.graphics?.destroy();\n sprite.titleText?.destroy();\n sprite.labelsText?.destroy();\n sprite.valuesText?.destroy();\n sprite.container?.destroy();\n } catch (e) {\n void e;\n }\n }\n spritePool.length = 0;\n}\n\n// Updated: Text objects now recreated when recycling pooled sprites\nexport function updateCardContent<TItem extends object>(\n sprite: CardSprite,\n item: TItem,\n selectedId: string | number | null,\n cardWidth: number,\n cardHeight: number,\n cardColors: CardColors,\n) {\n if (!item) return;\n\n const event = item as unknown as Record<string, unknown>;\n const eventType = String(event.type || event.name || event.title || 'Event');\n\n const timeStr = event.occurred ? new Date(event.occurred as string | number | Date).toLocaleString('en-US', {\n month: '2-digit',\n day: '2-digit',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n hour12: false\n }).replace(',', '') : '';\n\n const correlation = event.correlationId || event.correlation || '';\n const correlationShort = correlation ? String(correlation).substring(0, 12) + '...' : '';\n\n const maxTitleLength = 20;\n const titleDisplay = eventType.length > maxTitleLength\n ? eventType.substring(0, maxTitleLength) + '...'\n : eventType;\n\n const maxTypeLength = 16;\n const typeDisplay = eventType.length > maxTypeLength\n ? eventType.substring(0, maxTypeLength) + '...'\n : eventType;\n\n const colors = cardColors;\n const labelsText = 'Type\\nOccurred\\nCorrelation';\n const valuesText = `${typeDisplay}\\n${timeStr}\\n${correlationShort}`;\n const colorsChanged = sprite.lastCardColors !== colors;\n\n // Ensure text objects exist before using them\n if (!sprite.titleText || sprite.titleText.destroyed) return;\n if (!sprite.labelsText || sprite.labelsText.destroyed) return;\n if (!sprite.valuesText || sprite.valuesText.destroyed) return;\n\n if (sprite.lastTitle !== titleDisplay) {\n sprite.titleText.text = titleDisplay;\n sprite.lastTitle = titleDisplay;\n }\n\n if (sprite.lastLabels !== labelsText) {\n sprite.labelsText.text = labelsText;\n sprite.lastLabels = labelsText;\n }\n\n if (colorsChanged && sprite.labelsText.style) {\n (sprite.labelsText.style as unknown as { fill: string | number }).fill = colors.textSecondary;\n }\n\n if (sprite.lastValues !== valuesText) {\n sprite.valuesText.text = valuesText;\n sprite.lastValues = valuesText;\n }\n\n if (colorsChanged && sprite.valuesText.style) {\n (sprite.valuesText.style as unknown as { fill: string | number }).fill = colors.text;\n }\n\n sprite.titleText.visible = true;\n sprite.labelsText.visible = true;\n sprite.valuesText.visible = true;\n\n const isSelected = sprite.itemId === selectedId;\n\n // Only redraw graphics if selection state or colors changed\n if (sprite.lastSelectedId === selectedId && !colorsChanged && sprite.graphics) {\n return;\n }\n\n sprite.lastSelectedId = selectedId;\n sprite.lastCardColors = cardColors;\n\n // Ensure graphics exists before attempting to use it\n if (!sprite.graphics || sprite.graphics.destroyed) {\n sprite.graphics = new PIXI.Graphics();\n if (sprite.container) {\n sprite.container.addChildAt(sprite.graphics, 0);\n }\n } else {\n sprite.graphics.clear();\n }\n\n const actualWidth = cardWidth - CARD_GAP;\n const actualHeight = cardHeight - CARD_GAP;\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n\n const gradient = new PIXI.FillGradient(0, offsetY, 0, offsetY + actualHeight);\n if (isSelected) {\n gradient.addColorStop(0, colors.gradient);\n gradient.addColorStop(1, colors.mid);\n } else {\n gradient.addColorStop(0, colors.mid);\n gradient.addColorStop(1, colors.base);\n }\n\n sprite.graphics.roundRect(offsetX, offsetY, actualWidth, actualHeight, CARD_RADIUS);\n \n // Ensure graphics is still valid before filling\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.fill(gradient);\n }\n\n if (isSelected) {\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.stroke({ width: 2, color: colors.border });\n }\n } else {\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.stroke({ width: 1, color: colors.border, alpha: 0.35 });\n }\n }\n}\n"],"names":["PIXI","CARD_GAP","CARD_PADDING","CARD_RADIUS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,UAAU,GAAiB,EAAE;SAEnB,gBAAgB,CAC9B,EAAmB,EACnB,CAAS,EACT,CAAS,EACT,KAAc,EACd,WAAsE,EACtE,UAAmC,EACnC,SAAiB,EACjB,UAAkB,EAClB,UAAsB,EAAA;AAEtB,IAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACzB,QAAA,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,EAAG;AAChC,QAAA,IAAI,MAAM,CAAC,SAAS,EAAE;AACpB,YAAA,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI;AAC/B,YAAA,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC;YAC1B,MAAM,CAAC,SAAS,CA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AE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzE;IACF;AACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sprites.js","sources":["../../../../../PivotViewer/components/pivot/sprites.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport * as PIXI from 'pixi.js';\nimport { CARD_GAP, CARD_PADDING, CARD_RADIUS } from './constants';\nimport type { CardSprite, CardColors } from './constants';\n\nconst spritePool: CardSprite[] = [];\n\nexport function createCardSprite<TItem extends object>(\n id: number | string,\n x: number,\n y: number,\n items: TItem[],\n onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void,\n onPanStart: (e: MouseEvent) => void,\n cardWidth: number,\n cardHeight: number,\n cardColors: CardColors,\n cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] },\n resolveId: (item: TItem, index: number) => string | number,\n): CardSprite {\n if (spritePool.length > 0) {\n const sprite = spritePool.pop()!;\n if (sprite.container) {\n sprite.container.visible = true;\n sprite.container.alpha = 1;\n sprite.container.position.set(x, y);\n }\n sprite.itemId = id;\n sprite.targetX = x;\n sprite.targetY = y;\n sprite.currentX = x;\n sprite.currentY = y;\n\n // Reset animation state\n delete sprite.animationStartTime;\n delete sprite.animationDelay;\n delete sprite.startX;\n delete sprite.startY;\n\n // Reset cache\n sprite.lastSelectedId = null;\n sprite.lastCardColors = undefined;\n sprite.lastTitle = undefined;\n sprite.lastLabels = undefined;\n sprite.lastValues = undefined;\n\n // Recreate graphics if it was destroyed\n if (!sprite.graphics || sprite.graphics.destroyed) {\n sprite.graphics = new PIXI.Graphics();\n if (sprite.container) {\n sprite.container.addChildAt(sprite.graphics, 0);\n }\n }\n\n // Recreate text objects if they were destroyed\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n \n if (!sprite.titleText || sprite.titleText.destroyed) {\n sprite.titleText = new PIXI.Text('', {\n fontSize: 13,\n fill: cardColors.text as string | number,\n fontWeight: '600',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n sprite.titleText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING);\n if (sprite.container) {\n sprite.container.addChild(sprite.titleText);\n }\n }\n\n if (!sprite.labelsText || sprite.labelsText.destroyed) {\n sprite.labelsText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.textSecondary as string | number,\n fontWeight: '400',\n lineHeight: 18,\n } as PIXI.TextStyle);\n sprite.labelsText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING + 40);\n if (sprite.container) {\n sprite.container.addChild(sprite.labelsText);\n }\n }\n\n if (!sprite.valuesText || sprite.valuesText.destroyed) {\n sprite.valuesText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.text as string | number,\n fontWeight: '500',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n sprite.valuesText.position.set(offsetX + CARD_PADDING + 65, offsetY + CARD_PADDING + 40);\n if (sprite.container) {\n sprite.container.addChild(sprite.valuesText);\n }\n }\n\n // Update event context\n if (sprite.container) {\n (sprite.container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string; cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] }; resolveId: (item: TItem, index: number) => string | number } })._eventContext = { items, onCardClick, id, cardRenderer, resolveId };\n }\n\n return sprite;\n }\n\n const container = new PIXI.Container();\n container.eventMode = 'static';\n container.cursor = 'pointer';\n container.position.set(x, y);\n\n // Define hit area to match the visible card size (excluding gaps)\n // This ensures the entire card is clickable and avoids issues with text blocking hits\n container.hitArea = new PIXI.Rectangle(\n CARD_GAP / 2,\n CARD_GAP / 2,\n cardWidth - CARD_GAP,\n cardHeight - CARD_GAP\n );\n\n // Container configured for pointer interactions; hitArea matches visible card.\n\n // Store context for event handlers\n (container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string; cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] }; resolveId: (item: TItem, index: number) => string | number } })._eventContext = { items, onCardClick, id, cardRenderer, resolveId };\n\n const graphics = new PIXI.Graphics();\n\n const actualWidth = cardWidth - CARD_GAP;\n const actualHeight = cardHeight - CARD_GAP;\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n\n const gradient = new PIXI.FillGradient(0, offsetY, 0, offsetY + actualHeight);\n gradient.addColorStop(0, cardColors.mid);\n gradient.addColorStop(1, cardColors.base);\n\n graphics.roundRect(offsetX, offsetY, actualWidth, actualHeight, CARD_RADIUS);\n graphics.fill(gradient);\n\n container.addChild(graphics);\n\n const titleText = new PIXI.Text('', {\n fontSize: 13,\n fill: cardColors.text as string | number,\n fontWeight: '600',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n titleText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING);\n container.addChild(titleText);\n\n const labelsText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.textSecondary as string | number,\n fontWeight: '400',\n lineHeight: 18,\n } as PIXI.TextStyle);\n labelsText.position.set(offsetX + CARD_PADDING, offsetY + CARD_PADDING + 40);\n container.addChild(labelsText);\n\n const valuesText = new PIXI.Text('', {\n fontSize: 11,\n fill: cardColors.text as string | number,\n fontWeight: '500',\n lineHeight: 18,\n wordWrap: false,\n } as PIXI.TextStyle);\n valuesText.position.set(offsetX + CARD_PADDING + 65, offsetY + CARD_PADDING + 40);\n container.addChild(valuesText);\n\n container.on('click', (e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n const ctx = (container as unknown as { _eventContext: { items: TItem[]; onCardClick: (item: TItem, e: MouseEvent, id: number | string) => void; id: number | string } })._eventContext;\n const itemsArray = ctx.items;\n const numericId = typeof ctx.id === 'number' ? ctx.id : Number(ctx.id);\n const item = itemsArray[numericId];\n if (item) {\n ctx.onCardClick(item, e.nativeEvent as MouseEvent, ctx.id);\n }\n });\n\n container.on('pointerdown', (e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n // onPanStart(e.nativeEvent as MouseEvent);\n });\n\n return {\n container,\n graphics,\n titleText,\n labelsText,\n valuesText,\n itemId: id,\n targetX: x,\n targetY: y,\n currentX: x,\n currentY: y,\n };\n}\n\nexport function destroySprite(sprite: CardSprite) {\n if (sprite.container && sprite.container.parent) {\n sprite.container.parent.removeChild(sprite.container);\n }\n // Reset visibility to ensure it doesn't ghost if something goes wrong\n if (sprite.container) {\n sprite.container.visible = false;\n }\n spritePool.push(sprite);\n}\n\nexport function clearSpritePool() {\n for (const sprite of spritePool) {\n try {\n sprite.graphics?.destroy();\n sprite.titleText?.destroy();\n sprite.labelsText?.destroy();\n sprite.valuesText?.destroy();\n sprite.container?.destroy();\n } catch (e) {\n void e;\n }\n }\n spritePool.length = 0;\n}\n\n// Updated: Text objects now recreated when recycling pooled sprites\nexport function updateCardContent<TItem extends object>(\n sprite: CardSprite,\n item: TItem,\n selectedId: string | number | null,\n cardWidth: number,\n cardHeight: number,\n cardColors: CardColors,\n cardRenderer: (item: TItem) => { title: string; labels: string[]; values: string[] },\n) {\n if (!item) return;\n\n // Selection rendering depends on sprite.itemId matching selectedId\n\n const colors = cardColors;\n const cardData = cardRenderer(item);\n const titleDisplay = cardData.title;\n const labelsText = cardData.labels.join('\\n');\n const valuesText = cardData.values.join('\\n');\n const colorsChanged = sprite.lastCardColors !== colors;\n\n // Ensure text objects exist before using them\n if (!sprite.titleText || sprite.titleText.destroyed) return;\n if (!sprite.labelsText || sprite.labelsText.destroyed) return;\n if (!sprite.valuesText || sprite.valuesText.destroyed) return;\n\n if (sprite.lastTitle !== titleDisplay) {\n sprite.titleText.text = titleDisplay;\n sprite.lastTitle = titleDisplay;\n }\n\n if (sprite.lastLabels !== labelsText) {\n sprite.labelsText.text = labelsText;\n sprite.lastLabels = labelsText;\n }\n\n if (colorsChanged && sprite.labelsText.style) {\n (sprite.labelsText.style as unknown as { fill: string | number }).fill = colors.textSecondary;\n }\n\n if (sprite.lastValues !== valuesText) {\n sprite.valuesText.text = valuesText;\n sprite.lastValues = valuesText;\n }\n\n if (colorsChanged && sprite.valuesText.style) {\n (sprite.valuesText.style as unknown as { fill: string | number }).fill = colors.text;\n }\n\n sprite.titleText.visible = true;\n sprite.labelsText.visible = true;\n sprite.valuesText.visible = true;\n\n const isSelected = sprite.itemId === selectedId;\n\n // Only redraw graphics if selection state or colors changed\n if (sprite.lastSelectedId === selectedId && !colorsChanged && sprite.graphics) {\n return;\n }\n\n sprite.lastSelectedId = selectedId;\n sprite.lastCardColors = cardColors;\n\n // Ensure graphics exists before attempting to use it\n if (!sprite.graphics || sprite.graphics.destroyed) {\n sprite.graphics = new PIXI.Graphics();\n if (sprite.container) {\n sprite.container.addChildAt(sprite.graphics, 0);\n }\n } else {\n sprite.graphics.clear();\n }\n\n const actualWidth = cardWidth - CARD_GAP;\n const actualHeight = cardHeight - CARD_GAP;\n const offsetX = CARD_GAP / 2;\n const offsetY = CARD_GAP / 2;\n\n const gradient = new PIXI.FillGradient(0, offsetY, 0, offsetY + actualHeight);\n if (isSelected) {\n gradient.addColorStop(0, colors.gradient);\n gradient.addColorStop(1, colors.mid);\n } else {\n gradient.addColorStop(0, colors.mid);\n gradient.addColorStop(1, colors.base);\n }\n\n sprite.graphics.roundRect(offsetX, offsetY, actualWidth, actualHeight, CARD_RADIUS);\n \n // Ensure graphics is still valid before filling\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.fill(gradient);\n }\n\n if (isSelected) {\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.stroke({ width: 2, color: colors.border });\n }\n } else {\n if (sprite.graphics && !sprite.graphics.destroyed) {\n sprite.graphics.stroke({ width: 1, color: colors.border, alpha: 0.35 });\n }\n }\n}\n"],"names":["PIXI","CARD_GAP","CARD_PADDING","CARD_RADIUS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,UAA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