basalt-ui 2.27.2 → 2.29.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/CHANGELOG.md +466 -307
- package/MIGRATING.md +358 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +12 -6
- package/agent/skills/basalt-design/references/catalogue.md +42 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +112 -3
- package/configs/oxlint-plugin.test.ts +99 -4
- package/configs/oxlint.json +1 -0
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +14 -7
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +112 -23
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +14 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +155 -44
- package/dist/charts/chart-box.module.css +59 -2
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +28 -17
- package/dist/charts/chart-card.module.css.d.ts +3 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +38 -27
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +37 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +55 -10
- package/dist/charts/sparkline.module.css +50 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +4 -4
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +23 -5
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +34 -2
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +95 -12
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +5 -5
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +15 -8
- package/dist/dashboard/bar-list.module.css +21 -5
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +247 -0
- package/dist/dashboard/board.module.css +179 -0
- package/dist/dashboard/board.module.css.d.ts +28 -0
- package/dist/dashboard/empty-state.d.ts +6 -6
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +17 -8
- package/dist/dashboard/event-list-model.d.ts +54 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +76 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +89 -0
- package/dist/dashboard/event-list-scroll.d.ts +55 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +216 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +34 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +208 -0
- package/dist/dashboard/event-list.module.css +336 -0
- package/dist/dashboard/event-list.module.css.d.ts +34 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +36 -6
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +20 -12
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +29 -11
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +8 -5
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +12 -8
- package/dist/dashboard/settings-section.module.css +25 -4
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +47 -12
- package/dist/dashboard/stat-card.module.css +42 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +8 -6
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +12 -15
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +69 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +47 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +180 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +155 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +320 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +13 -28
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +362 -255
- package/dist/table/data-table.module.css +282 -3
- package/dist/table/data-table.module.css.d.ts +16 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +55 -2
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +295 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +175 -31
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +213 -48
- package/src/charts/chart-box.module.css +59 -2
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +28 -17
- package/src/charts/chart-card.module.css.d.ts +3 -0
- package/src/charts/compile.ts +59 -33
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +114 -18
- package/src/charts/sparkline.module.css +50 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +40 -10
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +138 -16
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/empty-copy.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +21 -5
- package/src/dashboard/bar-list.tsx +53 -45
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +179 -0
- package/src/dashboard/board.module.css.d.ts +28 -0
- package/src/dashboard/board.tsx +415 -0
- package/src/dashboard/empty-state.tsx +21 -11
- package/src/dashboard/event-list-model.ts +125 -0
- package/src/dashboard/event-list-rows.tsx +117 -0
- package/src/dashboard/event-list-scroll.ts +291 -0
- package/src/dashboard/event-list-skeleton.tsx +62 -0
- package/src/dashboard/event-list.module.css +336 -0
- package/src/dashboard/event-list.module.css.d.ts +34 -0
- package/src/dashboard/event-list.tsx +336 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +53 -14
- package/src/dashboard/meter.module.css +20 -12
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +55 -30
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +25 -4
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +18 -8
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +42 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +55 -13
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +8 -6
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +12 -15
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +7 -1
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +69 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +263 -0
- package/src/table/data-table-fold.tsx +567 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +282 -3
- package/src/table/data-table.module.css.d.ts +16 -0
- package/src/table/data-table.tsx +430 -362
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +55 -2
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
package/dist/cli/shot/capture.js
CHANGED
|
@@ -23,6 +23,7 @@ const TAB_PRESSES = 80;
|
|
|
23
23
|
const FOCUS_MARGIN_PX = 8;
|
|
24
24
|
const TIP_PROBE_MS = 250;
|
|
25
25
|
const TIP_SETTLE_MS = 60;
|
|
26
|
+
const TIP_CLEAR_MS = 1e3;
|
|
26
27
|
const TIP_SETTLE_READS = 10;
|
|
27
28
|
class NotDeclared extends Error {
|
|
28
29
|
}
|
|
@@ -36,6 +37,7 @@ function within(what, work, ms = STEP_TIMEOUT_MS) {
|
|
|
36
37
|
});
|
|
37
38
|
return Promise.race([work, late]).finally(() => clearTimeout(timer));
|
|
38
39
|
}
|
|
40
|
+
const SAME_CONTENT_WARNING = "[shot] warning: every route rendered the same content \u2014 a lock screen or auth wall? see --api";
|
|
39
41
|
const hash = (text) => createHash("sha1").update(text).digest("hex").slice(0, 6);
|
|
40
42
|
const slug = (text) => text.replace(/[^\w-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
41
43
|
const firstLine = (error) => (error instanceof Error ? error.message : String(error)).split("\n")[0] ?? "";
|
|
@@ -95,18 +97,26 @@ async function load(page, url, settle = 0) {
|
|
|
95
97
|
if (settle > 0) await new Promise((done) => setTimeout(done, settle));
|
|
96
98
|
}
|
|
97
99
|
function tagAutoAnchors() {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const tag = (selector) => {
|
|
101
|
+
let tagged = 0;
|
|
102
|
+
Array.from(document.querySelectorAll(selector)).forEach((el, i) => {
|
|
103
|
+
const { width, height } = el.getBoundingClientRect();
|
|
104
|
+
if (width <= 120 || height <= 60) return;
|
|
102
105
|
el.setAttribute("data-shot", `auto-${String(i + 1).padStart(2, "0")}`);
|
|
103
|
-
|
|
106
|
+
tagged++;
|
|
107
|
+
});
|
|
108
|
+
return tagged;
|
|
109
|
+
};
|
|
110
|
+
if (tag(".mantine-Card-root, .mantine-Paper-root, table") === 0)
|
|
111
|
+
tag("main, section, header, form");
|
|
104
112
|
}
|
|
105
113
|
const STATE_SURFACE = '[data-basalt-chart-card], [data-basalt-chart-state], [style*="container-name: basalt-card"]';
|
|
106
114
|
const readFacts = (page) => page.evaluate(`(() => { const STATE_SURFACE = ${JSON.stringify(STATE_SURFACE)}; return {
|
|
107
115
|
anchors: [...new Set([...document.querySelectorAll('[data-shot]')].map((e) => e.getAttribute('data-shot')).filter(Boolean))],
|
|
108
116
|
declared: [...document.querySelectorAll('[data-shot-states]')].flatMap((e) => (e.getAttribute('data-shot-states') ?? '').split(/\\s+/)).filter(Boolean),
|
|
117
|
+
declaring: [...new Set([...document.querySelectorAll('[data-shot]')].filter((e) => e.closest('[data-shot-states]') || e.querySelector('[data-shot-states]')).map((e) => e.getAttribute('data-shot')).filter(Boolean))],
|
|
109
118
|
stateful: [...new Set([...document.querySelectorAll('[data-shot]')].filter((e) => e.matches(STATE_SURFACE) || e.querySelector(STATE_SURFACE)).map((e) => e.getAttribute('data-shot')).filter(Boolean))],
|
|
119
|
+
content: document.body ? document.body.innerText : '',
|
|
110
120
|
absent: Object.fromEntries([...document.querySelectorAll('[data-shot][data-shot-absent]')].map((e) => [e.getAttribute('data-shot'), (e.getAttribute('data-shot-absent') ?? '').split(/\\s+/).filter(Boolean)])),
|
|
111
121
|
}; })()`);
|
|
112
122
|
const addProblem = (c, problem) => {
|
|
@@ -246,12 +256,20 @@ async function frame(c, name) {
|
|
|
246
256
|
return undo;
|
|
247
257
|
}
|
|
248
258
|
function hiddenScrollPx() {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
259
|
+
const hidden = (el) => Math.max(0, el.scrollHeight - el.clientHeight);
|
|
260
|
+
const declared = document.querySelector("[data-basalt-scrollport]");
|
|
261
|
+
if (declared !== null) return hidden(declared);
|
|
262
|
+
const scrolls = (el) => {
|
|
252
263
|
const { overflowY } = getComputedStyle(el);
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
return overflowY === "auto" || overflowY === "scroll";
|
|
265
|
+
};
|
|
266
|
+
let extra = 0;
|
|
267
|
+
for (const el of Array.from(document.body.querySelectorAll("*"))) {
|
|
268
|
+
if (el.clientHeight < window.innerHeight / 2 || !scrolls(el)) continue;
|
|
269
|
+
let nested = false;
|
|
270
|
+
for (let p = el.parentElement; p !== null && p !== document.documentElement; p = p.parentElement)
|
|
271
|
+
if (scrolls(p)) nested = true;
|
|
272
|
+
if (!nested) extra = Math.max(extra, hidden(el));
|
|
255
273
|
}
|
|
256
274
|
return extra;
|
|
257
275
|
}
|
|
@@ -319,6 +337,39 @@ function markVisibleTooltips() {
|
|
|
319
337
|
el.setAttribute("data-shot-seen", "");
|
|
320
338
|
}
|
|
321
339
|
}
|
|
340
|
+
function visibleTooltipCount() {
|
|
341
|
+
return Array.from(document.querySelectorAll('[role="tooltip"]')).filter((el) => {
|
|
342
|
+
const rect = el.getBoundingClientRect();
|
|
343
|
+
return rect.width > 0 && rect.height > 0 && getComputedStyle(el).visibility !== "hidden";
|
|
344
|
+
}).length;
|
|
345
|
+
}
|
|
346
|
+
async function clearStrayTooltips(page) {
|
|
347
|
+
await page.mouse.move(0, 0);
|
|
348
|
+
for (let waited = 0; waited < TIP_CLEAR_MS; waited += TIP_SETTLE_MS) {
|
|
349
|
+
if (await page.evaluate(visibleTooltipCount, void 0) === 0) return;
|
|
350
|
+
await sleep(TIP_SETTLE_MS);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function muteOtherTooltips(open) {
|
|
354
|
+
for (const el of Array.from(document.querySelectorAll('[role="tooltip"]'))) {
|
|
355
|
+
const rect = el.getBoundingClientRect();
|
|
356
|
+
if (el === open || rect.width === 0 || rect.height === 0) continue;
|
|
357
|
+
el.setAttribute("data-shot-muted", el.style.visibility);
|
|
358
|
+
el.style.setProperty("visibility", "hidden", "important");
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function claimOwnTooltip(trigger) {
|
|
362
|
+
const tips = Array.from(document.querySelectorAll('[role="tooltip"]'));
|
|
363
|
+
if (tips.some((el) => trigger.contains(el))) {
|
|
364
|
+
for (const el of tips) if (!trigger.contains(el)) el.setAttribute("data-shot-seen", "");
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function unmuteTooltips() {
|
|
368
|
+
for (const el of Array.from(document.querySelectorAll("[data-shot-muted]"))) {
|
|
369
|
+
el.style.visibility = el.getAttribute("data-shot-muted") ?? "";
|
|
370
|
+
el.removeAttribute("data-shot-muted");
|
|
371
|
+
}
|
|
372
|
+
}
|
|
322
373
|
function describedByOf(el) {
|
|
323
374
|
const named = el?.matches("[aria-describedby]") ? el : el?.querySelector("[aria-describedby]");
|
|
324
375
|
return named?.getAttribute("aria-describedby")?.split(/\s+/)[0] ?? "";
|
|
@@ -367,12 +418,19 @@ async function captureHover(c, name) {
|
|
|
367
418
|
await reveal(c, name, "hover");
|
|
368
419
|
const inner = c.page.locator(`${sel(name)} [data-shot-hover]`).first();
|
|
369
420
|
const target = await inner.count() > 0 ? inner : anchor;
|
|
421
|
+
await clearStrayTooltips(c.page);
|
|
370
422
|
await c.page.evaluate(markVisibleTooltips, void 0);
|
|
371
423
|
await hoverTrigger(target);
|
|
372
424
|
const describedBy = idOf(await target.evaluate(describedByOf));
|
|
425
|
+
if (describedBy === "") await target.evaluate(claimOwnTooltip);
|
|
373
426
|
const [box, tip] = [await settledBox(anchor), await openTooltipBox(c, describedBy)];
|
|
374
427
|
if (!box || !tip) return void await snap(anchor, path);
|
|
375
|
-
|
|
428
|
+
try {
|
|
429
|
+
await tipOf(c, describedBy).evaluate(muteOtherTooltips);
|
|
430
|
+
await snapClip(c, path, [anchor, tipOf(c, describedBy)]);
|
|
431
|
+
} finally {
|
|
432
|
+
await c.page.evaluate(unmuteTooltips, void 0).catch(() => void 0);
|
|
433
|
+
}
|
|
376
434
|
});
|
|
377
435
|
await c.page.mouse.move(0, 0);
|
|
378
436
|
}
|
|
@@ -422,9 +480,11 @@ async function captureTooltip(c, name) {
|
|
|
422
480
|
if (await trigger.count() === 0) throw new NotDeclared("no [data-shot-tooltip] in the anchor");
|
|
423
481
|
const anchor = anchorOf(c, name);
|
|
424
482
|
await reveal(c, name, "tooltip");
|
|
483
|
+
await clearStrayTooltips(c.page);
|
|
425
484
|
await c.page.evaluate(markVisibleTooltips, void 0);
|
|
426
485
|
await hoverTrigger(trigger);
|
|
427
486
|
const describedBy = idOf(await trigger.evaluate(describedByOf));
|
|
487
|
+
if (describedBy === "") await trigger.evaluate(claimOwnTooltip);
|
|
428
488
|
const t = await openTooltipBox(c, describedBy, TOOLTIP_TIMEOUT_MS);
|
|
429
489
|
if (!t) throw new Error('no visible [role="tooltip"] after hover');
|
|
430
490
|
const a = await settledBox(anchor);
|
|
@@ -439,6 +499,11 @@ const POINTER_STATES = {
|
|
|
439
499
|
focus: captureFocus,
|
|
440
500
|
tooltip: captureTooltip
|
|
441
501
|
};
|
|
502
|
+
function lacksStates(c, name, state) {
|
|
503
|
+
const { stateful, declaring, declared, absent } = c.facts;
|
|
504
|
+
const own = declaring ?? (declared.length > 0 ? c.facts.anchors : []);
|
|
505
|
+
return stateful?.includes(name) === true && !own.includes(name) && !absent?.[name]?.includes(state);
|
|
506
|
+
}
|
|
442
507
|
async function captureUrlState(c, state) {
|
|
443
508
|
const restNames = c.facts.anchors;
|
|
444
509
|
if (!c.facts.declared.includes(state)) {
|
|
@@ -448,7 +513,7 @@ async function captureUrlState(c, state) {
|
|
|
448
513
|
state,
|
|
449
514
|
status: "not-declared",
|
|
450
515
|
note: c.facts.declared.length === 0 ? NO_STATES_NOTE : "page does not declare this state",
|
|
451
|
-
...c
|
|
516
|
+
...lacksStates(c, name, state) ? { stateful: true } : {}
|
|
452
517
|
});
|
|
453
518
|
}
|
|
454
519
|
return;
|
|
@@ -472,6 +537,8 @@ async function captureUrlState(c, state) {
|
|
|
472
537
|
}
|
|
473
538
|
const note = restNames.includes(name) ? void 0 : "anchor only present in this state";
|
|
474
539
|
await attempt(c, name, state, (path) => restCrop(c, name, state, path), note);
|
|
540
|
+
const shot = c.shots.findLast((r) => r.name === name && r.state === state);
|
|
541
|
+
if (shot && shot.status !== "not-declared" && lacksStates(c, name, state)) shot.stateful = true;
|
|
475
542
|
}
|
|
476
543
|
}
|
|
477
544
|
const STEPS = ["xs", "sm", "md", "lg", "xl", "default"];
|
|
@@ -556,6 +623,7 @@ async function capturePage(args) {
|
|
|
556
623
|
input.apiProblems?.();
|
|
557
624
|
try {
|
|
558
625
|
c.facts = await visit(c, input.base + route);
|
|
626
|
+
if (c.facts.content) c.content = hash(c.facts.content);
|
|
559
627
|
} catch (error) {
|
|
560
628
|
record(c, {
|
|
561
629
|
name: PAGE_ANCHOR,
|
|
@@ -604,6 +672,11 @@ async function capturePage(args) {
|
|
|
604
672
|
await captureUrlState(c, state);
|
|
605
673
|
collect(c);
|
|
606
674
|
}
|
|
675
|
+
const atRest = new Set(c.shots.filter((s) => s.state === "rest").map((s) => s.name));
|
|
676
|
+
for (const name of new Set(c.shots.map((s) => s.name))) {
|
|
677
|
+
if (input.states.includes("rest") && !atRest.has(name) && !c.facts.anchors.includes(name))
|
|
678
|
+
record(c, { name, state: "rest", status: "absent", note: "not rendered at rest" });
|
|
679
|
+
}
|
|
607
680
|
flagProblems(c);
|
|
608
681
|
return c;
|
|
609
682
|
}
|
|
@@ -667,6 +740,7 @@ async function capture(input) {
|
|
|
667
740
|
scale: [],
|
|
668
741
|
scaleError: void 0
|
|
669
742
|
};
|
|
743
|
+
const contents = /* @__PURE__ */ new Map();
|
|
670
744
|
for (const scheme of SCHEMES) {
|
|
671
745
|
for (const viewport of VIEWPORTS) {
|
|
672
746
|
input.apiProblems?.();
|
|
@@ -694,6 +768,7 @@ async function capture(input) {
|
|
|
694
768
|
out.scale.push({ scheme, viewport, ...done.scale });
|
|
695
769
|
scaled = true;
|
|
696
770
|
}
|
|
771
|
+
if (done.content && !contents.has(route)) contents.set(route, done.content);
|
|
697
772
|
if (done.scaleError) out.scaleError = out.scaleError ?? done.scaleError;
|
|
698
773
|
out.anchors.push(...done.anchors);
|
|
699
774
|
out.shots.push(...done.shots);
|
|
@@ -703,6 +778,8 @@ async function capture(input) {
|
|
|
703
778
|
}
|
|
704
779
|
}
|
|
705
780
|
}
|
|
781
|
+
if (input.routes.length > 1 && contents.size === new Set(input.routes).size && new Set(contents.values()).size === 1)
|
|
782
|
+
input.log(SAME_CONTENT_WARNING);
|
|
706
783
|
await writeSheets(input, out).catch(
|
|
707
784
|
(error) => input.log(`[shot] contact sheets not written: ${firstLine(error)}`)
|
|
708
785
|
);
|
|
@@ -712,7 +789,10 @@ async function capture(input) {
|
|
|
712
789
|
return { anchors, shots, scale, scaleError: out.scaleError };
|
|
713
790
|
}
|
|
714
791
|
export {
|
|
792
|
+
SAME_CONTENT_WARNING,
|
|
715
793
|
capture,
|
|
794
|
+
claimOwnTooltip,
|
|
795
|
+
clearStrayTooltips,
|
|
716
796
|
describedByOf,
|
|
717
797
|
fileName,
|
|
718
798
|
groupScale,
|
|
@@ -722,6 +802,7 @@ export {
|
|
|
722
802
|
hoverAtOf,
|
|
723
803
|
hoverTrigger,
|
|
724
804
|
markVisibleTooltips,
|
|
805
|
+
muteOtherTooltips,
|
|
725
806
|
openContext,
|
|
726
807
|
parseHoverAt,
|
|
727
808
|
readScaleInPage,
|
|
@@ -732,6 +813,8 @@ export {
|
|
|
732
813
|
tagAutoAnchors,
|
|
733
814
|
tooltipSelector,
|
|
734
815
|
unionClip,
|
|
816
|
+
unmuteTooltips,
|
|
735
817
|
visibleTooltip,
|
|
818
|
+
visibleTooltipCount,
|
|
736
819
|
withParam
|
|
737
820
|
};
|
|
@@ -41,7 +41,10 @@ export type HistoryEntry = {
|
|
|
41
41
|
out: string;
|
|
42
42
|
commit?: string;
|
|
43
43
|
counts: Record<Severity, number>;
|
|
44
|
-
|
|
44
|
+
/** Null when no anchor resolved: nothing was measured, so there is no score. */
|
|
45
|
+
score: number | null;
|
|
46
|
+
/** Total findings: the score floors at 0, this keeps counting. */
|
|
47
|
+
findings?: number;
|
|
45
48
|
};
|
|
46
49
|
export declare const scoreOf: (findings: readonly Finding[]) => number;
|
|
47
50
|
/** Every deterministic finding of one round, grouped across scheme × viewport, content → layout → style. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/detect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/detect.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAwB,WAAW,EAAS,MAAM,SAAS,CAAA;AAEvE,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAChD,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElD,MAAM,MAAM,OAAO,GAAG;IACpB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,KAAK,EAAE,KAAK,CAAA;IACZ,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,kEAAkE;AAClE,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE;QACX,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE;gBAAE,IAAI,CAAC,EAAE,MAAM,CAAC;gBAAC,MAAM,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,EAAE,CAAA;KACzD,EAAE,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;IAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC5B,mFAAmF;IACnF,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAChC,gFAAgF;IAChF,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAcD,eAAO,MAAM,OAAO,GAAI,UAAU,SAAS,OAAO,EAAE,KAAG,MACsB,CAAA;AAiK7E,4GAA4G;AAC5G,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,EAAE,CA4F3E;AAyID,yFAAyF;AACzF,wBAAsB,MAAM,CAC1B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC,MAAM,CAAC,CAoEjB"}
|
package/dist/cli/shot/detect.js
CHANGED
|
@@ -2,7 +2,8 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
|
-
import {
|
|
5
|
+
import { contrastThreshold } from "./measure.js";
|
|
6
|
+
import { PAGE_ANCHOR, SHOT_HOME } from "./types.js";
|
|
6
7
|
const LAYERS = ["content", "layout", "style"];
|
|
7
8
|
const SEVERITIES = ["P0", "P1", "P2", "P3"];
|
|
8
9
|
const WEIGHT = { P0: 25, P1: 10, P2: 3, P3: 1 };
|
|
@@ -121,7 +122,7 @@ function anchorFindings(a, scale) {
|
|
|
121
122
|
severity: "P0",
|
|
122
123
|
layer: "content",
|
|
123
124
|
cite: cite("contrast.failures"),
|
|
124
|
-
defect: `${failures.length} text run${failures.length === 1 ? "" : "s"} below the AA contrast threshold; lowest ${worst.ratio}:1 on "${worst.text}" (${worst.fontSize}px).`
|
|
125
|
+
defect: `${failures.length} text run${failures.length === 1 ? "" : "s"} below the AA contrast threshold; lowest ${worst.ratio}:1 on "${worst.text}" (needs ${worst.needs ?? contrastThreshold(worst.fontSize, worst.bold ?? false)}:1 at ${worst.fontSize}px${worst.bold === void 0 ? "" : worst.bold ? " bold" : " regular"}).`
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
if (a.contrast.backdrop === "assumed-white") {
|
|
@@ -183,18 +184,18 @@ function detectFindings(m, lint) {
|
|
|
183
184
|
}
|
|
184
185
|
const stateful = /* @__PURE__ */ new Map();
|
|
185
186
|
for (const s of m.shots) {
|
|
186
|
-
if (s.
|
|
187
|
-
stateful.set(s.route
|
|
187
|
+
if (!s.stateful || s.status === "absent") continue;
|
|
188
|
+
stateful.set(`${s.route}\0${s.name}`, { route: s.route, name: s.name });
|
|
188
189
|
}
|
|
189
|
-
for (const
|
|
190
|
+
for (const { route, name } of stateful.values()) {
|
|
190
191
|
drafts.push({
|
|
191
192
|
...scan,
|
|
192
193
|
rule: "craft-7/no-declared-states",
|
|
193
194
|
severity: "P2",
|
|
194
|
-
anchor:
|
|
195
|
+
anchor: name,
|
|
195
196
|
route,
|
|
196
|
-
cite: `metrics.json shots[${route}
|
|
197
|
-
defect: `${
|
|
197
|
+
cite: `metrics.json shots[${route} ${name} stateful]`,
|
|
198
|
+
defect: `${name} renders a state surface but declares no data-shot-states of its own, so empty, loading and error were never scored: add data-shot-states="empty loading error" to it, or data-shot-absent for a state it never shows.`
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
if (m.scaleError || m.scale.length === 0) {
|
|
@@ -329,7 +330,7 @@ function persist(files, log) {
|
|
|
329
330
|
writeFileSync(`${detectPath}.tmp`, json(report));
|
|
330
331
|
renameSync(`${historyPath}.tmp`, historyPath);
|
|
331
332
|
renameSync(`${detectPath}.tmp`, detectPath);
|
|
332
|
-
return runs.
|
|
333
|
+
return runs.filter((r) => r.out === entry.out).slice(-TREND_RUNS);
|
|
333
334
|
});
|
|
334
335
|
}
|
|
335
336
|
const compactWhere = (w) => w.length >= 4 ? "all" : w.join(",");
|
|
@@ -351,12 +352,20 @@ async function detect(flags, cwd, deps = {}) {
|
|
|
351
352
|
try {
|
|
352
353
|
let values;
|
|
353
354
|
try {
|
|
354
|
-
|
|
355
|
+
const parsed = parseArgs({
|
|
355
356
|
args: [...flags],
|
|
356
357
|
options: { out: { type: "string" }, lint: { type: "string" } },
|
|
357
|
-
|
|
358
|
-
})
|
|
358
|
+
allowPositionals: true
|
|
359
|
+
});
|
|
360
|
+
const [positional] = parsed.positionals;
|
|
361
|
+
if (positional !== void 0)
|
|
362
|
+
throw new DetectError(
|
|
363
|
+
`detect takes --out <dir>, not a positional ('${positional}'): basalt-ui shot detect --out ${positional}`
|
|
364
|
+
);
|
|
365
|
+
values = parsed.values;
|
|
359
366
|
} catch (error) {
|
|
367
|
+
if (error instanceof DetectError) throw new DetectError(`${error.message}
|
|
368
|
+
${USAGE_LINE}`);
|
|
360
369
|
throw new DetectError(
|
|
361
370
|
`${error instanceof Error ? error.message : String(error)}
|
|
362
371
|
${USAGE_LINE}`
|
|
@@ -367,7 +376,7 @@ ${USAGE_LINE}`
|
|
|
367
376
|
const lint = values.lint ? readLint(resolve(cwd, values.lint)) : void 0;
|
|
368
377
|
const findings = detectFindings(metrics, lint);
|
|
369
378
|
const counts = countsOf(findings);
|
|
370
|
-
const score = scoreOf(findings);
|
|
379
|
+
const score = metrics.anchors.length === 0 ? null : scoreOf(findings);
|
|
371
380
|
const at = (deps.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
|
|
372
381
|
const rel = relative(cwd, outDir);
|
|
373
382
|
const out = rel === "" || rel.startsWith("..") || isAbsolute(rel) ? outDir : rel;
|
|
@@ -377,16 +386,29 @@ ${USAGE_LINE}`
|
|
|
377
386
|
detectPath: join(outDir, "detect.json"),
|
|
378
387
|
report: { version: 1, at, out, ...commit && { commit }, counts, score, findings },
|
|
379
388
|
home: join(cwd, SHOT_HOME),
|
|
380
|
-
entry: {
|
|
389
|
+
entry: {
|
|
390
|
+
at,
|
|
391
|
+
out,
|
|
392
|
+
...commit && { commit },
|
|
393
|
+
counts,
|
|
394
|
+
score,
|
|
395
|
+
findings: findings.length
|
|
396
|
+
}
|
|
381
397
|
},
|
|
382
398
|
log
|
|
383
399
|
);
|
|
384
400
|
const summary = SEVERITIES.filter((s) => counts[s] > 0).map((s) => `${s} ${counts[s]}`).join(", ");
|
|
385
401
|
log(
|
|
386
|
-
`[detect] ${findings.length === 0 ? "no findings" : `${findings.length} findings (${summary})`} \xB7 score ${score}`
|
|
402
|
+
`[detect] ${findings.length === 0 ? "no findings" : `${findings.length} findings (${summary})`} \xB7 ${score === null ? "nothing measured (no anchor resolved: not a score)" : `score ${score}`}`
|
|
387
403
|
);
|
|
388
404
|
for (const line of table(findings)) log(line);
|
|
389
|
-
|
|
405
|
+
const point = (r) => {
|
|
406
|
+
const n = r.findings === void 0 ? "" : ` (${r.findings} findings)`;
|
|
407
|
+
return `${r.score ?? "nothing measured"}${n}`;
|
|
408
|
+
};
|
|
409
|
+
log(
|
|
410
|
+
`[detect] trend ${trend.map(point).join(" \u2192 ")} \xB7 ${relative(cwd, join(outDir, "detect.json"))}`
|
|
411
|
+
);
|
|
390
412
|
return counts.P0 + counts.P1 > 0 ? 2 : 0;
|
|
391
413
|
} catch (error) {
|
|
392
414
|
if (!(error instanceof DetectError)) throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,SAAS,CAAA;AAQrD,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,OAAO,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;IAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,2EAA2E;IAC3E,YAAY,EAAE,IAAI,EAAE,CAAA;IACpB,GAAG,EAAE,QAAQ,EAAE,CAAA;IACf,OAAO,EAAE,IAAI,EAAE,CAAA;IACf,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,GAAE,MAAiD,GACrD,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,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wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,IAAI,EACT,KAAK,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAkB,GACzC,IAAI,CAoBN;AAKD,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,GAAG,EAAE,IAAI,GACR,IAAI,CA0BN;AAkBD,wBAAsB,IAAI,CACxB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,MAAM,CAAC,CAqFjB;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/cli/shot/index.js
CHANGED
|
@@ -52,6 +52,12 @@ ${USAGE_LINE}`);
|
|
|
52
52
|
const bad = positionals.find((r) => !r.startsWith("/"));
|
|
53
53
|
if (bad) throw new ShotError(`route '${bad}' must start with '/'.
|
|
54
54
|
${USAGE_LINE}`);
|
|
55
|
+
const spaced = positionals.find((r) => /\s/.test(r));
|
|
56
|
+
if (spaced)
|
|
57
|
+
throw new ShotError(
|
|
58
|
+
`route '${spaced}' contains whitespace: pass each route as its own argument (zsh does not word-split $ROUTES; use \${=ROUTES} or an array).
|
|
59
|
+
${USAGE_LINE}`
|
|
60
|
+
);
|
|
55
61
|
if (Boolean(values.base) === Boolean(values.dist)) {
|
|
56
62
|
throw new ShotError(`pass exactly one of --base <url> or --dist <dir>.
|
|
57
63
|
${USAGE_LINE}`);
|
|
@@ -116,7 +122,8 @@ function planOut(cwd, out) {
|
|
|
116
122
|
const refuse = (why) => {
|
|
117
123
|
throw new ShotError(`--out ${out} ${why}`);
|
|
118
124
|
};
|
|
119
|
-
|
|
125
|
+
const inProject = `a directory inside the project (${cwd}; in a monorepo, the app dir)`;
|
|
126
|
+
if (rel === "" || outside(rel)) refuse(`must be ${inProject}`);
|
|
120
127
|
if (relative(join(cwd, HOME), dir) === "")
|
|
121
128
|
refuse("is the shot home (holds last.json); use a subdirectory");
|
|
122
129
|
if (rel === ".basalt" || rel.split(sep).some((part) => PROTECTED_SEGMENTS.has(part))) {
|
|
@@ -132,7 +139,7 @@ function planOut(cwd, out) {
|
|
|
132
139
|
} catch {
|
|
133
140
|
refuse("sits behind a dangling symlink");
|
|
134
141
|
}
|
|
135
|
-
if (outside(relative(realpathSync(cwd), real))) refuse(
|
|
142
|
+
if (outside(relative(realpathSync(cwd), real))) refuse(`resolves outside the project (${cwd})`);
|
|
136
143
|
if (probe === dir) {
|
|
137
144
|
if (!statSync(dir).isDirectory()) refuse("exists and is not a directory");
|
|
138
145
|
if (readdirSync(dir).length > 0 && !isPreviousShot(dir)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/measure.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,SAAS,CAAA;AAS3D,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAGhF;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAEzE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,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HANGED
|
@@ -28,8 +28,17 @@ function finishMeasurement({ texts, radius, nested, ...rest }) {
|
|
|
28
28
|
const exact = contrastRatio(t.fg, t.bg);
|
|
29
29
|
const ratio = Math.round(exact * 100) / 100;
|
|
30
30
|
min = min === null ? ratio : Math.min(min, ratio);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const needs = contrastThreshold(t.fontSize, t.bold);
|
|
32
|
+
if (exact < needs) {
|
|
33
|
+
failures.push({
|
|
34
|
+
text: t.text,
|
|
35
|
+
ratio,
|
|
36
|
+
fg: hex(t.fg),
|
|
37
|
+
bg: hex(t.bg),
|
|
38
|
+
fontSize: t.fontSize,
|
|
39
|
+
needs,
|
|
40
|
+
bold: t.bold
|
|
41
|
+
});
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
const backdrop = texts.some((t) => t.assumedWhite) ? { backdrop: "assumed-white" } : {};
|
package/dist/cli/shot/types.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ export type ContrastFailure = {
|
|
|
29
29
|
fg: string;
|
|
30
30
|
bg: string;
|
|
31
31
|
fontSize: number;
|
|
32
|
+
/** The WCAG threshold applied (3 for large text, else 4.5); absent in older metrics.json. */
|
|
33
|
+
needs?: number;
|
|
34
|
+
bold?: boolean;
|
|
32
35
|
};
|
|
33
36
|
/** What the in-page measurer returns for one anchor. */
|
|
34
37
|
export type Measurement = {
|
|
@@ -77,7 +80,7 @@ export type ShotRecord = {
|
|
|
77
80
|
/** `absent`: the anchor declared itself missing in this state (`data-shot-absent`): not a defect. */
|
|
78
81
|
status: 'ok' | 'not-declared' | 'absent' | 'skipped' | 'error';
|
|
79
82
|
note?: string;
|
|
80
|
-
/** The anchor renders a basalt state surface (a ChartCard, StatCard or chart state)
|
|
83
|
+
/** The anchor renders a basalt state surface (a ChartCard, StatCard or chart state) but declares no `data-shot-states` of its own (and no `data-shot-absent` for this state). */
|
|
81
84
|
stateful?: true;
|
|
82
85
|
};
|
|
83
86
|
/** The theme's resolved steps (px) for one scheme × viewport; a missing custom property is omitted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/shot/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,4BAA6B,CAAA;AACjD,eAAO,MAAM,SAAS,gCAAiC,CAAA;AACvD,eAAO,MAAM,MAAM,6EAA8E,CAAA;AACjG,uGAAuG;AACvG,eAAO,MAAM,UAAU,wCAAyC,CAAA;AAEhE,4EAA4E;AAC5E,eAAO,MAAM,SAAS,kBAAkB,CAAA;AAExC,6HAA6H;AAC7H,eAAO,MAAM,cAAc,sCAAsC,CAAA;AAEjE,6EAA6E;AAC7E,eAAO,MAAM,WAAW,UAAU,CAAA;AAElC,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AACjD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAI7F,CAAA;AAEH,MAAM,MAAM,KAAK,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":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AG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAA;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iLAAiL;IACjL,QAAQ,CAAC,EAAE,IAAI,CAAA;CAChB,CAAA;AAED,uGAAuG;AACvG,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,CAAC,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB,KAAK,EAAE,KAAK,EAAE,CAAA;IACd,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA"}
|
package/dist/cli/sync.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/cli/sync.ts"],"names":[],"mappings":"AAiDA,gGAAgG;AAChG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAGjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mGAAmG;IACnG,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKrF;AAQD;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,WAAgB,EAAE,aAAa,GAAE,MAAsB,GAAG,MAAM,CA0P1F"}
|
package/dist/cli/sync.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
resolveProjectDir,
|
|
33
33
|
routerSeedPlan,
|
|
34
34
|
rootsNotices,
|
|
35
|
+
rootToolingStates,
|
|
35
36
|
sha256,
|
|
36
37
|
shippedAssetPath,
|
|
37
38
|
START_APP_NOTE,
|
|
@@ -168,9 +169,16 @@ function sync(opts = {}, invocationCwd = process.cwd()) {
|
|
|
168
169
|
}
|
|
169
170
|
if (seedSkip === "start" && (!opts.check || syncFlags.includes("--verbose")))
|
|
170
171
|
console.log(`basalt-ui sync: ${START_APP_NOTE}`);
|
|
171
|
-
const
|
|
172
|
+
const states = rootToolingStates(cwd, placement, ctx);
|
|
173
|
+
const notices = placementNotices(cwd, placement);
|
|
174
|
+
const placementSkips = notices.filter((_, i) => states[i] !== "in sync");
|
|
172
175
|
if (opts.check !== true || syncFlags.includes("--verbose")) {
|
|
173
|
-
|
|
176
|
+
states.forEach((st, i) => {
|
|
177
|
+
const file = i === 0 ? "lefthook.yml" : "check.yml";
|
|
178
|
+
console.log(
|
|
179
|
+
`basalt-ui sync: ${file} at the repo root: ${st}${st === "in sync" ? "" : ` \u2014 ${notices[i]}`}`
|
|
180
|
+
);
|
|
181
|
+
});
|
|
174
182
|
}
|
|
175
183
|
const rootsMessages = rootsNotices(rootsState);
|
|
176
184
|
for (const line of rootsMessages.log) console.log(`basalt-ui sync: ${line}`);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The title of the host region a `QueryState` sits in (`Section` sets it), so the error default
|
|
3
|
+
* names it — "Could not load practice record" — instead of the bare "Could not load". An explicit
|
|
4
|
+
* `errorTitle` still wins; outside any host it is `undefined` and nothing changes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HostTitleContext: import("react").Context<string | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* The error title a component names itself in: "Revenue" → "Could not load revenue". A leading
|
|
9
|
+
* capital followed by another capital or a non-letter ("KPI", "MRR", "2024 sales") keeps its case;
|
|
10
|
+
* a missing or blank label stays the bare "Could not load". Mantine-free: `charts/**` imports it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function couldNotLoad(label?: string): string;
|
|
13
|
+
//# sourceMappingURL=could-not-load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"could-not-load.d.ts","sourceRoot":"","sources":["../../src/common/could-not-load.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6CAA+C,CAAA;AAE5E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOnD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const HostTitleContext = createContext(void 0);
|
|
3
|
+
function couldNotLoad(label) {
|
|
4
|
+
const noun = label?.trim();
|
|
5
|
+
if (!noun) return "Could not load";
|
|
6
|
+
const lead = noun.charAt(0);
|
|
7
|
+
const second = noun.charAt(1);
|
|
8
|
+
const lowers = second !== "" && second === second.toLowerCase() && second !== second.toUpperCase();
|
|
9
|
+
return `Could not load ${lowers ? lead.toLowerCase() : lead}${noun.slice(1)}`;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
HostTitleContext,
|
|
13
|
+
couldNotLoad
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The empty tile's copy from the one string a host carries (`ChartState.empty`, `StatCard`'s
|
|
3
|
+
* `emptyText`), as `EmptyState` reads it (SPEC § 6.11): the title (why it is empty) and the muted
|
|
4
|
+
* line (what to do).
|
|
5
|
+
*
|
|
6
|
+
* One rule: the title is everything up to the first `.`, `!` or `?` that is followed by whitespace
|
|
7
|
+
* or ends the string; the description is the rest. Both parts are trimmed, and a trailing `.` is
|
|
8
|
+
* dropped from the title only (a `?` or `!` stays, the description keeps its own punctuation). An
|
|
9
|
+
* abbreviation such as `e.g. ` or `approx. ` ends the title early: write the copy without one, or
|
|
10
|
+
* as a single sentence.
|
|
11
|
+
*/
|
|
12
|
+
export declare function splitEmptyCopy(label: string): {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=empty-copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-copy.d.ts","sourceRoot":"","sources":["../../src/common/empty-copy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAKhG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function splitEmptyCopy(label) {
|
|
2
|
+
const at = label.search(/[.!?](\s|$)/);
|
|
3
|
+
const head = (at < 0 ? label : label.slice(0, at + 1)).trim();
|
|
4
|
+
const rest = at < 0 ? "" : label.slice(at + 1).trim();
|
|
5
|
+
return { title: head.replace(/\.$/, ""), description: rest === "" ? void 0 : rest };
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
splitEmptyCopy
|
|
9
|
+
};
|
package/dist/common/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* may reach it too.
|
|
8
8
|
*/
|
|
9
9
|
export { type BasaltProps, type SlotClassNames, type SlotStylesProps } from './props.js';
|
|
10
|
+
export { type DataAttributes, pickDataAttributes, splitDataAttributes } from './props.js';
|
|
10
11
|
export { type Tone, type ToneWithNeutral, type Tier, cx } from './props.js';
|
|
11
12
|
export { assignRef, mergeRefs } from './refs.js';
|
|
12
13
|
export { BASALT_PREFIX, requiredProp, oneOf, duplicateMount, missingLayer } from './errors.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACvF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,KAAK,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AACtF,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACvF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/common/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {} from "./props.js";
|
|
2
|
+
import { pickDataAttributes, splitDataAttributes } from "./props.js";
|
|
2
3
|
import { cx } from "./props.js";
|
|
3
4
|
import { assignRef, mergeRefs } from "./refs.js";
|
|
4
5
|
import { BASALT_PREFIX, requiredProp, oneOf, duplicateMount, missingLayer } from "./errors.js";
|
|
@@ -19,9 +20,11 @@ export {
|
|
|
19
20
|
mergeRefs,
|
|
20
21
|
missingLayer,
|
|
21
22
|
oneOf,
|
|
23
|
+
pickDataAttributes,
|
|
22
24
|
requiredProp,
|
|
23
25
|
resetValidatedProps,
|
|
24
26
|
scrollParentOf,
|
|
27
|
+
splitDataAttributes,
|
|
25
28
|
useCoarsePointer,
|
|
26
29
|
useValidateProps
|
|
27
30
|
};
|