@tangle-network/brand 1.23.0 → 1.23.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.
- package/CHANGELOG.md +6 -0
- package/bin/tangle-drift.mjs +13 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9e9dec0: tangle-drift no longer counts issue references in comments ("React error #310", "(#346)") as hex colours. hex reads whole files with comments blanked (/* */, //, <!-- -->), like header_height_literal and transcript_type_override. A Hospitality recovery release failed on such a comment.
|
|
8
|
+
|
|
3
9
|
## 1.23.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/bin/tangle-drift.mjs
CHANGED
|
@@ -55,7 +55,6 @@ const PRIMS = "Button|IconButton|Badge|Card|Chip|Tag|Pill|Avatar|Dialog|Modal|Sh
|
|
|
55
55
|
/** PCRE patterns, passed to `git grep -P`. */
|
|
56
56
|
export const PATTERNS = {
|
|
57
57
|
raw_palette: String.raw`\b(?:bg|text|border|ring|fill|stroke|from|to|via|outline|divide|decoration|accent|caret|shadow)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-[0-9]{2,3}\b`,
|
|
58
|
-
hex: String.raw`#[0-9a-fA-F]{6}\b|#[0-9a-fA-F]{3}\b`,
|
|
59
58
|
arbitrary_color: String.raw`-\[(?:#|rgb|hsl|oklch)`,
|
|
60
59
|
css_var_defs: String.raw`^\s*--[a-zA-Z0-9-]+\s*:`,
|
|
61
60
|
local_primitive_count: String.raw`export\s+(?:default\s+)?(?:function|const)\s+(?:${PRIMS})\b`,
|
|
@@ -93,6 +92,12 @@ const LITERAL_HEIGHT_UTILITY = String.raw`(?<![\w-])(?:h|min-h|max-h)-(?:[0-9]|\
|
|
|
93
92
|
* `git grep -l` and the same pathspecs, so the excluded paths match the line metrics.
|
|
94
93
|
*/
|
|
95
94
|
export const RULE_PATTERNS = {
|
|
95
|
+
// A colour literal: `#rgb` or `#rrggbb`. Read as a rule metric so comments are blanked first: an
|
|
96
|
+
// issue reference such as "React error #310" or "(#346)" in a comment is not a colour.
|
|
97
|
+
hex: {
|
|
98
|
+
prefilter: String.raw`#[0-9a-fA-F]{3}`,
|
|
99
|
+
patterns: [String.raw`#[0-9a-fA-F]{6}\b|#[0-9a-fA-F]{3}\b`],
|
|
100
|
+
},
|
|
96
101
|
// A header row given its own height. The shell owns one header height
|
|
97
102
|
// (`--shell-header-height`, `ShellHeader`); content fills the row and never sets it, so the
|
|
98
103
|
// main pane's divider lands on the sidebar's. Token references (`var(--shell-header-height)`)
|
|
@@ -124,7 +129,8 @@ const LOCAL_PRIM_NAME = new RegExp(String.raw`(?:function|const)\s+(${PRIMS})\b`
|
|
|
124
129
|
const SHARED = ["@tangle-network/brand", "@tangle-network/ui", "@tangle-network/sandbox-ui", "@tangle-network/agent-app"];
|
|
125
130
|
|
|
126
131
|
/** The counts the gate ratchets. Everything else in a row is informational. */
|
|
127
|
-
|
|
132
|
+
const LINE_METRICS = Object.keys(PATTERNS);
|
|
133
|
+
export const GATED = [LINE_METRICS[0], "hex", ...LINE_METRICS.slice(1), ...Object.keys(RULE_PATTERNS).filter((m) => m !== "hex")];
|
|
128
134
|
|
|
129
135
|
function extensions(surface, metric) {
|
|
130
136
|
const extra = SURFACES[surface]?.extraExt ?? [];
|
|
@@ -202,7 +208,11 @@ export function ruleMatches(source, roots, metric, exts) {
|
|
|
202
208
|
for (const path of files) {
|
|
203
209
|
// Comments name things without styling them (a CSS note that mentions "transcript" or
|
|
204
210
|
// "header"); blank them, keeping offsets and newlines, so only real rules count.
|
|
205
|
-
const
|
|
211
|
+
const blank = (comment) => comment.replace(/[^\n]/g, " ");
|
|
212
|
+
const text = readFile(source, path)
|
|
213
|
+
.replace(/\/\*[\s\S]*?\*\//g, blank)
|
|
214
|
+
.replace(/<!--[\s\S]*?-->/g, blank)
|
|
215
|
+
.replace(/(^|[\s;{}(])\/\/[^\n]*/gm, (m, lead) => lead + blank(m.slice(lead.length)));
|
|
206
216
|
const found = new Map();
|
|
207
217
|
for (const pattern of patterns) {
|
|
208
218
|
for (const m of text.matchAll(new RegExp(pattern, "g"))) found.set(m.index, m[0]);
|
package/package.json
CHANGED