@sit-onyx/headless 0.0.0 → 0.1.0-alpha.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/README.md +1 -1
- package/package.json +9 -2
- package/src/composables/comboBox/TestDropdown.ct.tsx +91 -0
- package/src/composables/comboBox/TestDropdown.vue +73 -0
- package/src/composables/comboBox/createComboBox.ts +133 -0
- package/src/index.ts +1 -1
- package/src/playwright.ts +1 -0
- package/src/utils/builder.ts +43 -0
- package/src/utils/id.ts +10 -0
- package/src/composables/createComboBox.ts +0 -6
- package/tsconfig.json +0 -109
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/headless",
|
|
3
3
|
"description": "Headless composables for Vue",
|
|
4
|
-
"version": "0.0.0",
|
|
4
|
+
"version": "0.1.0-alpha.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
+
"files": [
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
8
11
|
"exports": {
|
|
9
12
|
".": {
|
|
10
13
|
"default": "./src/index.ts"
|
|
14
|
+
},
|
|
15
|
+
"./playwright": {
|
|
16
|
+
"default": "./src/playwright.ts"
|
|
11
17
|
}
|
|
12
18
|
},
|
|
13
19
|
"peerDependencies": {
|
|
@@ -15,6 +21,7 @@
|
|
|
15
21
|
"vue": ">= 3"
|
|
16
22
|
},
|
|
17
23
|
"scripts": {
|
|
18
|
-
"build": "tsc --
|
|
24
|
+
"build": "vue-tsc --build --force",
|
|
25
|
+
"test:components": "playwright install && playwright test"
|
|
19
26
|
}
|
|
20
27
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/experimental-ct-vue";
|
|
2
|
+
import type { Locator, Page } from "@playwright/test";
|
|
3
|
+
import TestDropdown from "./TestDropdown.vue";
|
|
4
|
+
|
|
5
|
+
const expectToHaveFocus = async (
|
|
6
|
+
locator: Locator,
|
|
7
|
+
messageOptions?: Parameters<typeof expect>[1],
|
|
8
|
+
) => {
|
|
9
|
+
const result = await locator.evaluateHandle((element) => element === document.activeElement);
|
|
10
|
+
await expect(result.jsonValue(), messageOptions).resolves.toBeTruthy();
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
test("combobox", async ({ mount, page }) => {
|
|
14
|
+
await mount(<TestDropdown />);
|
|
15
|
+
const listbox = page.getByRole("listbox");
|
|
16
|
+
const combobox = page.getByRole("combobox");
|
|
17
|
+
const button = page.getByRole("button");
|
|
18
|
+
const options = page.getByRole("option");
|
|
19
|
+
|
|
20
|
+
await comboboxTesting(page, listbox, combobox, button, options);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Test an implementation of the combobox based on https://w3c.github.io/aria/#combobox
|
|
25
|
+
*/
|
|
26
|
+
export const comboboxTesting = async (
|
|
27
|
+
page: Page,
|
|
28
|
+
listbox: Locator,
|
|
29
|
+
combobox: Locator,
|
|
30
|
+
button: Locator,
|
|
31
|
+
options: Locator,
|
|
32
|
+
) => {
|
|
33
|
+
await expect(listbox, "Typically, the initial state of a combobox is collapsed.").toBeHidden();
|
|
34
|
+
|
|
35
|
+
await expect(combobox, "In the collapsed state, the combobox element is visible.").toBeVisible();
|
|
36
|
+
await expect(
|
|
37
|
+
button,
|
|
38
|
+
"In the collapsed state, the optional button element is visible.",
|
|
39
|
+
).toBeVisible();
|
|
40
|
+
|
|
41
|
+
await button.click(); // toggle to be expanded
|
|
42
|
+
await expect(
|
|
43
|
+
combobox,
|
|
44
|
+
"A combobox is said to be expanded when the combobox element shows its current value",
|
|
45
|
+
).toHaveValue("");
|
|
46
|
+
await expect(
|
|
47
|
+
listbox,
|
|
48
|
+
"A combobox is said to be expanded when the associated popup is visible",
|
|
49
|
+
).toBeVisible();
|
|
50
|
+
await button.click(); // toggle to be closed
|
|
51
|
+
|
|
52
|
+
await expect(
|
|
53
|
+
combobox,
|
|
54
|
+
"Authors MUST set aria-expanded to false when it is collapsed.",
|
|
55
|
+
).toHaveAttribute("aria-expanded", "false");
|
|
56
|
+
await button.click(); // toggle to be expanded
|
|
57
|
+
await expect(
|
|
58
|
+
combobox,
|
|
59
|
+
"Authors MUST set aria-expanded to true when it is expanded.",
|
|
60
|
+
).toHaveAttribute("aria-expanded", "true");
|
|
61
|
+
await button.click(); // toggle to be closed
|
|
62
|
+
|
|
63
|
+
await button.focus();
|
|
64
|
+
await expectToHaveFocus(button, "authors SHOULD ensure that the button is focusable");
|
|
65
|
+
await expect(
|
|
66
|
+
button,
|
|
67
|
+
"authors SHOULD ensure that the button is not included in the page Tab sequence",
|
|
68
|
+
).toHaveAttribute("tabindex", "-1");
|
|
69
|
+
await expect(
|
|
70
|
+
combobox.getByRole("button"),
|
|
71
|
+
"authors SHOULD ensure that the button is not a descendant of the element with role combobox",
|
|
72
|
+
).toHaveCount(0);
|
|
73
|
+
|
|
74
|
+
const firstElement = options.first();
|
|
75
|
+
|
|
76
|
+
// open and select first option
|
|
77
|
+
await combobox.focus();
|
|
78
|
+
await page.keyboard.press("ArrowDown");
|
|
79
|
+
await page.keyboard.press("ArrowDown");
|
|
80
|
+
|
|
81
|
+
const firstId = await (await firstElement.elementHandle())!.getAttribute("id");
|
|
82
|
+
expect(typeof firstId).toBe("string");
|
|
83
|
+
await expect(
|
|
84
|
+
combobox,
|
|
85
|
+
"When a descendant of the popup element is active, authors MAY set aria-activedescendant on the combobox to a value that refers to the active element within the popup.",
|
|
86
|
+
).toHaveAttribute("aria-activedescendant", firstId as string);
|
|
87
|
+
await expectToHaveFocus(
|
|
88
|
+
combobox,
|
|
89
|
+
"When a descendant of the popup element is active, authors MAY ensure that the focus remains on the combobox element",
|
|
90
|
+
);
|
|
91
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { createComboBox } from "./createComboBox";
|
|
4
|
+
|
|
5
|
+
const elements = ["a", "b", "c", "d"];
|
|
6
|
+
const isExpanded = ref(false);
|
|
7
|
+
const activeKey = ref("");
|
|
8
|
+
const selectedIndex = computed<number | undefined>(() => {
|
|
9
|
+
const index = elements.indexOf(activeKey.value);
|
|
10
|
+
return index !== -1 ? index : undefined;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const onFirst = () => (activeKey.value = elements[0]);
|
|
14
|
+
const onLast = () => (activeKey.value = elements[elements.length - 1]);
|
|
15
|
+
const onNext = () => {
|
|
16
|
+
if (selectedIndex.value === undefined) {
|
|
17
|
+
return onFirst();
|
|
18
|
+
}
|
|
19
|
+
activeKey.value = elements[selectedIndex.value + (1 % (elements.length - 1))];
|
|
20
|
+
};
|
|
21
|
+
const onPrevious = () => (activeKey.value = elements[(selectedIndex.value ?? 0) - 1]);
|
|
22
|
+
const onSelect = (key: string) => (activeKey.value = key);
|
|
23
|
+
const onToggle = () => (isExpanded.value = !isExpanded.value);
|
|
24
|
+
|
|
25
|
+
const comboBox = createComboBox({
|
|
26
|
+
isExpanded,
|
|
27
|
+
onToggle,
|
|
28
|
+
onFirst,
|
|
29
|
+
onLast,
|
|
30
|
+
onNext,
|
|
31
|
+
onPrevious,
|
|
32
|
+
onSelect,
|
|
33
|
+
activeKey,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
elements: { input, label, listBox, button, option },
|
|
38
|
+
} = comboBox;
|
|
39
|
+
|
|
40
|
+
defineExpose({ comboBox });
|
|
41
|
+
</script>
|
|
42
|
+
<template>
|
|
43
|
+
<div>
|
|
44
|
+
<label v-bind="label">
|
|
45
|
+
some label:
|
|
46
|
+
<input
|
|
47
|
+
v-bind="input"
|
|
48
|
+
@keydown.arrow-down="isExpanded = true"
|
|
49
|
+
@keydown.esc="isExpanded = false"
|
|
50
|
+
/>
|
|
51
|
+
</label>
|
|
52
|
+
|
|
53
|
+
<button v-bind="button">
|
|
54
|
+
<template v-if="isExpanded">⬆️</template>
|
|
55
|
+
<template v-else>⬇️</template>
|
|
56
|
+
</button>
|
|
57
|
+
<ul v-bind="listBox" :class="{ hidden: !isExpanded }" style="width: 400px">
|
|
58
|
+
<li
|
|
59
|
+
v-for="e in elements"
|
|
60
|
+
:key="e"
|
|
61
|
+
v-bind="option({ key: e, label: e, disabled: false })"
|
|
62
|
+
:style="{ 'background-color': e === activeKey ? 'red' : undefined }"
|
|
63
|
+
>
|
|
64
|
+
{{ e }}
|
|
65
|
+
</li>
|
|
66
|
+
</ul>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
<style>
|
|
70
|
+
.hidden {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { computed, ref, type Ref } from "vue";
|
|
2
|
+
import { createId } from "../../utils/id";
|
|
3
|
+
import { createBuilder, computeIterated } from "../../utils/builder";
|
|
4
|
+
|
|
5
|
+
// TODO: https://w3c.github.io/aria/#aria-autocomplete
|
|
6
|
+
// TODO: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
7
|
+
// TODO: button as optional
|
|
8
|
+
|
|
9
|
+
export const createComboBox = createBuilder(
|
|
10
|
+
({
|
|
11
|
+
isExpanded,
|
|
12
|
+
activeKey,
|
|
13
|
+
onToggle,
|
|
14
|
+
onSelect,
|
|
15
|
+
onFirst,
|
|
16
|
+
onLast,
|
|
17
|
+
onNext,
|
|
18
|
+
onPrevious,
|
|
19
|
+
}: {
|
|
20
|
+
isExpanded: Ref<boolean>;
|
|
21
|
+
activeKey: Ref<string | undefined>;
|
|
22
|
+
onToggle: () => void;
|
|
23
|
+
onSelect: (key: string) => void;
|
|
24
|
+
onFirst: () => void;
|
|
25
|
+
onLast: () => void;
|
|
26
|
+
onNext: () => void;
|
|
27
|
+
onPrevious: () => void;
|
|
28
|
+
}) => {
|
|
29
|
+
const inputValue = ref("");
|
|
30
|
+
const inputValid = ref(true);
|
|
31
|
+
const controlsId = createId("comboBox-control");
|
|
32
|
+
const labelId = createId("comboBox-label");
|
|
33
|
+
|
|
34
|
+
const descendantKeyIdMap: Record<string, string | undefined> = {};
|
|
35
|
+
|
|
36
|
+
const getOptionId = (key: string) =>
|
|
37
|
+
descendantKeyIdMap[key] ?? (descendantKeyIdMap[key] = createId("comboBox-option"));
|
|
38
|
+
|
|
39
|
+
const handleInput = (event: Event) => {
|
|
40
|
+
const inputElement = event.target as HTMLInputElement;
|
|
41
|
+
inputValue.value = inputElement.value;
|
|
42
|
+
inputValid.value = inputElement.validity.valid;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleBlur = () => {
|
|
46
|
+
if (isExpanded.value) {
|
|
47
|
+
onToggle();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
52
|
+
if (!isExpanded.value) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
switch (event.key) {
|
|
56
|
+
case "Escape":
|
|
57
|
+
onToggle();
|
|
58
|
+
break;
|
|
59
|
+
case "ArrowUp":
|
|
60
|
+
if (!activeKey.value) {
|
|
61
|
+
return onLast();
|
|
62
|
+
}
|
|
63
|
+
onPrevious();
|
|
64
|
+
break;
|
|
65
|
+
case "ArrowDown":
|
|
66
|
+
if (!activeKey.value) {
|
|
67
|
+
return onFirst();
|
|
68
|
+
}
|
|
69
|
+
onNext();
|
|
70
|
+
break;
|
|
71
|
+
case "Home":
|
|
72
|
+
onFirst();
|
|
73
|
+
break;
|
|
74
|
+
case "End":
|
|
75
|
+
onLast();
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
elements: {
|
|
82
|
+
/**
|
|
83
|
+
* The label element for the combobox input element.
|
|
84
|
+
*/
|
|
85
|
+
label: {
|
|
86
|
+
id: labelId,
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* The listbox associated with the combobox.
|
|
90
|
+
*/
|
|
91
|
+
listBox: computed(() => ({
|
|
92
|
+
role: "listbox",
|
|
93
|
+
id: controlsId,
|
|
94
|
+
})),
|
|
95
|
+
option: computeIterated<{ key: string; label: string; disabled: boolean }>(
|
|
96
|
+
({ key, label, disabled }) => ({
|
|
97
|
+
role: "option",
|
|
98
|
+
id: getOptionId(key),
|
|
99
|
+
"aria-selected": activeKey.value === key,
|
|
100
|
+
"aria-label": label,
|
|
101
|
+
"aria-disabled": disabled,
|
|
102
|
+
onClick: () => onSelect(key),
|
|
103
|
+
}),
|
|
104
|
+
),
|
|
105
|
+
/**
|
|
106
|
+
* An input that controls another element, that can dynamically pop-up to help the user set the value of the input.
|
|
107
|
+
* The input MAY be either a single-line text field that supports editing and typing or an element that only displays the current value of the combobox.
|
|
108
|
+
*/
|
|
109
|
+
input: computed(() => ({
|
|
110
|
+
value: inputValue.value,
|
|
111
|
+
role: "combobox",
|
|
112
|
+
"aria-expanded": isExpanded.value,
|
|
113
|
+
"aria-controls": controlsId,
|
|
114
|
+
"aria-labelledby": labelId,
|
|
115
|
+
"aria-activedescendant": activeKey.value ? getOptionId(activeKey.value) : undefined,
|
|
116
|
+
onInput: handleInput,
|
|
117
|
+
onKeydown: handleKeydown,
|
|
118
|
+
onBlur: handleBlur,
|
|
119
|
+
})),
|
|
120
|
+
/**
|
|
121
|
+
* An optional button to control the visibility of the popup.
|
|
122
|
+
*/
|
|
123
|
+
button: computed(() => ({
|
|
124
|
+
tabindex: "-1",
|
|
125
|
+
onClick: onToggle,
|
|
126
|
+
})),
|
|
127
|
+
},
|
|
128
|
+
state: {
|
|
129
|
+
inputValue,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
},
|
|
133
|
+
);
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./composables/createComboBox";
|
|
1
|
+
export * from "./composables/comboBox/createComboBox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { comboboxTesting } from "./composables/comboBox/TestDropdown.ct";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { computed, type ComputedRef, type HtmlHTMLAttributes, type Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export type IteratedHeadlessElementFunc<T extends Record<string, unknown>> = (
|
|
4
|
+
opts: T,
|
|
5
|
+
) => HtmlHTMLAttributes;
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
export type HeadlessElementAttributes = HtmlHTMLAttributes | IteratedHeadlessElementFunc<any>;
|
|
9
|
+
|
|
10
|
+
export type HeadlessElements = Record<
|
|
11
|
+
string,
|
|
12
|
+
HeadlessElementAttributes | ComputedRef<HeadlessElementAttributes>
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
export type HeadlessState = Record<string, Ref>;
|
|
16
|
+
|
|
17
|
+
export type HeadlessComposable<Elements extends HeadlessElements, State extends HeadlessState> = {
|
|
18
|
+
elements: Elements;
|
|
19
|
+
state: State;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* We use this identity function to ensure the correct typings of the headless composables
|
|
24
|
+
*/
|
|
25
|
+
export const createBuilder = <P, Elements extends HeadlessElements, State extends HeadlessState>(
|
|
26
|
+
builder: (props: P) => HeadlessComposable<Elements, State>,
|
|
27
|
+
) => builder;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Shorthand function for creating a typed IteratedHeadlessElementFunction
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* {
|
|
34
|
+
* option: computeIterated<{ key: string; label: string; disabled: boolean }>(
|
|
35
|
+
* ({ key, label, disabled }) => ({
|
|
36
|
+
* // Do something with the typed props
|
|
37
|
+
* }),
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const computeIterated = <P extends Record<string, unknown>>(
|
|
42
|
+
iteratedFunc: IteratedHeadlessElementFunc<P>,
|
|
43
|
+
) => computed(() => iteratedFunc);
|
package/src/utils/id.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a unique global id string
|
|
3
|
+
*/
|
|
4
|
+
// ⚠️ we make use of an IIFE to encapsulate the globalCounter so it can never accidentally be used somewhere else.
|
|
5
|
+
const nextId = (() => {
|
|
6
|
+
let globalCounter = 0;
|
|
7
|
+
return () => globalCounter++;
|
|
8
|
+
})();
|
|
9
|
+
|
|
10
|
+
export const createId = (name: string) => `${name}-${nextId()}`;
|
package/tsconfig.json
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "ESNext" /* Specify what module code is generated. */,
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
-
|
|
46
|
-
/* JavaScript Support */
|
|
47
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
-
|
|
51
|
-
/* Emit */
|
|
52
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
59
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
-
"noEmit": true /* Disable emitting files from a compilation. */,
|
|
61
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
-
|
|
76
|
-
/* Interop Constraints */
|
|
77
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
81
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
83
|
-
|
|
84
|
-
/* Type Checking */
|
|
85
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
86
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
-
|
|
105
|
-
/* Completeness */
|
|
106
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
-
}
|
|
109
|
-
}
|