@qoretechnologies/reqore 0.78.13-pr.723.ga5b4adf → 0.78.13
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/.claude/CLAUDE.md +1 -47
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +14 -60
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/Breadcrumbs/index.js +21 -58
- package/dist/components/Breadcrumbs/index.js.map +1 -1
- package/dist/components/Bubble/index.d.ts.map +1 -1
- package/dist/components/Bubble/index.js +4 -13
- package/dist/components/Bubble/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +0 -67
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +142 -361
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Callout/index.d.ts.map +1 -1
- package/dist/components/Callout/index.js +29 -49
- package/dist/components/Callout/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +36 -112
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
- package/dist/components/CollapsibleContent/index.js +2 -6
- package/dist/components/CollapsibleContent/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +1 -22
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/DataView/index.d.ts +0 -8
- package/dist/components/DataView/index.d.ts.map +1 -1
- package/dist/components/DataView/index.js +41 -90
- package/dist/components/DataView/index.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -3
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +43 -75
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DescriptionList/index.d.ts.map +1 -1
- package/dist/components/DescriptionList/index.js +4 -30
- package/dist/components/DescriptionList/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +25 -41
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +14 -19
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Effect/index.d.ts +0 -37
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +58 -224
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/EntityRow/index.d.ts.map +1 -1
- package/dist/components/EntityRow/index.js +59 -98
- package/dist/components/EntityRow/index.js.map +1 -1
- package/dist/components/FeatureCard/index.d.ts.map +1 -1
- package/dist/components/FeatureCard/index.js +21 -54
- package/dist/components/FeatureCard/index.js.map +1 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +4 -7
- package/dist/components/Header/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +3 -13
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +1 -44
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +23 -89
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts +2 -7
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +5 -12
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +10 -19
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +1 -6
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Menu/divider.d.ts.map +1 -1
- package/dist/components/Menu/divider.js +3 -8
- package/dist/components/Menu/divider.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +4 -17
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/item.d.ts.map +1 -1
- package/dist/components/Menu/item.js +5 -3
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +4 -20
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/NavRail/index.d.ts +0 -2
- package/dist/components/NavRail/index.d.ts.map +1 -1
- package/dist/components/NavRail/index.js +47 -131
- package/dist/components/NavRail/index.js.map +1 -1
- package/dist/components/Notifications/notification.d.ts +2 -6
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Notifications/notification.js +18 -78
- package/dist/components/Notifications/notification.js.map +1 -1
- package/dist/components/Notifications/styles.d.ts +0 -20
- package/dist/components/Notifications/styles.d.ts.map +1 -1
- package/dist/components/Notifications/styles.js +9 -37
- package/dist/components/Notifications/styles.js.map +1 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +3 -4
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +0 -3
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +153 -214
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Paragraph/index.d.ts.map +1 -1
- package/dist/components/Paragraph/index.js +5 -8
- package/dist/components/Paragraph/index.js.map +1 -1
- package/dist/components/Progress/index.d.ts.map +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/Progress/index.js.map +1 -1
- package/dist/components/Rating/index.d.ts.map +1 -1
- package/dist/components/Rating/index.js +8 -20
- package/dist/components/Rating/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +46 -89
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.js +42 -87
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SeverityRow/index.d.ts.map +1 -1
- package/dist/components/SeverityRow/index.js +1 -1
- package/dist/components/SeverityRow/index.js.map +1 -1
- package/dist/components/Span/index.d.ts.map +1 -1
- package/dist/components/Span/index.js +5 -8
- package/dist/components/Span/index.js.map +1 -1
- package/dist/components/StackedBar/index.d.ts.map +1 -1
- package/dist/components/StackedBar/index.js +12 -42
- package/dist/components/StackedBar/index.js.map +1 -1
- package/dist/components/Statistic/index.d.ts.map +1 -1
- package/dist/components/Statistic/index.js +6 -34
- package/dist/components/Statistic/index.js.map +1 -1
- package/dist/components/Table/cell.d.ts.map +1 -1
- package/dist/components/Table/cell.js +53 -128
- package/dist/components/Table/cell.js.map +1 -1
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.js +5 -7
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +1 -2
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/scrollbar.d.ts.map +1 -1
- package/dist/components/Table/scrollbar.js +9 -17
- package/dist/components/Table/scrollbar.js.map +1 -1
- package/dist/components/Tag/index.d.ts +3 -70
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +100 -336
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Testimonial/index.d.ts.map +1 -1
- package/dist/components/Testimonial/index.js +20 -35
- package/dist/components/Testimonial/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +0 -6
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +20 -20
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/Tier/group.d.ts +0 -2
- package/dist/components/Tier/group.d.ts.map +1 -1
- package/dist/components/Tier/group.js +2 -4
- package/dist/components/Tier/group.js.map +1 -1
- package/dist/components/Timeline/index.d.ts +0 -2
- package/dist/components/Timeline/index.d.ts.map +1 -1
- package/dist/components/Timeline/index.js +13 -56
- package/dist/components/Timeline/index.js.map +1 -1
- package/dist/components/Tree/index.d.ts.map +1 -1
- package/dist/components/Tree/index.js +20 -24
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +1 -4
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +1 -11
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js +4 -33
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +0 -6
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js +0 -2
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +2 -184
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +86 -739
- package/dist/helpers/colors.js.map +1 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +6 -24
- package/dist/hooks/useFocusTrap.js.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.d.ts +0 -5
- package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -1
- package/dist/hooks/usePrefersReducedMotion.js +1 -9
- package/dist/hooks/usePrefersReducedMotion.js.map +1 -1
- package/dist/hooks/useTextareaAutoSize.d.ts +0 -15
- package/dist/hooks/useTextareaAutoSize.d.ts.map +1 -1
- package/dist/hooks/useTextareaAutoSize.js +12 -90
- package/dist/hooks/useTextareaAutoSize.js.map +1 -1
- package/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -14
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
- package/tests.json +1 -0
- package/{vite.config.mts → vite.config.ts} +0 -6
- package/vitest.config.ts +152 -0
- package/dist/context/SurfaceContext.d.ts +0 -18
- package/dist/context/SurfaceContext.d.ts.map +0 -1
- package/dist/context/SurfaceContext.js +0 -39
- package/dist/context/SurfaceContext.js.map +0 -1
- package/dist/helpers/iconProps.d.ts +0 -14
- package/dist/helpers/iconProps.d.ts.map +0 -1
- package/dist/helpers/iconProps.js +0 -33
- package/dist/helpers/iconProps.js.map +0 -1
- package/dist/helpers/locale.d.ts +0 -20
- package/dist/helpers/locale.d.ts.map +0 -1
- package/dist/helpers/locale.js +0 -61
- package/dist/helpers/locale.js.map +0 -1
- package/dist/helpers/schedule.d.ts +0 -12
- package/dist/helpers/schedule.d.ts.map +0 -1
- package/dist/helpers/schedule.js +0 -10
- package/dist/helpers/schedule.js.map +0 -1
- package/dist/helpers/surface.d.ts +0 -31
- package/dist/helpers/surface.d.ts.map +0 -1
- package/dist/helpers/surface.js +0 -87
- package/dist/helpers/surface.js.map +0 -1
- package/dist/hooks/useDrawnSurface.d.ts +0 -38
- package/dist/hooks/useDrawnSurface.d.ts.map +0 -1
- package/dist/hooks/useDrawnSurface.js +0 -48
- package/dist/hooks/useDrawnSurface.js.map +0 -1
- package/vitest.config.mts +0 -241
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useReqoreDrawnSurface = void 0;
|
|
13
|
-
var react_1 = require("react");
|
|
14
|
-
var Effect_1 = require("../components/Effect");
|
|
15
|
-
var SurfaceContext_1 = require("../context/SurfaceContext");
|
|
16
|
-
var colors_1 = require("../helpers/colors");
|
|
17
|
-
var surface_1 = require("../helpers/surface");
|
|
18
|
-
/**
|
|
19
|
-
* What a card (an entity row, a callout, a testimonial, a statistic, a feature card) is drawn on and in, worked out
|
|
20
|
-
* once for all of them, so they cannot drift apart in how they read their own colors.
|
|
21
|
-
*
|
|
22
|
-
* The values are one object each for as long as what they come from holds: a gradient is followed by its colors,
|
|
23
|
-
* not by the effect object, which given inline is new on every render (and so was every surface handed down).
|
|
24
|
-
*/
|
|
25
|
-
var useReqoreDrawnSurface = function (_a) {
|
|
26
|
-
var _b;
|
|
27
|
-
var theme = _a.theme, customTheme = _a.customTheme, transparent = _a.transparent, fill = _a.fill, effect = _a.effect, hoverFill = _a.hoverFill;
|
|
28
|
-
var aroundSurface = (0, SurfaceContext_1.useReqoreSurface)();
|
|
29
|
-
var surface = (0, react_1.useMemo)(function () { return (0, surface_1.getUnpaintedSurface)(theme, customTheme, aroundSurface, !!transparent); }, [theme, customTheme, aroundSurface, transparent]);
|
|
30
|
-
var background = (0, react_1.useMemo)(function () {
|
|
31
|
-
return transparent
|
|
32
|
-
? (0, colors_1.getThemeSurface)(theme, surface)
|
|
33
|
-
: (0, colors_1.getDrawnColor)(fill, (0, colors_1.getThemeSurface)(theme, surface));
|
|
34
|
-
}, [transparent, theme, fill, surface]);
|
|
35
|
-
var gradientKey = JSON.stringify((_b = effect === null || effect === void 0 ? void 0 : effect.gradient) !== null && _b !== void 0 ? _b : null);
|
|
36
|
-
var backgrounds = (0, react_1.useMemo)(function () {
|
|
37
|
-
var under = (0, colors_1.getThemeSurface)(theme, surface);
|
|
38
|
-
var drawn = (0, Effect_1.getEffectBackgrounds)(theme, effect, background, under);
|
|
39
|
-
// hovered, it paints its hover fill where its gradient does not cover it
|
|
40
|
-
return hoverFill && !(0, Effect_1.getPrimaryGradient)(effect === null || effect === void 0 ? void 0 : effect.gradient)
|
|
41
|
-
? __spreadArray(__spreadArray([], drawn, true), [(0, colors_1.getDrawnColor)(hoverFill, under)], false) : drawn;
|
|
42
|
-
// `effect` is followed by its gradient's colors (see above)
|
|
43
|
-
}, [theme, gradientKey, background, surface, hoverFill]);
|
|
44
|
-
var text = (0, react_1.useMemo)(function () { return (0, colors_1.getReadableTextOn)(theme, backgrounds); }, [theme, backgrounds]);
|
|
45
|
-
return (0, react_1.useMemo)(function () { return ({ surface: surface, background: background, backgrounds: backgrounds, text: text }); }, [surface, background, backgrounds, text]);
|
|
46
|
-
};
|
|
47
|
-
exports.useReqoreDrawnSurface = useReqoreDrawnSurface;
|
|
48
|
-
//# sourceMappingURL=useDrawnSurface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawnSurface.js","sourceRoot":"","sources":["../../src/hooks/useDrawnSurface.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAgC;AAChC,+CAK8B;AAE9B,4DAA6D;AAC7D,4CAAsG;AACtG,8CAAyD;AA8BzD;;;;;;GAMG;AACI,IAAM,qBAAqB,GAAG,UAAC,EAOT;;QAN3B,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,WAAW,iBAAA,EACX,IAAI,UAAA,EACJ,MAAM,YAAA,EACN,SAAS,eAAA;IAET,IAAM,aAAa,GAAG,IAAA,iCAAgB,GAAE,CAAC;IACzC,IAAM,OAAO,GAAG,IAAA,eAAO,EACrB,cAAM,OAAA,IAAA,6BAAmB,EAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC,WAAW,CAAC,EAArE,CAAqE,EAC3E,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CACjD,CAAC;IACF,IAAM,UAAU,GAAG,IAAA,eAAO,EACxB;QACE,OAAA,WAAW;YACT,CAAC,CAAC,IAAA,wBAAe,EAAC,KAAK,EAAE,OAAO,CAAC;YACjC,CAAC,CAAE,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,wBAAe,EAAC,KAAK,EAAE,OAAO,CAAC,CAAqB;IAF7E,CAE6E,EAC/E,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CACpC,CAAC;IACF,IAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,mCAAI,IAAI,CAAC,CAAC;IAC7D,IAAM,WAAW,GAAG,IAAA,eAAO,EAAC;QAC1B,IAAM,KAAK,GAAG,IAAA,wBAAe,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,IAAM,KAAK,GAAG,IAAA,6BAAoB,EAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAErE,yEAAyE;QACzE,OAAO,SAAS,IAAI,CAAC,IAAA,2BAAkB,EAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC;YACvD,CAAC,iCAAK,KAAK,UAAE,IAAA,sBAAa,EAAC,SAAS,EAAE,KAAK,CAAoB,UAC/D,CAAC,CAAC,KAAK,CAAC;QACV,4DAA4D;IAC9D,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;IACzD,IAAM,IAAI,GAAG,IAAA,eAAO,EAClB,cAAM,OAAA,IAAA,0BAAiB,EAAC,KAAK,EAAE,WAAW,CAAoB,EAAxD,CAAwD,EAC9D,CAAC,KAAK,EAAE,WAAW,CAAC,CACrB,CAAC;IAEF,OAAO,IAAA,eAAO,EACZ,cAAM,OAAA,CAAC,EAAE,OAAO,SAAA,EAAE,UAAU,YAAA,EAAE,WAAW,aAAA,EAAE,IAAI,MAAA,EAAE,CAAC,EAA5C,CAA4C,EAClD,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,CACzC,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,qBAAqB,yBAwChC"}
|
package/vitest.config.mts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { qlipVitestPlugin } from '@qoretechnologies/qlip';
|
|
2
|
-
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
3
|
-
import { playwright } from '@vitest/browser-playwright';
|
|
4
|
-
import { readFileSync, readdirSync } from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { configDefaults, defineConfig, mergeConfig } from 'vitest/config';
|
|
8
|
-
import type { BrowserCommand } from 'vitest/node';
|
|
9
|
-
import { POSIX_LANGUAGE } from './src/stories/utils/posixLocale.mts';
|
|
10
|
-
import viteConfig from './vite.config.mts';
|
|
11
|
-
|
|
12
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const qlipUploadToken = process.env.QLIP_UPLOAD_TOKEN;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Story files that cannot hold a story tagged `tag` (`touch`, `scrollbars`, `posix-locale`),
|
|
17
|
-
* relative to the project root. The project that runs the stories with that tag leaves them out, so
|
|
18
|
-
* it does not load every story module only to skip it. Read from the files themselves: tagging a
|
|
19
|
-
* story is all it takes to run it on a touch screen, with classic scrollbars, or in a browser whose
|
|
20
|
-
* locale is POSIX.
|
|
21
|
-
*
|
|
22
|
-
* The story projects split the stories by the tags Storybook reads from a story file's source
|
|
23
|
-
* before it runs it (`tags` below): string literals, in a `tags` array on a story or its meta, or
|
|
24
|
-
* in an array the file names there. So a file with no `'touch'` or `"touch"` in it has no story
|
|
25
|
-
* any project counts as tagged, and any other file is loaded here. Matching the shape of a
|
|
26
|
-
* `tags` line instead left out a file that tagged its stories another way Storybook reads
|
|
27
|
-
* (`tags: TOUCH`, a comment in the array): the desktop project left those stories out and this
|
|
28
|
-
* one never loaded them, so they ran nowhere and nothing failed. A file that only mentions the
|
|
29
|
-
* word costs a module load. A tag a story only has when it runs (spread into it from a shared
|
|
30
|
-
* object) is read from the source by no project: `.storybook/vitest.setup.ts` fails it for `touch`.
|
|
31
|
-
*/
|
|
32
|
-
const storyFilesWithoutTag = (tag: string): string[] =>
|
|
33
|
-
readdirSync(path.join(dirname, 'src'), { recursive: true, encoding: 'utf8' })
|
|
34
|
-
.filter((file) => file.endsWith('.stories.tsx'))
|
|
35
|
-
.map((file) => path.join('src', file).split(path.sep).join('/'))
|
|
36
|
-
.filter(
|
|
37
|
-
(file) => !new RegExp(`['"]${tag}['"]`).test(readFileSync(path.join(dirname, file), 'utf8'))
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
// One plugin for both story projects, so they make one qlip build: one build id, and one upload at the end
|
|
41
|
-
// of the run (the plugin registers its reporter once, however many projects load it).
|
|
42
|
-
const qlip = qlipVitestPlugin({
|
|
43
|
-
auto: true,
|
|
44
|
-
captureOnError: true,
|
|
45
|
-
disableAnimations: true,
|
|
46
|
-
pauseAnimationsAtEnd: true,
|
|
47
|
-
viewport: { width: 1920, height: 1080 },
|
|
48
|
-
// serverUrl omitted — defaults to https://qlip.qoretechnologies.com
|
|
49
|
-
...(qlipUploadToken ? { upload: { uploadToken: qlipUploadToken } } : {}),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The browser a story project runs in: a desktop with a mouse; the phone the stories tagged `touch`
|
|
54
|
-
* run on (`src/stories/utils/touchScreen.ts`); a desktop that draws its scrollbars, which the
|
|
55
|
-
* stories tagged `scrollbars` run on (`src/stories/utils/scrollbars.ts`); or a desktop whose locale
|
|
56
|
-
* is POSIX, which the stories tagged `posix-locale` run on (`src/stories/utils/posixLocale.mts`). A
|
|
57
|
-
* new object for each project: Vitest names a project's browser instances on the objects themselves.
|
|
58
|
-
*/
|
|
59
|
-
const storyBrowser = (kind: 'desktop' | 'phone' | 'scrollbars' | 'posix-locale' = 'desktop') => ({
|
|
60
|
-
enabled: true,
|
|
61
|
-
// Vitest 4's @vitest/browser-playwright no longer applies
|
|
62
|
-
// `browser.viewport` to the Playwright context (the line is
|
|
63
|
-
// commented out in the provider), so the context silently falls
|
|
64
|
-
// back to Playwright's 1280×720 default and every capture is
|
|
65
|
-
// clamped to it — while the manifest still records qlip's
|
|
66
|
-
// 1920×1080, yielding blurry, mislabeled snapshots. Pass the
|
|
67
|
-
// viewport through the provider's `contextOptions` (which IS
|
|
68
|
-
// applied) so the browser window matches qlip's capture viewport
|
|
69
|
-
// 1:1 and screenshots come out at their true resolution.
|
|
70
|
-
//
|
|
71
|
-
// The phone is a phone from the start: Playwright makes its context with `isMobile` and `hasTouch`, so
|
|
72
|
-
// `(pointer: coarse)` and `(hover: none)` match and a touch is a finger's, and nothing turns that on or
|
|
73
|
-
// off. Turning Chromium's touch emulation off over the DevTools protocol (how a touch story used to
|
|
74
|
-
// borrow a desktop page) leaves the page with the hover and pointer the machine reports, not the mouse
|
|
75
|
-
// Playwright launched it with (`--blink-settings=primaryHoverType=2,…`), and a Linux CI runner reports
|
|
76
|
-
// none: every later story in the page found `(hover: none)` (qorus#646).
|
|
77
|
-
//
|
|
78
|
-
// Playwright launches Chromium with `--hide-scrollbars`, so a scrollbar takes no room in the other
|
|
79
|
-
// projects, wherever the browser runs. Without it, Chromium on Linux (the CI runner) draws classic
|
|
80
|
-
// 15px scrollbars, as Linux, Windows and a Mac set to always show them do: a layout that has to
|
|
81
|
-
// leave room for one (a field measured while it draws one, qorus#646) is only seen there. A Mac
|
|
82
|
-
// that shows its scrollbars as it scrolls draws them over the content, so there they take no room.
|
|
83
|
-
//
|
|
84
|
-
// A Chromium that takes its language from the POSIX locale (LC_ALL, then LANG: C, C.UTF-8, POSIX
|
|
85
|
-
// or none, as in most Linux containers) reports `navigator.language` as `en-US@posix`, which is
|
|
86
|
-
// no BCP 47 tag: `Intl` throws on it (qorus#646). Not every build does: the arm64 Linux one does,
|
|
87
|
-
// and the amd64 Linux one the CI runs reports `en-US` whatever the locale or `--lang` says, as a
|
|
88
|
-
// Mac's takes the system's. So the `posix-locale` project does not ask the platform for it: its
|
|
89
|
-
// context is given the language itself (`locale`), which Chromium then reports as it is, Intl's
|
|
90
|
-
// default locale following it, on every platform and build.
|
|
91
|
-
provider: playwright({
|
|
92
|
-
...(kind === 'scrollbars'
|
|
93
|
-
? { launchOptions: { ignoreDefaultArgs: ['--hide-scrollbars'] } }
|
|
94
|
-
: {}),
|
|
95
|
-
contextOptions:
|
|
96
|
-
kind === 'phone'
|
|
97
|
-
? { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true }
|
|
98
|
-
: {
|
|
99
|
-
viewport: { width: 1920, height: 1080 },
|
|
100
|
-
...(kind === 'posix-locale' ? { locale: POSIX_LANGUAGE } : {}),
|
|
101
|
-
},
|
|
102
|
-
}),
|
|
103
|
-
/* Asks for reduced motion (`prefers-reduced-motion: reduce`) or stops asking, in the page the stories run in.
|
|
104
|
-
Reqore honours it: its springs settle at once and its transitions take no time. The contrast gate asks for it
|
|
105
|
-
while it measures, so it measures what stays on screen, never a frame of a fade (qorus#646: a clear button
|
|
106
|
-
measured on its way in); a story tagged `reduced-motion` runs under it (.storybook/vitest.setup.ts). */
|
|
107
|
-
commands: {
|
|
108
|
-
emulateReducedMotion: (async ({ page }, reduce) => {
|
|
109
|
-
await page.emulateMedia({ reducedMotion: reduce ? 'reduce' : 'no-preference' });
|
|
110
|
-
}) satisfies BrowserCommand<[reduce: boolean]>,
|
|
111
|
-
},
|
|
112
|
-
headless: true,
|
|
113
|
-
instances: [{ browser: 'chromium' as const }],
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const storyTest = {
|
|
117
|
-
setupFiles: ['./.storybook/vitest.setup.ts'],
|
|
118
|
-
// Some interaction stories deliberately render slow content and the shared
|
|
119
|
-
// play-function helpers wait up to ~17s; give them headroom.
|
|
120
|
-
testTimeout: 30000,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export default mergeConfig(
|
|
124
|
-
viteConfig,
|
|
125
|
-
defineConfig({
|
|
126
|
-
/* The story run prints what its browsers log the same way whoever runs it. Vite forwards a browser's console
|
|
127
|
-
and its unhandled errors to the terminal by default only when an AI agent runs it (std-env's isAgent), so an
|
|
128
|
-
agent's run printed what CI's never did - an Error Boundary story's error, which React in development reports
|
|
129
|
-
as uncaught after the boundary caught it. What a story logs is the warning gate's to judge, and it fails a
|
|
130
|
-
story for any warning or error it did not expect (`.storybook/vitest.setup.ts`). */
|
|
131
|
-
server: { forwardConsole: false },
|
|
132
|
-
test: {
|
|
133
|
-
projects: [
|
|
134
|
-
// Component/interaction tests: run every story in a real browser via Playwright.
|
|
135
|
-
// Replaces the former @storybook/test-runner.
|
|
136
|
-
//
|
|
137
|
-
// Stories run in four projects, each in a browser of its own kind (see `storyBrowser`): every story
|
|
138
|
-
// on a desktop with a mouse, but those tagged `touch`, which run on a phone; those tagged
|
|
139
|
-
// `scrollbars` run again on a desktop that draws its scrollbars, and those tagged `posix-locale` on a
|
|
140
|
-
// desktop whose locale is POSIX. `.storybook/vitest.setup.ts` checks each story's browser is the one
|
|
141
|
-
// its project promises.
|
|
142
|
-
{
|
|
143
|
-
extends: true,
|
|
144
|
-
plugins: [
|
|
145
|
-
qlip,
|
|
146
|
-
storybookTest({
|
|
147
|
-
configDir: path.join(dirname, '.storybook'),
|
|
148
|
-
storybookScript: 'yarn storybook --no-open',
|
|
149
|
-
tags: { exclude: ['touch'] },
|
|
150
|
-
}),
|
|
151
|
-
],
|
|
152
|
-
test: {
|
|
153
|
-
name: 'storybook',
|
|
154
|
-
// after the stories on the phone: each story here checks it still has its mouse
|
|
155
|
-
sequence: { groupOrder: 1 },
|
|
156
|
-
browser: storyBrowser('desktop'),
|
|
157
|
-
...storyTest,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
// The stories tagged `touch`, on the phone. Before the others, not beside them: the two projects share
|
|
161
|
-
// Storybook's dependency cache (it is named after the config directory), which is not built twice at
|
|
162
|
-
// once.
|
|
163
|
-
{
|
|
164
|
-
extends: true,
|
|
165
|
-
plugins: [
|
|
166
|
-
qlip,
|
|
167
|
-
storybookTest({
|
|
168
|
-
configDir: path.join(dirname, '.storybook'),
|
|
169
|
-
storybookScript: 'yarn storybook --no-open',
|
|
170
|
-
tags: { include: ['touch'] },
|
|
171
|
-
}),
|
|
172
|
-
],
|
|
173
|
-
test: {
|
|
174
|
-
name: 'storybook-touch',
|
|
175
|
-
exclude: [...configDefaults.exclude, ...storyFilesWithoutTag('touch')],
|
|
176
|
-
sequence: { groupOrder: 0 },
|
|
177
|
-
browser: storyBrowser('phone'),
|
|
178
|
-
...storyTest,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
// The stories tagged `scrollbars` again, on a desktop that draws its scrollbars: those that check a
|
|
182
|
-
// layout leaves room for a scrollbar, or is not narrowed by one. After the others, for the same
|
|
183
|
-
// dependency cache. No qlip: their frames are the desktop project's, and a scrollbar drawn or not
|
|
184
|
-
// differs from machine to machine.
|
|
185
|
-
{
|
|
186
|
-
extends: true,
|
|
187
|
-
plugins: [
|
|
188
|
-
storybookTest({
|
|
189
|
-
configDir: path.join(dirname, '.storybook'),
|
|
190
|
-
storybookScript: 'yarn storybook --no-open',
|
|
191
|
-
// a phone's scrollbars are drawn over the content: a story on the phone has none to check
|
|
192
|
-
tags: { include: ['scrollbars'], exclude: ['touch'] },
|
|
193
|
-
}),
|
|
194
|
-
],
|
|
195
|
-
test: {
|
|
196
|
-
name: 'storybook-scrollbars',
|
|
197
|
-
exclude: [...configDefaults.exclude, ...storyFilesWithoutTag('scrollbars')],
|
|
198
|
-
sequence: { groupOrder: 2 },
|
|
199
|
-
browser: storyBrowser('scrollbars'),
|
|
200
|
-
...storyTest,
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
// The stories tagged `posix-locale` again, on a desktop whose locale is POSIX: those that hand
|
|
204
|
-
// the browser's language to `Intl`. After the others, for the same dependency cache. No qlip:
|
|
205
|
-
// their frames are the desktop project's.
|
|
206
|
-
{
|
|
207
|
-
extends: true,
|
|
208
|
-
plugins: [
|
|
209
|
-
storybookTest({
|
|
210
|
-
configDir: path.join(dirname, '.storybook'),
|
|
211
|
-
storybookScript: 'yarn storybook --no-open',
|
|
212
|
-
// a touch story runs on the phone only (`.storybook/vitest.setup.ts`)
|
|
213
|
-
tags: { include: ['posix-locale'], exclude: ['touch'] },
|
|
214
|
-
}),
|
|
215
|
-
],
|
|
216
|
-
test: {
|
|
217
|
-
name: 'storybook-posix-locale',
|
|
218
|
-
exclude: [...configDefaults.exclude, ...storyFilesWithoutTag('posix-locale')],
|
|
219
|
-
sequence: { groupOrder: 3 },
|
|
220
|
-
browser: storyBrowser('posix-locale'),
|
|
221
|
-
...storyTest,
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
// Unit tests: the former Jest suite, now on Vitest + jsdom.
|
|
225
|
-
{
|
|
226
|
-
extends: true,
|
|
227
|
-
test: {
|
|
228
|
-
name: 'unit',
|
|
229
|
-
globals: true,
|
|
230
|
-
environment: 'jsdom',
|
|
231
|
-
include: ['__tests__/**/*.test.{ts,tsx}'],
|
|
232
|
-
setupFiles: ['./__tests__/setup.ts'],
|
|
233
|
-
// The former Jest suite raised the timeout to 30s for the heavier
|
|
234
|
-
// data-grid/pagination tests via jest.setTimeout(); match that globally.
|
|
235
|
-
testTimeout: 30000,
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
},
|
|
240
|
-
})
|
|
241
|
-
);
|