@ctrliq/quantic-components 1.81.0 → 1.82.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/card/index.d.ts +1 -1
- package/dist/card/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/meta/constants-barrel.test.d.ts +1 -0
- package/dist/meta/constants-barrel.test.js +74 -0
- package/dist/meta.json +1 -1
- package/dist/quantic-components.js +6 -5
- package/dist/quantic-components.js.map +1 -1
- package/dist/quantic-components.min.js +4 -4
- package/dist/quantic-components.min.js.map +1 -1
- package/dist/register.js.map +1 -1
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/types/card/index.d.ts +1 -1
- package/dist/types/meta/constants-barrel.test.d.ts +1 -0
- package/dist/types/tooltip/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { globSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
const SRC_DIR = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
|
+
const ROOT_BARREL = 'index.ts';
|
|
7
|
+
const DECLARED = /^export\s+(?:declare\s+)?(?:const enum|enum|type|interface|const|function|class)\s+(\w+)/gm;
|
|
8
|
+
const PROP_TYPE = /@prop\(\{[^}]*?type:\s*'([A-Za-z_]\w*)'/gs;
|
|
9
|
+
const STAR_REEXPORT = /export\s*\*\s*from\s*'\.\/([\w./-]+)'/g;
|
|
10
|
+
const NAMED_EXPORT = /export\s*\{([^}]*)\}\s*(?:from\s*'\.\/[\w./-]+')?\s*;/g;
|
|
11
|
+
const INTERNAL = new Set([
|
|
12
|
+
'tabsTag',
|
|
13
|
+
'buttonTag',
|
|
14
|
+
'panelTag',
|
|
15
|
+
'buttonsSlot',
|
|
16
|
+
'panelsSlot',
|
|
17
|
+
'BrandIconName',
|
|
18
|
+
'TabsVariant',
|
|
19
|
+
]);
|
|
20
|
+
function read(file) {
|
|
21
|
+
return globSync(file, { cwd: SRC_DIR }).length ? readFileSync(join(SRC_DIR, file), 'utf-8') : '';
|
|
22
|
+
}
|
|
23
|
+
function moduleFile(specifier) {
|
|
24
|
+
const direct = specifier.replace(/\.js$/, '');
|
|
25
|
+
return globSync(`${direct}.ts`, { cwd: SRC_DIR }).length ? `${direct}.ts` : `${direct}/index.ts`;
|
|
26
|
+
}
|
|
27
|
+
function namesReachableFrom(entry, seen = new Set()) {
|
|
28
|
+
if (seen.has(entry))
|
|
29
|
+
return new Set();
|
|
30
|
+
seen.add(entry);
|
|
31
|
+
const source = read(entry);
|
|
32
|
+
const names = new Set([...source.matchAll(DECLARED)].map(([, name]) => name));
|
|
33
|
+
const base = dirname(entry);
|
|
34
|
+
for (const [, clause] of source.matchAll(NAMED_EXPORT)) {
|
|
35
|
+
for (const entryName of clause.split(',')) {
|
|
36
|
+
const name = entryName.trim().split(/\s+as\s+/).pop()?.trim();
|
|
37
|
+
if (name)
|
|
38
|
+
names.add(name);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const [, specifier] of source.matchAll(STAR_REEXPORT)) {
|
|
42
|
+
const target = moduleFile(base === '.' ? specifier : `${base}/${specifier}`);
|
|
43
|
+
for (const name of namesReachableFrom(target, seen))
|
|
44
|
+
names.add(name);
|
|
45
|
+
}
|
|
46
|
+
return names;
|
|
47
|
+
}
|
|
48
|
+
const sources = globSync('**/*.ts', { cwd: SRC_DIR }).filter((file) => !/\.(stories|test|d)\.ts$/.test(file));
|
|
49
|
+
const declared = new Set(sources.flatMap((file) => [...read(file).matchAll(DECLARED)].map(([, n]) => n)));
|
|
50
|
+
const propTypes = new Set(sources.flatMap((file) => [...read(file).matchAll(PROP_TYPE)].map(([, t]) => t)));
|
|
51
|
+
const fromConstantsModules = new Set(sources
|
|
52
|
+
.filter((file) => file.endsWith('index.constants.ts'))
|
|
53
|
+
.flatMap((file) => [...read(file).matchAll(DECLARED)].map(([, n]) => n)));
|
|
54
|
+
const rootExports = namesReachableFrom(ROOT_BARREL);
|
|
55
|
+
describe('public constants surface', () => {
|
|
56
|
+
it('finds sources, prop types and root exports to check', () => {
|
|
57
|
+
expect(sources.length).toBeGreaterThan(0);
|
|
58
|
+
expect(propTypes.size).toBeGreaterThan(0);
|
|
59
|
+
expect(fromConstantsModules.size).toBeGreaterThan(0);
|
|
60
|
+
expect(rootExports.size).toBeGreaterThan(0);
|
|
61
|
+
});
|
|
62
|
+
it('exports every constant used as a prop type from the package root', () => {
|
|
63
|
+
const unreachable = [...propTypes]
|
|
64
|
+
.filter((name) => declared.has(name) && !INTERNAL.has(name) && !rootExports.has(name))
|
|
65
|
+
.sort();
|
|
66
|
+
expect(unreachable).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
it('exports every index.constants.ts declaration from the package root', () => {
|
|
69
|
+
const unreachable = [...fromConstantsModules]
|
|
70
|
+
.filter((name) => !INTERNAL.has(name) && !rootExports.has(name))
|
|
71
|
+
.sort();
|
|
72
|
+
expect(unreachable).toEqual([]);
|
|
73
|
+
});
|
|
74
|
+
});
|
package/dist/meta.json
CHANGED
|
@@ -6251,11 +6251,11 @@
|
|
|
6251
6251
|
CardSize["Medium"] = "md";
|
|
6252
6252
|
CardSize["Large"] = "lg";
|
|
6253
6253
|
})(exports.CardSize || (exports.CardSize = {}));
|
|
6254
|
-
|
|
6254
|
+
exports.CardTitleVariant = void 0;
|
|
6255
6255
|
(function (CardTitleVariant) {
|
|
6256
6256
|
CardTitleVariant["Primary"] = "primary";
|
|
6257
6257
|
CardTitleVariant["Secondary"] = "secondary";
|
|
6258
|
-
})(CardTitleVariant || (CardTitleVariant = {}));
|
|
6258
|
+
})(exports.CardTitleVariant || (exports.CardTitleVariant = {}));
|
|
6259
6259
|
/**
|
|
6260
6260
|
* @deprecated Use GridDensity instead.
|
|
6261
6261
|
*/
|
|
@@ -7403,7 +7403,7 @@
|
|
|
7403
7403
|
]) {
|
|
7404
7404
|
constructor() {
|
|
7405
7405
|
super(...arguments);
|
|
7406
|
-
this.variant = CardTitleVariant.Primary;
|
|
7406
|
+
this.variant = exports.CardTitleVariant.Primary;
|
|
7407
7407
|
}
|
|
7408
7408
|
render() {
|
|
7409
7409
|
return u$2 `
|
|
@@ -7480,8 +7480,8 @@
|
|
|
7480
7480
|
__decorate([
|
|
7481
7481
|
prop({
|
|
7482
7482
|
type: 'CardTitleVariant',
|
|
7483
|
-
options: Object.values(CardTitleVariant),
|
|
7484
|
-
default: CardTitleVariant.Primary,
|
|
7483
|
+
options: Object.values(exports.CardTitleVariant),
|
|
7484
|
+
default: exports.CardTitleVariant.Primary,
|
|
7485
7485
|
description: 'Visual variant of the title.',
|
|
7486
7486
|
})
|
|
7487
7487
|
], exports.CardTitle.prototype, "variant", void 0);
|
|
@@ -70626,6 +70626,7 @@
|
|
|
70626
70626
|
exports.ToastType = ToastType;
|
|
70627
70627
|
exports.ToggleSize = ToggleSize;
|
|
70628
70628
|
exports.TooltipPlacement = TooltipPlacement;
|
|
70629
|
+
exports.TooltipSize = TooltipSize;
|
|
70629
70630
|
exports.icons = icons;
|
|
70630
70631
|
exports.quanticElement = quanticElement;
|
|
70631
70632
|
exports.tableVariantContext = tableVariantContext;
|