@blotch/dolan 0.0.0-stage → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/add.d.ts +22 -0
- package/dist/commands/add.js +132 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/add.test.d.ts +1 -0
- package/dist/commands/add.test.js +209 -0
- package/dist/commands/add.test.js.map +1 -0
- package/dist/commands/diff.d.ts +13 -0
- package/dist/commands/diff.js +155 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/diff.test.d.ts +1 -0
- package/dist/commands/diff.test.js +327 -0
- package/dist/commands/diff.test.js.map +1 -0
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/doctor.js +248 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/doctor.test.d.ts +1 -0
- package/dist/commands/doctor.test.js +301 -0
- package/dist/commands/doctor.test.js.map +1 -0
- package/dist/commands/eject.d.ts +11 -0
- package/dist/commands/eject.js +55 -0
- package/dist/commands/eject.js.map +1 -0
- package/dist/commands/eject.test.d.ts +1 -0
- package/dist/commands/eject.test.js +151 -0
- package/dist/commands/eject.test.js.map +1 -0
- package/dist/commands/info.d.ts +1 -0
- package/dist/commands/info.js +73 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/info.test.d.ts +1 -0
- package/dist/commands/info.test.js +143 -0
- package/dist/commands/info.test.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +98 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/init.test.d.ts +1 -0
- package/dist/commands/init.test.js +154 -0
- package/dist/commands/init.test.js.map +1 -0
- package/dist/commands/list.d.ts +16 -0
- package/dist/commands/list.js +124 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/list.test.d.ts +1 -0
- package/dist/commands/list.test.js +285 -0
- package/dist/commands/list.test.js.map +1 -0
- package/dist/commands/outdated.d.ts +13 -0
- package/dist/commands/outdated.js +116 -0
- package/dist/commands/outdated.js.map +1 -0
- package/dist/commands/outdated.test.d.ts +1 -0
- package/dist/commands/outdated.test.js +208 -0
- package/dist/commands/outdated.test.js.map +1 -0
- package/dist/commands/remove.d.ts +18 -0
- package/dist/commands/remove.js +161 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/remove.test.d.ts +1 -0
- package/dist/commands/remove.test.js +361 -0
- package/dist/commands/remove.test.js.map +1 -0
- package/dist/commands/theme.d.ts +1 -0
- package/dist/commands/theme.js +66 -0
- package/dist/commands/theme.js.map +1 -0
- package/dist/commands/theme.test.d.ts +1 -0
- package/dist/commands/theme.test.js +133 -0
- package/dist/commands/theme.test.js.map +1 -0
- package/dist/commands/update.d.ts +31 -0
- package/dist/commands/update.js +601 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/update.test.d.ts +1 -0
- package/dist/commands/update.test.js +1233 -0
- package/dist/commands/update.test.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +19 -0
- package/dist/config.js.map +1 -0
- package/dist/config.test.d.ts +1 -0
- package/dist/config.test.js +48 -0
- package/dist/config.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/lockfile.d.ts +21 -0
- package/dist/lockfile.js +39 -0
- package/dist/lockfile.js.map +1 -0
- package/dist/registry.d.ts +14 -0
- package/dist/registry.js +85 -0
- package/dist/registry.js.map +1 -0
- package/dist/registry.test.d.ts +1 -0
- package/dist/registry.test.js +95 -0
- package/dist/registry.test.js.map +1 -0
- package/dist/test-utils.d.ts +16 -0
- package/dist/test-utils.js +65 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/ui/components/accordion/accordion.test.ts +194 -0
- package/dist/ui/components/accordion/accordion.ts +173 -0
- package/dist/ui/components/accordion/index.ts +6 -0
- package/dist/ui/components/action-sheet/action-sheet.test.ts +211 -0
- package/dist/ui/components/action-sheet/action-sheet.ts +353 -0
- package/dist/ui/components/action-sheet/index.ts +6 -0
- package/dist/ui/components/alert/alert.test.ts +48 -0
- package/dist/ui/components/alert/alert.ts +104 -0
- package/dist/ui/components/alert/index.ts +1 -0
- package/dist/ui/components/alert-dialog/alert-dialog.test.ts +141 -0
- package/dist/ui/components/alert-dialog/alert-dialog.ts +243 -0
- package/dist/ui/components/alert-dialog/index.ts +7 -0
- package/dist/ui/components/area-chart/area-chart-render.test.ts +121 -0
- package/dist/ui/components/area-chart/area-chart.test.ts +158 -0
- package/dist/ui/components/area-chart/area-chart.ts +349 -0
- package/dist/ui/components/area-chart/index.ts +6 -0
- package/dist/ui/components/aspect-ratio/aspect-ratio.test.ts +10 -0
- package/dist/ui/components/aspect-ratio/aspect-ratio.ts +28 -0
- package/dist/ui/components/aspect-ratio/index.ts +1 -0
- package/dist/ui/components/avatar/avatar.test.ts +69 -0
- package/dist/ui/components/avatar/avatar.ts +131 -0
- package/dist/ui/components/avatar/index.ts +1 -0
- package/dist/ui/components/badge/badge.test.ts +49 -0
- package/dist/ui/components/badge/badge.ts +97 -0
- package/dist/ui/components/badge/index.ts +1 -0
- package/dist/ui/components/bar-chart/bar-chart-render.test.ts +174 -0
- package/dist/ui/components/bar-chart/bar-chart.test.ts +73 -0
- package/dist/ui/components/bar-chart/bar-chart.ts +327 -0
- package/dist/ui/components/bar-chart/index.ts +6 -0
- package/dist/ui/components/bottom-sheet/bottom-sheet.test.ts +163 -0
- package/dist/ui/components/bottom-sheet/bottom-sheet.ts +339 -0
- package/dist/ui/components/bottom-sheet/index.ts +1 -0
- package/dist/ui/components/button/button-render.test.ts +113 -0
- package/dist/ui/components/button/button.test.ts +70 -0
- package/dist/ui/components/button/button.ts +170 -0
- package/dist/ui/components/button/index.ts +6 -0
- package/dist/ui/components/button-group/button-group-render.test.ts +146 -0
- package/dist/ui/components/button-group/button-group.test.ts +54 -0
- package/dist/ui/components/button-group/button-group.ts +209 -0
- package/dist/ui/components/button-group/index.ts +8 -0
- package/dist/ui/components/candlestick-chart/candlestick-chart-render.test.ts +174 -0
- package/dist/ui/components/candlestick-chart/candlestick-chart.test.ts +96 -0
- package/dist/ui/components/candlestick-chart/candlestick-chart.ts +355 -0
- package/dist/ui/components/candlestick-chart/index.ts +7 -0
- package/dist/ui/components/card/card.test.ts +110 -0
- package/dist/ui/components/card/card.ts +162 -0
- package/dist/ui/components/card/index.ts +8 -0
- package/dist/ui/components/cartesian-chart/cartesian-chart-render.test.ts +188 -0
- package/dist/ui/components/cartesian-chart/cartesian-chart.test.ts +549 -0
- package/dist/ui/components/cartesian-chart/cartesian-chart.ts +1140 -0
- package/dist/ui/components/cartesian-chart/index.ts +18 -0
- package/dist/ui/components/checkbox/checkbox.test.ts +59 -0
- package/dist/ui/components/checkbox/checkbox.ts +96 -0
- package/dist/ui/components/checkbox/index.ts +1 -0
- package/dist/ui/components/collapsible/collapsible.test.ts +112 -0
- package/dist/ui/components/collapsible/collapsible.ts +122 -0
- package/dist/ui/components/collapsible/index.ts +5 -0
- package/dist/ui/components/dialog/dialog.test.ts +157 -0
- package/dist/ui/components/dialog/dialog.ts +248 -0
- package/dist/ui/components/dialog/index.ts +7 -0
- package/dist/ui/components/empty-state/empty-state.test.ts +60 -0
- package/dist/ui/components/empty-state/empty-state.ts +46 -0
- package/dist/ui/components/empty-state/index.ts +1 -0
- package/dist/ui/components/icon/icon.test.ts +52 -0
- package/dist/ui/components/icon/icon.ts +54 -0
- package/dist/ui/components/icon/icons.ts +569 -0
- package/dist/ui/components/icon/index.ts +2 -0
- package/dist/ui/components/input/index.ts +1 -0
- package/dist/ui/components/input/input.test.ts +134 -0
- package/dist/ui/components/input/input.ts +189 -0
- package/dist/ui/components/label/index.ts +1 -0
- package/dist/ui/components/label/label.test.ts +38 -0
- package/dist/ui/components/label/label.ts +24 -0
- package/dist/ui/components/line-chart/index.ts +6 -0
- package/dist/ui/components/line-chart/line-chart-render.test.ts +121 -0
- package/dist/ui/components/line-chart/line-chart.test.ts +81 -0
- package/dist/ui/components/line-chart/line-chart.ts +273 -0
- package/dist/ui/components/list/index.ts +1 -0
- package/dist/ui/components/list/list.test.ts +35 -0
- package/dist/ui/components/list/list.ts +71 -0
- package/dist/ui/components/nav-drawer/index.ts +8 -0
- package/dist/ui/components/nav-drawer/nav-drawer.test.ts +267 -0
- package/dist/ui/components/nav-drawer/nav-drawer.ts +504 -0
- package/dist/ui/components/pagination/index.ts +1 -0
- package/dist/ui/components/pagination/pagination.test.ts +96 -0
- package/dist/ui/components/pagination/pagination.ts +147 -0
- package/dist/ui/components/progress/index.ts +1 -0
- package/dist/ui/components/progress/progress.test.ts +71 -0
- package/dist/ui/components/progress/progress.ts +118 -0
- package/dist/ui/components/radio-group/index.ts +1 -0
- package/dist/ui/components/radio-group/radio-group.test.ts +115 -0
- package/dist/ui/components/radio-group/radio-group.ts +129 -0
- package/dist/ui/components/scatter-chart/index.ts +6 -0
- package/dist/ui/components/scatter-chart/scatter-chart-render.test.ts +157 -0
- package/dist/ui/components/scatter-chart/scatter-chart.test.ts +57 -0
- package/dist/ui/components/scatter-chart/scatter-chart.ts +277 -0
- package/dist/ui/components/scroll-area/index.ts +1 -0
- package/dist/ui/components/scroll-area/scroll-area.test.ts +40 -0
- package/dist/ui/components/scroll-area/scroll-area.ts +73 -0
- package/dist/ui/components/select/index.ts +1 -0
- package/dist/ui/components/select/select.test.ts +107 -0
- package/dist/ui/components/select/select.ts +146 -0
- package/dist/ui/components/separator/index.ts +1 -0
- package/dist/ui/components/separator/separator.test.ts +26 -0
- package/dist/ui/components/separator/separator.ts +45 -0
- package/dist/ui/components/sheet/index.ts +7 -0
- package/dist/ui/components/sheet/sheet.test.ts +44 -0
- package/dist/ui/components/sheet/sheet.ts +114 -0
- package/dist/ui/components/skeleton/index.ts +1 -0
- package/dist/ui/components/skeleton/skeleton.test.ts +13 -0
- package/dist/ui/components/skeleton/skeleton.ts +45 -0
- package/dist/ui/components/spinner/index.ts +1 -0
- package/dist/ui/components/spinner/spinner.test.ts +39 -0
- package/dist/ui/components/spinner/spinner.ts +83 -0
- package/dist/ui/components/switch/index.ts +1 -0
- package/dist/ui/components/switch/switch.test.ts +63 -0
- package/dist/ui/components/switch/switch.ts +98 -0
- package/dist/ui/components/tabs/index.ts +1 -0
- package/dist/ui/components/tabs/tabs.test.ts +199 -0
- package/dist/ui/components/tabs/tabs.ts +317 -0
- package/dist/ui/components/textarea/index.ts +1 -0
- package/dist/ui/components/textarea/textarea.test.ts +138 -0
- package/dist/ui/components/textarea/textarea.ts +221 -0
- package/dist/ui/components/toast/index.ts +9 -0
- package/dist/ui/components/toast/toast-state.test.ts +54 -0
- package/dist/ui/components/toast/toast-state.ts +46 -0
- package/dist/ui/components/toast/toast.test.ts +342 -0
- package/dist/ui/components/toast/toast.ts +527 -0
- package/dist/ui/components/toggle/index.ts +7 -0
- package/dist/ui/components/toggle/toggle.test.ts +186 -0
- package/dist/ui/components/toggle/toggle.ts +218 -0
- package/dist/ui/components/typography/index.ts +5 -0
- package/dist/ui/components/typography/typography.test.ts +55 -0
- package/dist/ui/components/typography/typography.ts +44 -0
- package/dist/ui/theme/dark.css +41 -0
- package/dist/ui/theme/default.css +56 -0
- package/dist/ui/theme/tailwind-plugin.test.ts +124 -0
- package/dist/ui/theme/tailwind-plugin.ts +151 -0
- package/dist/ui/utils/animate.test.ts +324 -0
- package/dist/ui/utils/animate.ts +544 -0
- package/dist/ui/utils/cn.test.ts +27 -0
- package/dist/ui/utils/cn.ts +6 -0
- package/dist/utils/analyze.d.ts +32 -0
- package/dist/utils/analyze.js +109 -0
- package/dist/utils/analyze.js.map +1 -0
- package/dist/utils/analyze.test.d.ts +1 -0
- package/dist/utils/analyze.test.js +146 -0
- package/dist/utils/analyze.test.js.map +1 -0
- package/dist/utils/animate.d.ts +210 -0
- package/dist/utils/animate.js +423 -0
- package/dist/utils/animate.js.map +1 -0
- package/dist/utils/animate.test.d.ts +1 -0
- package/dist/utils/animate.test.js +365 -0
- package/dist/utils/animate.test.js.map +1 -0
- package/dist/utils/banner.d.ts +1 -0
- package/dist/utils/banner.js +15 -0
- package/dist/utils/banner.js.map +1 -0
- package/dist/utils/banner.test.d.ts +1 -0
- package/dist/utils/banner.test.js +29 -0
- package/dist/utils/banner.test.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/cn.test.d.ts +1 -0
- package/dist/utils/cn.test.js +21 -0
- package/dist/utils/cn.test.js.map +1 -0
- package/dist/utils/format.d.ts +31 -0
- package/dist/utils/format.js +95 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/format.test.d.ts +1 -0
- package/dist/utils/format.test.js +71 -0
- package/dist/utils/format.test.js.map +1 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/logger.js +16 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/logger.test.d.ts +1 -0
- package/dist/utils/logger.test.js +36 -0
- package/dist/utils/logger.test.js.map +1 -0
- package/dist/utils/resolve-paths.d.ts +12 -0
- package/dist/utils/resolve-paths.js +29 -0
- package/dist/utils/resolve-paths.js.map +1 -0
- package/dist/utils/resolve-paths.test.d.ts +1 -0
- package/dist/utils/resolve-paths.test.js +52 -0
- package/dist/utils/resolve-paths.test.js.map +1 -0
- package/package.json +56 -4
- package/README.md +0 -3
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { fadeIn, fadeOut, scaleIn, scaleOut, slideIn, slideOut, popIn, popOut, pulse, shake, springTranslateX, revealIn, directionalSlideIn, overlayOpen, overlayClose, pressDown, pressRelease, DURATION, EASING, SCALE, } from './animate';
|
|
3
|
+
/**
|
|
4
|
+
* The real Lynx element only needs an `animate()` method for the wrapper
|
|
5
|
+
* helpers below — everything else about the element is irrelevant to them.
|
|
6
|
+
* The mock returns a cancelable handle (mirroring the real API) so callers
|
|
7
|
+
* that store/inspect the return value have something realistic to work with.
|
|
8
|
+
*/
|
|
9
|
+
const createAnimateEl = () => ({
|
|
10
|
+
animate: vi.fn().mockReturnValue({ cancel: vi.fn() }),
|
|
11
|
+
});
|
|
12
|
+
const guardedCases = [
|
|
13
|
+
{
|
|
14
|
+
name: 'fadeIn',
|
|
15
|
+
call: fadeIn,
|
|
16
|
+
overrideOptions: { duration: 999, easing: 'linear', fill: 'both' },
|
|
17
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
18
|
+
defaultConfig: {
|
|
19
|
+
duration: DURATION.normal,
|
|
20
|
+
easing: EASING.decelerate,
|
|
21
|
+
fill: 'forwards',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'fadeOut',
|
|
26
|
+
call: fadeOut,
|
|
27
|
+
overrideOptions: { duration: 999, easing: 'linear', fill: 'both' },
|
|
28
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
29
|
+
defaultConfig: {
|
|
30
|
+
duration: DURATION.fast,
|
|
31
|
+
easing: EASING.accelerate,
|
|
32
|
+
fill: 'forwards',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'scaleIn',
|
|
37
|
+
call: scaleIn,
|
|
38
|
+
overrideOptions: {
|
|
39
|
+
duration: 999,
|
|
40
|
+
easing: 'linear',
|
|
41
|
+
fill: 'both',
|
|
42
|
+
fromScale: 0.5,
|
|
43
|
+
fromY: 40,
|
|
44
|
+
},
|
|
45
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
46
|
+
defaultConfig: {
|
|
47
|
+
duration: DURATION.slow,
|
|
48
|
+
easing: EASING.springSubtle,
|
|
49
|
+
fill: 'forwards',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'scaleOut',
|
|
54
|
+
call: scaleOut,
|
|
55
|
+
overrideOptions: {
|
|
56
|
+
duration: 999,
|
|
57
|
+
easing: 'linear',
|
|
58
|
+
fill: 'both',
|
|
59
|
+
toScale: 0.5,
|
|
60
|
+
toY: 40,
|
|
61
|
+
},
|
|
62
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
63
|
+
defaultConfig: {
|
|
64
|
+
duration: DURATION.fast,
|
|
65
|
+
easing: EASING.accelerate,
|
|
66
|
+
fill: 'forwards',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'popIn',
|
|
71
|
+
call: popIn,
|
|
72
|
+
overrideOptions: {
|
|
73
|
+
duration: 999,
|
|
74
|
+
easing: 'linear',
|
|
75
|
+
fill: 'both',
|
|
76
|
+
fromScale: 0.2,
|
|
77
|
+
},
|
|
78
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
79
|
+
defaultConfig: {
|
|
80
|
+
duration: DURATION.fast,
|
|
81
|
+
easing: EASING.spring,
|
|
82
|
+
fill: 'forwards',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'popOut',
|
|
87
|
+
call: popOut,
|
|
88
|
+
overrideOptions: {
|
|
89
|
+
duration: 999,
|
|
90
|
+
easing: 'linear',
|
|
91
|
+
fill: 'both',
|
|
92
|
+
toScale: 0.2,
|
|
93
|
+
},
|
|
94
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
95
|
+
defaultConfig: {
|
|
96
|
+
duration: DURATION.instant,
|
|
97
|
+
easing: EASING.accelerate,
|
|
98
|
+
fill: 'forwards',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'springTranslateX',
|
|
103
|
+
// fromX/toX are required positional args unrelated to `options`; pin
|
|
104
|
+
// them to fixed values so only the options behavior varies per case.
|
|
105
|
+
call: (el, options) => springTranslateX(el, 0, 100, options),
|
|
106
|
+
overrideOptions: { duration: 999, easing: 'linear', fill: 'both' },
|
|
107
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
108
|
+
defaultConfig: { duration: 200, easing: EASING.spring, fill: 'forwards' },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'revealIn',
|
|
112
|
+
call: revealIn,
|
|
113
|
+
overrideOptions: {
|
|
114
|
+
duration: 999,
|
|
115
|
+
easing: 'linear',
|
|
116
|
+
fill: 'both',
|
|
117
|
+
fromY: 40,
|
|
118
|
+
},
|
|
119
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
120
|
+
defaultConfig: {
|
|
121
|
+
duration: DURATION.normal,
|
|
122
|
+
easing: EASING.decelerate,
|
|
123
|
+
fill: 'forwards',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'directionalSlideIn',
|
|
128
|
+
call: (el, options) => directionalSlideIn(el, 1, options),
|
|
129
|
+
overrideOptions: {
|
|
130
|
+
duration: 999,
|
|
131
|
+
easing: 'linear',
|
|
132
|
+
fill: 'both',
|
|
133
|
+
distance: 50,
|
|
134
|
+
},
|
|
135
|
+
expectedConfig: { duration: 999, easing: 'linear', fill: 'both' },
|
|
136
|
+
defaultConfig: {
|
|
137
|
+
duration: DURATION.slow,
|
|
138
|
+
easing: EASING.springSubtle,
|
|
139
|
+
fill: 'forwards',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
describe.each(guardedCases)('$name', ({ call, overrideOptions, expectedConfig, defaultConfig }) => {
|
|
144
|
+
it('returns undefined and does not throw when el is falsy', () => {
|
|
145
|
+
expect(call(undefined)).toBeUndefined();
|
|
146
|
+
});
|
|
147
|
+
it('calls el.animate() with default values when no options are given', () => {
|
|
148
|
+
const el = createAnimateEl();
|
|
149
|
+
call(el);
|
|
150
|
+
expect(el.animate).toHaveBeenCalledTimes(1);
|
|
151
|
+
// Second arg to el.animate() is always the { duration, easing, fill }
|
|
152
|
+
// config object — checking it confirms every `?? DEFAULT` fired.
|
|
153
|
+
expect(el.animate.mock.calls[0][1]).toEqual(defaultConfig);
|
|
154
|
+
});
|
|
155
|
+
it('calls el.animate() with the provided options overriding every default', () => {
|
|
156
|
+
const el = createAnimateEl();
|
|
157
|
+
call(el, overrideOptions);
|
|
158
|
+
expect(el.animate).toHaveBeenCalledTimes(1);
|
|
159
|
+
expect(el.animate.mock.calls[0][1]).toEqual(expectedConfig);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// pulse — shares the "guarded" shape but its options type only has
|
|
164
|
+
// `duration` (no easing/fill), and the config includes a fixed `iterations:
|
|
165
|
+
// Infinity` for the indefinite loop, so it doesn't fit the generic table.
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
describe('pulse', () => {
|
|
168
|
+
it('returns undefined when el is falsy', () => {
|
|
169
|
+
expect(pulse(undefined)).toBeUndefined();
|
|
170
|
+
});
|
|
171
|
+
it('defaults to a 1500ms ease-in-out loop', () => {
|
|
172
|
+
const el = createAnimateEl();
|
|
173
|
+
pulse(el);
|
|
174
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
175
|
+
duration: 1500,
|
|
176
|
+
easing: 'ease-in-out',
|
|
177
|
+
iterations: Infinity,
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
it('honors an explicit duration', () => {
|
|
181
|
+
const el = createAnimateEl();
|
|
182
|
+
pulse(el, { duration: 3000 });
|
|
183
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
184
|
+
duration: 3000,
|
|
185
|
+
easing: 'ease-in-out',
|
|
186
|
+
iterations: Infinity,
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// shake — also "guarded", but `fill` is hardcoded to 'forwards' rather than
|
|
192
|
+
// read from options, so there is no `?? ` branch for it (unlike every other
|
|
193
|
+
// AnimateOptions consumer). Passing `fill: 'both'` below is deliberate: it
|
|
194
|
+
// proves the value is ignored rather than accidentally leaking through.
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
describe('shake', () => {
|
|
197
|
+
it('returns undefined when el is falsy', () => {
|
|
198
|
+
expect(shake(undefined)).toBeUndefined();
|
|
199
|
+
});
|
|
200
|
+
it('defaults duration and easing', () => {
|
|
201
|
+
const el = createAnimateEl();
|
|
202
|
+
shake(el);
|
|
203
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
204
|
+
duration: DURATION.slow,
|
|
205
|
+
easing: EASING.standard,
|
|
206
|
+
fill: 'forwards',
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
it('honors explicit duration/easing but always fills forwards', () => {
|
|
210
|
+
const el = createAnimateEl();
|
|
211
|
+
shake(el, { duration: 999, easing: 'linear', fill: 'both' });
|
|
212
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
213
|
+
duration: 999,
|
|
214
|
+
easing: 'linear',
|
|
215
|
+
fill: 'forwards',
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
// ---------------------------------------------------------------------------
|
|
220
|
+
// slideIn / slideOut — guarded like the table above, but the direction is
|
|
221
|
+
// resolved via an object-literal lookup (`{ up: ..., down: ... }[direction]`)
|
|
222
|
+
// rather than an if/else, so a single direction is enough for branch
|
|
223
|
+
// coverage. All four are still exercised for behavioral thoroughness since
|
|
224
|
+
// each call is cheap and documents the intended keyframes per direction.
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
describe('slideIn', () => {
|
|
227
|
+
it('returns undefined when el is falsy', () => {
|
|
228
|
+
expect(slideIn(undefined, 'up')).toBeUndefined();
|
|
229
|
+
});
|
|
230
|
+
it.each(['up', 'down', 'left', 'right'])('animates the %s direction with default options', (direction) => {
|
|
231
|
+
const el = createAnimateEl();
|
|
232
|
+
slideIn(el, direction);
|
|
233
|
+
expect(el.animate).toHaveBeenCalledTimes(1);
|
|
234
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
235
|
+
duration: DURATION.slow,
|
|
236
|
+
easing: EASING.sheet,
|
|
237
|
+
fill: 'forwards',
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
it('honors explicit options', () => {
|
|
241
|
+
const el = createAnimateEl();
|
|
242
|
+
slideIn(el, 'left', { duration: 999, easing: 'linear', fill: 'both' });
|
|
243
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
244
|
+
duration: 999,
|
|
245
|
+
easing: 'linear',
|
|
246
|
+
fill: 'both',
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
describe('slideOut', () => {
|
|
251
|
+
it('returns undefined when el is falsy', () => {
|
|
252
|
+
expect(slideOut(undefined, 'up')).toBeUndefined();
|
|
253
|
+
});
|
|
254
|
+
it.each(['up', 'down', 'left', 'right'])('animates the %s direction with default options', (direction) => {
|
|
255
|
+
const el = createAnimateEl();
|
|
256
|
+
slideOut(el, direction);
|
|
257
|
+
expect(el.animate).toHaveBeenCalledTimes(1);
|
|
258
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
259
|
+
duration: DURATION.normal,
|
|
260
|
+
easing: EASING.accelerate,
|
|
261
|
+
fill: 'forwards',
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
it('honors explicit options', () => {
|
|
265
|
+
const el = createAnimateEl();
|
|
266
|
+
slideOut(el, 'right', { duration: 999, easing: 'linear', fill: 'both' });
|
|
267
|
+
expect(el.animate.mock.calls[0][1]).toEqual({
|
|
268
|
+
duration: 999,
|
|
269
|
+
easing: 'linear',
|
|
270
|
+
fill: 'both',
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
// ---------------------------------------------------------------------------
|
|
275
|
+
// overlayOpen / overlayClose — real if/else-if/else branches per `type`
|
|
276
|
+
// (unlike the object-literal lookups above), so all four values must be
|
|
277
|
+
// exercised to hit every branch.
|
|
278
|
+
// ---------------------------------------------------------------------------
|
|
279
|
+
describe('overlayOpen', () => {
|
|
280
|
+
beforeEach(() => {
|
|
281
|
+
vi.useFakeTimers();
|
|
282
|
+
});
|
|
283
|
+
afterEach(() => {
|
|
284
|
+
vi.useRealTimers();
|
|
285
|
+
});
|
|
286
|
+
it.each(['center', 'bottom', 'left', 'right'])('schedules the panel animation for type=%s after the 30ms stagger', (type) => {
|
|
287
|
+
const backdrop = createAnimateEl();
|
|
288
|
+
const panel = createAnimateEl();
|
|
289
|
+
const result = overlayOpen(backdrop, panel, type);
|
|
290
|
+
// Backdrop fades in synchronously, before the stagger.
|
|
291
|
+
expect(backdrop.animate).toHaveBeenCalledTimes(1);
|
|
292
|
+
expect(result.backdrop).toBeDefined();
|
|
293
|
+
// Panel animation is deferred behind setTimeout(..., 30) — it must not
|
|
294
|
+
// have run yet, which is what makes this the branch under test rather
|
|
295
|
+
// than a duplicate of the scaleIn/slideIn unit tests above.
|
|
296
|
+
expect(panel.animate).not.toHaveBeenCalled();
|
|
297
|
+
vi.advanceTimersByTime(30);
|
|
298
|
+
// Firing the timer exercises the matching if/else-if/else arm for
|
|
299
|
+
// `type` inside the callback (scaleIn for 'center', slideIn otherwise).
|
|
300
|
+
expect(panel.animate).toHaveBeenCalledTimes(1);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe('overlayClose', () => {
|
|
304
|
+
const cases = [
|
|
305
|
+
['center', 180],
|
|
306
|
+
['bottom', DURATION.normal],
|
|
307
|
+
['left', DURATION.normal],
|
|
308
|
+
['right', DURATION.normal],
|
|
309
|
+
];
|
|
310
|
+
it.each(cases)('animates type=%s and returns duration %i', (type, expectedDuration) => {
|
|
311
|
+
const backdrop = createAnimateEl();
|
|
312
|
+
const panel = createAnimateEl();
|
|
313
|
+
const duration = overlayClose(backdrop, panel, type);
|
|
314
|
+
// Panel exit animation and backdrop fade both run synchronously.
|
|
315
|
+
expect(panel.animate).toHaveBeenCalledTimes(1);
|
|
316
|
+
expect(backdrop.animate).toHaveBeenCalledTimes(1);
|
|
317
|
+
expect(duration).toBe(expectedDuration);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
// ---------------------------------------------------------------------------
|
|
321
|
+
// pressDown / pressRelease (transitionTransform)
|
|
322
|
+
//
|
|
323
|
+
// transitionTransform is private, so it's only reachable through these two
|
|
324
|
+
// exports. It guards with `el?.setStyle`, which is a distinct branch from a
|
|
325
|
+
// plain `!el` check: it also returns undefined for a truthy object missing
|
|
326
|
+
// `setStyle`, not just for a nullish `el`.
|
|
327
|
+
// ---------------------------------------------------------------------------
|
|
328
|
+
describe('pressDown / pressRelease', () => {
|
|
329
|
+
it('pressDown returns undefined when el is undefined', () => {
|
|
330
|
+
expect(pressDown(undefined)).toBeUndefined();
|
|
331
|
+
});
|
|
332
|
+
it('pressRelease returns undefined when el is undefined', () => {
|
|
333
|
+
expect(pressRelease(undefined)).toBeUndefined();
|
|
334
|
+
});
|
|
335
|
+
it('pressDown returns undefined when el has no setStyle', () => {
|
|
336
|
+
// A truthy object with no setStyle exercises the `?.` short-circuit
|
|
337
|
+
// itself, as opposed to the `el` being nullish outright above.
|
|
338
|
+
expect(pressDown({})).toBeUndefined();
|
|
339
|
+
});
|
|
340
|
+
it('pressRelease returns undefined when el has no setStyle', () => {
|
|
341
|
+
expect(pressRelease({})).toBeUndefined();
|
|
342
|
+
});
|
|
343
|
+
it('pressDown applies the default press-down scale', () => {
|
|
344
|
+
const el = { setStyle: vi.fn() };
|
|
345
|
+
const handle = pressDown(el);
|
|
346
|
+
expect(el.setStyle).toHaveBeenNthCalledWith(1, 'transition', `transform ${DURATION.instant}ms ${EASING.standard}`);
|
|
347
|
+
expect(el.setStyle).toHaveBeenNthCalledWith(2, 'transform', `scale(${SCALE.pressDown})`);
|
|
348
|
+
// cancel() is a real (if intentionally empty) function body — invoke it
|
|
349
|
+
// so it registers for function coverage, not just declaration coverage.
|
|
350
|
+
expect(() => handle?.cancel()).not.toThrow();
|
|
351
|
+
});
|
|
352
|
+
it('pressDown accepts an explicit scale overriding the default', () => {
|
|
353
|
+
const el = { setStyle: vi.fn() };
|
|
354
|
+
pressDown(el, 0.5);
|
|
355
|
+
expect(el.setStyle).toHaveBeenNthCalledWith(2, 'transform', 'scale(0.5)');
|
|
356
|
+
});
|
|
357
|
+
it('pressRelease transitions back to full scale with spring easing', () => {
|
|
358
|
+
const el = { setStyle: vi.fn() };
|
|
359
|
+
const handle = pressRelease(el);
|
|
360
|
+
expect(el.setStyle).toHaveBeenNthCalledWith(1, 'transition', `transform ${DURATION.fast}ms ${EASING.spring}`);
|
|
361
|
+
expect(el.setStyle).toHaveBeenNthCalledWith(2, 'transform', 'scale(1)');
|
|
362
|
+
handle?.cancel();
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
//# sourceMappingURL=animate.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animate.test.js","sourceRoot":"","sources":["../../src/utils/animate.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,KAAK,GACN,MAAM,WAAW,CAAC;AAEnB;;;;;GAKG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CAAC;IAC7B,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;CACtD,CAAC,CAAC;AA6BH,MAAM,YAAY,GAAkB;IAClC;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,M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C,QAAQ,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QACxE,MAAM,EAAE,MAAM,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const printBanner: () => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import cfonts from 'cfonts';
|
|
2
|
+
import pc from 'picocolors';
|
|
3
|
+
export const printBanner = () => {
|
|
4
|
+
const rendered = cfonts.render('dolan', {
|
|
5
|
+
font: 'block',
|
|
6
|
+
colors: ['cyan', 'blue'],
|
|
7
|
+
space: false,
|
|
8
|
+
});
|
|
9
|
+
if (rendered) {
|
|
10
|
+
console.log(rendered.string);
|
|
11
|
+
}
|
|
12
|
+
console.log(pc.dim(' UI components for AngularLynx'));
|
|
13
|
+
console.log();
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../src/utils/banner.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAS,EAAE;IACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;QACtC,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IAEH,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
|
+
import cfonts from 'cfonts';
|
|
3
|
+
import { printBanner } from './banner';
|
|
4
|
+
describe('printBanner', () => {
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
vi.restoreAllMocks();
|
|
7
|
+
});
|
|
8
|
+
it('prints the rendered cfonts banner plus the tagline', () => {
|
|
9
|
+
const spy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
10
|
+
printBanner();
|
|
11
|
+
// cfonts.render('dolan', ...) always returns a RenderedFontObject with a
|
|
12
|
+
// `.string` for this font/input, so the "rendered" branch is the normal
|
|
13
|
+
// path — asserting call count pins both the banner line and the tagline.
|
|
14
|
+
expect(spy).toHaveBeenCalled();
|
|
15
|
+
const output = spy.mock.calls.map((c) => String(c[0])).join('\n');
|
|
16
|
+
expect(output).toContain('AngularLynx');
|
|
17
|
+
});
|
|
18
|
+
it('skips the banner line when cfonts.render returns a falsy value', () => {
|
|
19
|
+
// cfonts can return undefined for degenerate input — guard against that
|
|
20
|
+
// rather than crash. Spy directly on the render method to force that
|
|
21
|
+
// branch deterministically.
|
|
22
|
+
vi.spyOn(cfonts, 'render').mockReturnValue(undefined);
|
|
23
|
+
const spy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
24
|
+
printBanner();
|
|
25
|
+
// Only the tagline + blank line are logged — no banner string line.
|
|
26
|
+
expect(spy).toHaveBeenCalledTimes(2);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=banner.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.test.js","sourceRoot":"","sources":["../../src/utils/banner.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,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ACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAoB,EAAU,EAAE;IACpD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { cn } from './cn';
|
|
3
|
+
describe('cn', () => {
|
|
4
|
+
it('joins plain class name strings', () => {
|
|
5
|
+
expect(cn('a', 'b')).toBe('a b');
|
|
6
|
+
});
|
|
7
|
+
it('drops falsy values (conditional classes)', () => {
|
|
8
|
+
const isActive = false;
|
|
9
|
+
expect(cn('a', isActive && 'b', undefined, null, 'c')).toBe('a c');
|
|
10
|
+
});
|
|
11
|
+
it('merges conflicting Tailwind utilities, keeping the last one', () => {
|
|
12
|
+
// twMerge should resolve conflicting padding utilities to the last-wins value —
|
|
13
|
+
// this is the whole reason cn() wraps clsx() with tailwind-merge instead of
|
|
14
|
+
// just joining strings.
|
|
15
|
+
expect(cn('p-2', 'p-4')).toBe('p-4');
|
|
16
|
+
});
|
|
17
|
+
it('supports object and array syntax from clsx', () => {
|
|
18
|
+
expect(cn(['a', { b: true, c: false }])).toBe('a b');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=cn.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.test.js","sourceRoot":"","sources":["../../src/utils/cn.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,IAAI,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,gFAAgF;QAChF,4EAA4E;QAC5E,wBAAwB;QACxB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes upstream file content to the consuming project's oxfmt config.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS: dolan copies component source verbatim and rewrites its
|
|
5
|
+
* import paths (`../../utils/cn` → `@blotch/dolan/utils/cn`). That copy is not
|
|
6
|
+
* guaranteed to satisfy the target project's formatter — the import rewrite
|
|
7
|
+
* alone can push a line past `printWidth`, and any drift in the upstream source
|
|
8
|
+
* lands as-is. Without normalization, `dolan add`/`update` writes files that
|
|
9
|
+
* the project's own `oxfmt --check` (and CI) then reject.
|
|
10
|
+
*
|
|
11
|
+
* It MUST run during analysis, not as a post-write pass: the lockfile records
|
|
12
|
+
* `hash(newContent)` as the merge base, and every command (`update`, `diff`,
|
|
13
|
+
* `outdated`, `list`) recomputes that hash to detect drift. If we formatted
|
|
14
|
+
* after writing, the on-disk content would no longer match the recorded hash
|
|
15
|
+
* and every file would read as "user-modified" forever. Normalizing the
|
|
16
|
+
* content itself keeps the hash, the diff, and the written file in agreement.
|
|
17
|
+
*
|
|
18
|
+
* BEST-EFFORT BY DESIGN: we only reformat when the target project genuinely
|
|
19
|
+
* uses oxfmt — i.e. both an `.oxfmtrc` config and an `oxfmt` binary are
|
|
20
|
+
* discoverable by walking up from `filePath`. Projects without oxfmt (and the
|
|
21
|
+
* temp-dir fixtures in our own unit tests, which live outside any workspace)
|
|
22
|
+
* get their content back unchanged, so dolan stays usable everywhere and its
|
|
23
|
+
* tests stay deterministic. Any formatter failure also falls back to the
|
|
24
|
+
* original content — a formatting hiccup must never corrupt the file we install.
|
|
25
|
+
*
|
|
26
|
+
* @param content Raw (already import-rewritten) file content.
|
|
27
|
+
* @param filePath Absolute destination path inside the consumer project. Used
|
|
28
|
+
* to infer the parser (extension) and to resolve the project's
|
|
29
|
+
* oxfmt config/ignore rules exactly as `oxfmt` itself would.
|
|
30
|
+
*/
|
|
31
|
+
export declare const formatContent: (content: string, filePath: string) => string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
// Extensions oxfmt understands. Everything else (notably the `.css` theme
|
|
5
|
+
// files) is returned untouched — running them through a JS/TS formatter would
|
|
6
|
+
// at best no-op and at worst mangle them.
|
|
7
|
+
const FORMATTABLE_EXTENSIONS = new Set([
|
|
8
|
+
'.ts',
|
|
9
|
+
'.tsx',
|
|
10
|
+
'.mts',
|
|
11
|
+
'.cts',
|
|
12
|
+
'.js',
|
|
13
|
+
'.jsx',
|
|
14
|
+
'.mjs',
|
|
15
|
+
'.cjs',
|
|
16
|
+
]);
|
|
17
|
+
// oxfmt config filenames we treat as "this project uses oxfmt". We only look
|
|
18
|
+
// for the JSON variants because that's what the schema-validated config in
|
|
19
|
+
// this monorepo (and generated projects) use; a project on a `.ts`/`.js`
|
|
20
|
+
// oxfmt config is niche enough that skipping formatting there is acceptable.
|
|
21
|
+
const OXFMT_CONFIG_NAMES = ['.oxfmtrc.json', '.oxfmtrc.jsonc'];
|
|
22
|
+
const extensionOf = (filePath) => {
|
|
23
|
+
const dot = filePath.lastIndexOf('.');
|
|
24
|
+
return dot === -1 ? '' : filePath.slice(dot);
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Walks up the directory tree from `startDir`, returning the first ancestor
|
|
28
|
+
* that contains `relativePath`, or null if the filesystem root is reached
|
|
29
|
+
* without a hit. Used to discover the consumer's oxfmt config and binary.
|
|
30
|
+
*/
|
|
31
|
+
const findUp = (startDir, relativePath) => {
|
|
32
|
+
let dir = startDir;
|
|
33
|
+
// eslint-disable-next-line no-constant-condition
|
|
34
|
+
while (true) {
|
|
35
|
+
const candidate = join(dir, relativePath);
|
|
36
|
+
if (existsSync(candidate))
|
|
37
|
+
return candidate;
|
|
38
|
+
const parent = dirname(dir);
|
|
39
|
+
if (parent === dir)
|
|
40
|
+
return null; // reached the filesystem root
|
|
41
|
+
dir = parent;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes upstream file content to the consuming project's oxfmt config.
|
|
46
|
+
*
|
|
47
|
+
* WHY THIS EXISTS: dolan copies component source verbatim and rewrites its
|
|
48
|
+
* import paths (`../../utils/cn` → `@blotch/dolan/utils/cn`). That copy is not
|
|
49
|
+
* guaranteed to satisfy the target project's formatter — the import rewrite
|
|
50
|
+
* alone can push a line past `printWidth`, and any drift in the upstream source
|
|
51
|
+
* lands as-is. Without normalization, `dolan add`/`update` writes files that
|
|
52
|
+
* the project's own `oxfmt --check` (and CI) then reject.
|
|
53
|
+
*
|
|
54
|
+
* It MUST run during analysis, not as a post-write pass: the lockfile records
|
|
55
|
+
* `hash(newContent)` as the merge base, and every command (`update`, `diff`,
|
|
56
|
+
* `outdated`, `list`) recomputes that hash to detect drift. If we formatted
|
|
57
|
+
* after writing, the on-disk content would no longer match the recorded hash
|
|
58
|
+
* and every file would read as "user-modified" forever. Normalizing the
|
|
59
|
+
* content itself keeps the hash, the diff, and the written file in agreement.
|
|
60
|
+
*
|
|
61
|
+
* BEST-EFFORT BY DESIGN: we only reformat when the target project genuinely
|
|
62
|
+
* uses oxfmt — i.e. both an `.oxfmtrc` config and an `oxfmt` binary are
|
|
63
|
+
* discoverable by walking up from `filePath`. Projects without oxfmt (and the
|
|
64
|
+
* temp-dir fixtures in our own unit tests, which live outside any workspace)
|
|
65
|
+
* get their content back unchanged, so dolan stays usable everywhere and its
|
|
66
|
+
* tests stay deterministic. Any formatter failure also falls back to the
|
|
67
|
+
* original content — a formatting hiccup must never corrupt the file we install.
|
|
68
|
+
*
|
|
69
|
+
* @param content Raw (already import-rewritten) file content.
|
|
70
|
+
* @param filePath Absolute destination path inside the consumer project. Used
|
|
71
|
+
* to infer the parser (extension) and to resolve the project's
|
|
72
|
+
* oxfmt config/ignore rules exactly as `oxfmt` itself would.
|
|
73
|
+
*/
|
|
74
|
+
export const formatContent = (content, filePath) => {
|
|
75
|
+
if (!FORMATTABLE_EXTENSIONS.has(extensionOf(filePath)))
|
|
76
|
+
return content;
|
|
77
|
+
const startDir = dirname(filePath);
|
|
78
|
+
// Gate on the project actually using oxfmt. Checking the config first is the
|
|
79
|
+
// cheap, decisive signal; without it we'd risk formatting to oxfmt defaults
|
|
80
|
+
// in a project that never opted in.
|
|
81
|
+
const hasConfig = OXFMT_CONFIG_NAMES.some((name) => findUp(startDir, name));
|
|
82
|
+
if (!hasConfig)
|
|
83
|
+
return content;
|
|
84
|
+
const oxfmtBin = findUp(startDir, join('node_modules', '.bin', 'oxfmt'));
|
|
85
|
+
if (!oxfmtBin)
|
|
86
|
+
return content;
|
|
87
|
+
const result = spawnSync(oxfmtBin, ['--stdin-filepath', filePath], {
|
|
88
|
+
input: content,
|
|
89
|
+
encoding: 'utf-8',
|
|
90
|
+
});
|
|
91
|
+
if (result.status !== 0 || !result.stdout)
|
|
92
|
+
return content;
|
|
93
|
+
return result.stdout;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,0EAA0E;AAC1E,8EAA8E;AAC9E,0CAA0C;AAC1C,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,6EAA6E;AAC7E,MAAM,kBAAkB,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAE/D,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC/C,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,GAAG,KAAK,CAAC,C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