@pantoken/utils 1.3.0 → 1.4.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/example-targets.d.ts
|
|
2
2
|
/** Consumer supported by a cssdoc example's audience flag. */
|
|
3
|
-
export type ExampleAudience = "automatica11y" | "canvas-rce" | "docs";
|
|
3
|
+
export type ExampleAudience = "automatica11y" | "canvas-rce" | "canvas-rce-no-interactions" | "docs";
|
|
4
4
|
/** Example indexes selected for each cssdoc consumer. */
|
|
5
5
|
export interface ExampleTargetSelection {
|
|
6
6
|
automatica11y: number[];
|
|
@@ -8,5 +8,7 @@ export interface ExampleTargetSelection {
|
|
|
8
8
|
docs: number[];
|
|
9
9
|
}
|
|
10
10
|
/** Resolve example indexes for each consumer while preserving the pre-flag defaults. */
|
|
11
|
-
export declare function resolveExampleTargets(examples: readonly string[]
|
|
11
|
+
export declare function resolveExampleTargets(examples: readonly string[], options?: {
|
|
12
|
+
interactions?: boolean;
|
|
13
|
+
}): ExampleTargetSelection;
|
|
12
14
|
//#endregion
|
package/dist/example-targets.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const AUDIENCE_FLAGS = /* @__PURE__ */ new Map([
|
|
3
3
|
["-automatica11y", "automatica11y"],
|
|
4
4
|
["-canvas-rce", "canvas-rce"],
|
|
5
|
+
["-canvas-rce-no-interactions", "canvas-rce-no-interactions"],
|
|
5
6
|
["-docs", "docs"]
|
|
6
7
|
]);
|
|
7
8
|
function audienceFlags(example) {
|
|
@@ -18,13 +19,14 @@ function audienceFlags(example) {
|
|
|
18
19
|
return flags;
|
|
19
20
|
}
|
|
20
21
|
/** Resolve example indexes for each consumer while preserving the pre-flag defaults. */
|
|
21
|
-
function resolveExampleTargets(examples) {
|
|
22
|
+
function resolveExampleTargets(examples, options = {}) {
|
|
22
23
|
const flags = examples.map(audienceFlags);
|
|
23
24
|
const explicit = (audience) => flags.flatMap((exampleFlags, index) => exampleFlags.has(audience) ? [index] : []);
|
|
24
25
|
const automatica11y = explicit("automatica11y");
|
|
25
|
-
const
|
|
26
|
+
const withoutInteractions = explicit("canvas-rce-no-interactions");
|
|
27
|
+
const canvasRce = options.interactions === false && withoutInteractions.length > 0 ? withoutInteractions : explicit("canvas-rce");
|
|
26
28
|
const docs = explicit("docs");
|
|
27
|
-
if (
|
|
29
|
+
if (flags.every((exampleFlags) => exampleFlags.size === 0)) return {
|
|
28
30
|
automatica11y: [],
|
|
29
31
|
canvasRce: examples.length === 0 ? [] : [0],
|
|
30
32
|
docs: examples.map((_, index) => index)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantoken/utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Shared pantoken helpers: token reference resolver, typed regexes (arkregex), name-case, and hex-colour parsing.",
|
|
5
5
|
"homepage": "https://pantoken.app",
|
|
6
6
|
"bugs": "https://github.com/thedannywahl/pantoken/issues",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"provenance": true
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pantoken/model": "0.
|
|
30
|
+
"@pantoken/model": "0.6.0",
|
|
31
31
|
"arkregex": "^0.0.12",
|
|
32
32
|
"css-tree": "^3.2.1"
|
|
33
33
|
},
|