@inseefr/lunatic 3.0.0-rc.28 → 3.0.0-rc.30
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/lib/components/shared/HOC/slottableComponent.d.ts +1 -1
- package/lib/components/shared/MDLabel/MDLabel.d.ts +1 -3
- package/lib/components/shared/MDLabel/MDLabel.js +8 -10
- package/lib/components/shared/MDLabel/MDLabel.js.map +1 -1
- package/lib/components/shared/MDLabel/MDLabel.spec.js +21 -6
- package/lib/components/shared/MDLabel/MDLabel.spec.js.map +1 -1
- package/lib/components/shared/MDLabel/MDLabelLink.js +3 -3
- package/lib/components/shared/MDLabel/MDLabelLink.js.map +1 -1
- package/lib/components/type.d.ts +1 -1
- package/lib/hooks/useDebounce.d.ts +1 -1
- package/lib/tests/setup.d.ts +1 -0
- package/lib/tests/setup.js +18 -0
- package/lib/tests/setup.js.map +1 -0
- package/lib/tests/utils/lunatic.d.ts +19 -0
- package/lib/tests/utils/lunatic.js +31 -0
- package/lib/tests/utils/lunatic.js.map +1 -0
- package/lib/tests/utils/timer.d.ts +1 -0
- package/lib/tests/utils/timer.js +4 -0
- package/lib/tests/utils/timer.js.map +1 -0
- package/lib/use-lunatic/commons/compose.d.ts +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +20 -611
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +108 -90
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js +71 -9
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js.map +1 -1
- package/lib/use-lunatic/hooks/use-page-has-response.js +1 -1
- package/lib/use-lunatic/hooks/use-page-has-response.js.map +1 -1
- package/lib/use-lunatic/hooks/useOverview.js +20 -19
- package/lib/use-lunatic/hooks/useOverview.js.map +1 -1
- package/lib/use-lunatic/reducer/overview/overviewOnInit.js +1 -1
- package/lib/use-lunatic/reducer/overview/overviewOnInit.js.map +1 -1
- package/lib/use-lunatic/reducer/reducerInitializer.d.ts +3 -2
- package/lib/use-lunatic/reducer/reducerInitializer.js +9 -3
- package/lib/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/lib/use-lunatic/replace-component-sequence.d.ts +3 -3
- package/lib/use-lunatic/type-source.d.ts +1 -1
- package/lib/use-lunatic/type.d.ts +2 -2
- package/lib/use-lunatic/use-lunatic.js +1 -10
- package/lib/use-lunatic/use-lunatic.js.map +1 -1
- package/lib/utils/array.d.ts +1 -1
- package/lib/utils/array.js +1 -1
- package/lib/utils/constants/features.d.ts +1 -0
- package/lib/utils/constants/features.js +1 -0
- package/lib/utils/constants/features.js.map +1 -1
- package/lib/utils/vtl.js +2 -2
- package/lib/utils/vtl.js.map +1 -1
- package/package.json +34 -43
|
@@ -95,7 +95,7 @@ export type LunaticSlotComponents = {
|
|
|
95
95
|
}>>;
|
|
96
96
|
};
|
|
97
97
|
export declare const SlotsProvider: ({ slots, children, }: PropsWithChildren<{
|
|
98
|
-
slots?: Partial<LunaticSlotComponents
|
|
98
|
+
slots?: Partial<LunaticSlotComponents>;
|
|
99
99
|
}>) => import("react/jsx-runtime").JSX.Element;
|
|
100
100
|
/**
|
|
101
101
|
* Create a replaceable version of a component
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
declare const DEFAULT_LOG_FUNCTION: () => void;
|
|
2
1
|
type Props = {
|
|
3
2
|
expression: string;
|
|
4
|
-
logFunction?: typeof DEFAULT_LOG_FUNCTION;
|
|
5
3
|
};
|
|
6
|
-
export declare const MDLabel: ({ expression
|
|
4
|
+
export declare const MDLabel: ({ expression }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
5
|
export {};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import Markdown from 'react-markdown';
|
|
3
3
|
import { MDLabelLink } from './MDLabelLink';
|
|
4
|
-
import { voidFunction } from '../../../utils/function';
|
|
5
|
-
import { Fragment } from 'react';
|
|
6
4
|
import remarkBreaks from 'remark-breaks';
|
|
7
|
-
|
|
8
|
-
export const MDLabel = ({ expression
|
|
9
|
-
return (_jsx(
|
|
5
|
+
import emoji from 'remark-emoji';
|
|
6
|
+
export const MDLabel = ({ expression }) => {
|
|
7
|
+
return (_jsx(Markdown, { components: renderComponentsFor(expression), remarkPlugins: [[emoji, { accessible: true }], remarkBreaks], children: expression }));
|
|
10
8
|
};
|
|
11
|
-
const renderComponentsFor = (expression
|
|
9
|
+
const renderComponentsFor = (expression) => {
|
|
12
10
|
const components = {
|
|
13
|
-
p:
|
|
11
|
+
p: (props) => _jsx(_Fragment, { children: props.children }),
|
|
14
12
|
br: 'br',
|
|
15
|
-
a: (props) => (_jsx(MDLabelLink, { ...{ ...
|
|
13
|
+
a: (props) => (_jsx(MDLabelLink, { ...{ ...props } })),
|
|
16
14
|
};
|
|
17
15
|
if (/\n\n/.test(expression)) {
|
|
18
16
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AAIjC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,UAAU,EAAS,EAAE,EAAE;IAChD,OAAO,CACN,KAAC,QAAQ,IACR,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC,EAC3C,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,YAE3D,UAAU,GACD,CACX,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC3B,UAAkB,EAC8B,EAAE;IAClD,MAAM,UAAU,GAAG;QAClB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,4BAAG,KAAK,CAAC,QAAQ,GAAI;QACnC,EAAE,EAAE,IAAI;QACR,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CACb,KAAC,WAAW,OAAM,EAAE,GAAG,KAAK,EAAyC,GAAI,CACzE;KACuD,CAAC;IAE1D,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,OAAO;YACN,GAAG,UAAU;YACb,CAAC,EAAE,GAAG;SACN,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -54,13 +54,30 @@ describe('md-label', () => {
|
|
|
54
54
|
</div>
|
|
55
55
|
`);
|
|
56
56
|
});
|
|
57
|
+
it('should handle emoticon', () => {
|
|
58
|
+
const obj = render(_jsx(MDLabel, { expression: '**Demo** of a :dog:' }));
|
|
59
|
+
return expect(obj.container).toMatchInlineSnapshot(`
|
|
60
|
+
<div>
|
|
61
|
+
<strong>
|
|
62
|
+
Demo
|
|
63
|
+
</strong>
|
|
64
|
+
of a
|
|
65
|
+
<span
|
|
66
|
+
aria-label="dog emoji"
|
|
67
|
+
role="img"
|
|
68
|
+
>
|
|
69
|
+
🐶
|
|
70
|
+
</span>
|
|
71
|
+
</div>
|
|
72
|
+
`);
|
|
73
|
+
});
|
|
57
74
|
it('should render external link', () => {
|
|
58
75
|
const obj = render(_jsx(MDLabel, { expression: 'This is a [link](https://inseefr.github.io/Lunatic/docs)' }));
|
|
59
76
|
const stringHtmlWithoutId = getStringHtmlWithoutId(obj.container);
|
|
60
|
-
return expect(stringHtmlWithoutId).toMatchInlineSnapshot(
|
|
77
|
+
return expect(stringHtmlWithoutId).toMatchInlineSnapshot(`"<div>This is a <a href="https://inseefr.github.io/Lunatic/docs" target="_blank" rel="noopener noreferrer" >link</a></div>"`);
|
|
61
78
|
});
|
|
62
79
|
it('should render external link with tooltip', async () => {
|
|
63
|
-
|
|
80
|
+
render(_jsx(MDLabel, { expression: "This is a [link](https://inseefr.github.io/Lunatic/docs 'with a tooltip')" }));
|
|
64
81
|
const link = screen.getByText('link'); // Get the link element by its text content
|
|
65
82
|
// Simulate hover event
|
|
66
83
|
await userEvent.hover(link);
|
|
@@ -70,14 +87,13 @@ describe('md-label', () => {
|
|
|
70
87
|
});
|
|
71
88
|
expect(link.getAttribute('data-tooltip-id')).toBe(tooltip?.id);
|
|
72
89
|
expect(tooltip).toBeInTheDocument();
|
|
73
|
-
expect(getStringHtmlWithoutId(container)).toMatchInlineSnapshot('"<div>This is a <a href=\\"https://inseefr.github.io/Lunatic/docs\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\" data-tooltip- class=\\"link-md\\">link</a><div role=\\"tooltip\\" class=\\"react-tooltip core-styles-module_tooltip__3vRRp styles-module_tooltip__mnnfp styles-module_dark__xNqje tooltip-content react-tooltip__place-top core-styles-module_show__Nt9eE react-tooltip__show\\" style=\\"left: 5px; top: -10px;\\">with a tooltip<div class=\\"react-tooltip-arrow core-styles-module_arrow__cvMwQ styles-module_arrow__K0L3T\\" style=\\"left: -1px; bottom: -4px;\\"></div></div></div>"');
|
|
74
90
|
});
|
|
75
91
|
it('should render internal link', () => {
|
|
76
92
|
const obj = render(_jsx(MDLabel, { expression: 'This is an [internal link](/docs)' }));
|
|
77
|
-
return expect(getStringHtmlWithoutId(obj.container)).toMatchInlineSnapshot(
|
|
93
|
+
return expect(getStringHtmlWithoutId(obj.container)).toMatchInlineSnapshot(`"<div>This is an <a href="/docs" >internal link</a></div>"`);
|
|
78
94
|
});
|
|
79
95
|
it('should render internal link with tooltip', async () => {
|
|
80
|
-
|
|
96
|
+
render(_jsx(MDLabel, { expression: "This is an [internal link](/docs 'with a tooltip')" }));
|
|
81
97
|
const link = screen.getByText('internal link'); // Get the link element by its text content
|
|
82
98
|
// Simulate hover event
|
|
83
99
|
await userEvent.hover(link);
|
|
@@ -86,7 +102,6 @@ describe('md-label', () => {
|
|
|
86
102
|
tooltip = screen.getByRole('tooltip');
|
|
87
103
|
});
|
|
88
104
|
expect(tooltip).toBeInTheDocument();
|
|
89
|
-
expect(getStringHtmlWithoutId(container)).toMatchInlineSnapshot('"<div>This is an <a href=\\"/docs\\" data-tooltip- class=\\"link-md\\">internal link</a><div role=\\"tooltip\\" class=\\"react-tooltip core-styles-module_tooltip__3vRRp styles-module_tooltip__mnnfp styles-module_dark__xNqje tooltip-content react-tooltip__place-top core-styles-module_show__Nt9eE react-tooltip__show\\" style=\\"left: 5px; top: -10px;\\">with a tooltip<div class=\\"react-tooltip-arrow core-styles-module_arrow__cvMwQ styles-module_arrow__K0L3T\\" style=\\"left: -1px; bottom: -4px;\\"></div></div></div>"');
|
|
90
105
|
});
|
|
91
106
|
});
|
|
92
107
|
//# sourceMappingURL=MDLabel.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabel.spec.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.spec.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,SAAS,sBAAsB,CAAC,WAAwB;IACvD,OAAO,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC;AAED,QAAQ,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AAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,2CAA2C;QAC3F,uBAAuB;QACvB,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE5B,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,MAAM,OAAO,CAAC,GAAG,EAAE;YAClB,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import { Tooltip } from 'react-tooltip';
|
|
4
|
-
import
|
|
4
|
+
import Markdown from 'react-markdown';
|
|
5
5
|
import { RouterLink } from './RouterLink';
|
|
6
6
|
export const MDLabelLink = (props) => {
|
|
7
7
|
const { href, children, title,
|
|
@@ -25,7 +25,7 @@ export const MDLabelLink = (props) => {
|
|
|
25
25
|
? { 'data-tooltip-id': `tooltip-${id}`, className: 'link-md' }
|
|
26
26
|
: {}),
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs(_Fragment, { children: [_jsx(LinkComponent, { ...linkProps, children: children }), title && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: _jsx(
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(LinkComponent, { ...linkProps, children: children }), title && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: _jsx(Markdown, { components: { p: (props) => _jsx(_Fragment, { children: props.children }) }, children: title }) }))] }));
|
|
29
29
|
};
|
|
30
30
|
export function generateUniqueId() {
|
|
31
31
|
const timestamp = Date.now().toString(36);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabelLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabelLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"MDLabelLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabelLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;IAC3C,MAAM,EACL,IAAI,EACJ,QAAQ,EACR,KAAK;IACL,cAAc;MACd,GAAG,KAAK,CAAC;IAEV,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhD,MAAM,aAAa,GAKd,CAAC,GAAG,EAAE;QACV,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,UAAU,CAAC;QACnB,CAAC;aAAM,CAAC;YACP,OAAO,GAAU,CAAC;QACnB,CAAC;IACF,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,SAAS,GAAG;QACjB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAC9B,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAClB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAAC;QAC9D,GAAG,CAAC,KAAK;YACR,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;YAC9D,CAAC,CAAC,EAAE,CAAC;KACN,CAAC;IAEF,OAAO,CACN,8BACC,KAAC,aAAa,OAAK,SAAS,YAAG,QAAQ,GAAiB,EACvD,KAAK,IAAI,CACT,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,WAAW,EAAE,EAAE,YACvD,KAAC,QAAQ,IAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,4BAAG,KAAK,CAAC,QAAQ,GAAI,EAAE,YAC3D,KAAK,GACI,GACF,CACV,IACC,CACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,gBAAgB;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;AACrC,CAAC"}
|
package/lib/components/type.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { LunaticComponentDefinition, LunaticError, LunaticOptions, LunaticR
|
|
|
4
4
|
type Formats = 'PTnHnM' | 'PnYnM';
|
|
5
5
|
export type VtlExpression = {
|
|
6
6
|
value: string;
|
|
7
|
-
type: 'VTL' | 'VTL|MD';
|
|
7
|
+
type: 'VTL' | 'VTL|MD' | 'TXT';
|
|
8
8
|
};
|
|
9
9
|
export type LunaticBaseProps<ValueType = unknown> = {
|
|
10
10
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type DependencyList } from 'react';
|
|
2
|
-
export declare const useDebounce: <A extends unknown[], R = void>(fn: (...args: A) => R, ms: number) => (...args: A) => Promise<R
|
|
2
|
+
export declare const useDebounce: <A extends unknown[], R = void>(fn: (...args: A) => R, ms: number) => ((...args: A) => Promise<R>);
|
|
3
3
|
export declare const useDebouncedState: <A>(initialState: A, ms: number) => [A, (args: A) => void];
|
|
4
4
|
export declare const useEffectDebounced: (cb: () => void, deps: DependencyList, ms: number) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { afterEach, vi } from 'vitest';
|
|
3
|
+
import { cleanup } from '@testing-library/react';
|
|
4
|
+
// runs a cleanup after each test case (e.g. clearing jsdom)
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
cleanup();
|
|
7
|
+
});
|
|
8
|
+
// Mock for structuredClone on NodeJS
|
|
9
|
+
global.structuredClone = (val) => {
|
|
10
|
+
return JSON.parse(JSON.stringify(val));
|
|
11
|
+
};
|
|
12
|
+
// We need ResizeObserver to test Tooltip
|
|
13
|
+
global.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
14
|
+
observe: vi.fn(),
|
|
15
|
+
unobserve: vi.fn(),
|
|
16
|
+
disconnect: vi.fn(),
|
|
17
|
+
}));
|
|
18
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/tests/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,4DAA4D;AAC5D,SAAS,CAAC,GAAG,EAAE;IACd,OAAO,EAAE,CAAC;AACX,CAAC,CAAC,CAAC;AAEH,qCAAqC;AACpC,MAAc,CAAC,eAAe,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,cAAc,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE;IAChB,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;IAClB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;CACnB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LunaticData } from '../../use-lunatic/type';
|
|
2
|
+
/**
|
|
3
|
+
* Generate LunaticData from a record of values
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateData<T extends Record<string, unknown>>(data: T): LunaticData;
|
|
6
|
+
export declare function generateVariable({ type, name }: {
|
|
7
|
+
type?: string | undefined;
|
|
8
|
+
name?: string | undefined;
|
|
9
|
+
}): {
|
|
10
|
+
variableType: string;
|
|
11
|
+
name: string;
|
|
12
|
+
values: {
|
|
13
|
+
PREVIOUS: null;
|
|
14
|
+
COLLECTED: null;
|
|
15
|
+
FORCED: null;
|
|
16
|
+
EDITED: null;
|
|
17
|
+
INPUTTED: null;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate LunaticData from a record of values
|
|
3
|
+
*/
|
|
4
|
+
export function generateData(data) {
|
|
5
|
+
return {
|
|
6
|
+
COLLECTED: Object.fromEntries(Object.entries(data).map(([key, value]) => [
|
|
7
|
+
key,
|
|
8
|
+
{
|
|
9
|
+
CALCULATED: null,
|
|
10
|
+
EXTERNAL: null,
|
|
11
|
+
COLLECTED: value,
|
|
12
|
+
},
|
|
13
|
+
])),
|
|
14
|
+
CALCULATED: {},
|
|
15
|
+
EXTERNAL: {},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function generateVariable({ type = 'COLLECTED', name = 'VARIABLE' }) {
|
|
19
|
+
return {
|
|
20
|
+
variableType: type,
|
|
21
|
+
name: name,
|
|
22
|
+
values: {
|
|
23
|
+
PREVIOUS: null,
|
|
24
|
+
COLLECTED: null,
|
|
25
|
+
FORCED: null,
|
|
26
|
+
EDITED: null,
|
|
27
|
+
INPUTTED: null,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=lunatic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lunatic.js","sourceRoot":"","sources":["../../../src/tests/utils/lunatic.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,YAAY,CAC3B,IAAO;IAEP,OAAO;QACN,SAAS,EAAE,MAAM,CAAC,WAAW,CAC5B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YAC1C,GAAG;YACH;gBACC,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,KAAK;aAChB;SACD,CAAC,CACqB;QACxB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,GAAG,WAAW,EAAE,IAAI,GAAG,UAAU,EAAE;IACzE,OAAO;QACN,YAAY,EAAE,IAAI;QAClB,IAAI,EAAE,IAAI;QACV,MAAM,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,IAAI;SACd;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(duration: number): Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../src/tests/utils/timer.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,QAAgB;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LunaticState } from '../type';
|
|
2
|
-
declare const compose: <V>(...functions: (
|
|
2
|
+
declare const compose: <V>(...functions: Array<(acc: LunaticState, action: V) => LunaticState>) => (acc: LunaticState, action: V) => LunaticState;
|
|
3
3
|
export default compose;
|