bitboss-ui 3.0.0-beta.21 → 3.0.0-beta.22
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 +55 -3
- package/bin/bitboss-ui-mcp.mjs +419 -9
- package/bin/bitboss-ui.mjs +293 -22
- package/dist/ai/BbAccordion.md +21 -23
- package/dist/ai/BbAlert.md +6 -12
- package/dist/ai/BbAvatar.md +60 -24
- package/dist/ai/BbBadge.md +12 -20
- package/dist/ai/BbBaseButton.md +14 -16
- package/dist/ai/BbBaseCheckboxIcon.md +6 -10
- package/dist/ai/BbBaseRadioIcon.md +6 -10
- package/dist/ai/BbBaseSwitchIcon.md +5 -9
- package/dist/ai/BbBreadcrumbs.md +23 -34
- package/dist/ai/BbButton.md +35 -47
- package/dist/ai/BbCheckbox.md +21 -37
- package/dist/ai/BbCheckboxGroup.md +13 -13
- package/dist/ai/BbCollapsible.md +14 -26
- package/dist/ai/BbColorInput.md +13 -23
- package/dist/ai/BbColorPalette.md +23 -35
- package/dist/ai/BbConfirm.md +17 -32
- package/dist/ai/BbDatePickerInput.md +15 -21
- package/dist/ai/BbDialog.md +159 -62
- package/dist/ai/BbDropdown.md +21 -25
- package/dist/ai/BbDropdownButton.md +13 -30
- package/dist/ai/BbDropzone.md +9 -11
- package/dist/ai/BbIcon.md +44 -33
- package/dist/ai/BbIndicator.md +2 -2
- package/dist/ai/BbNumberInput.md +18 -20
- package/dist/ai/BbOffCanvas.md +42 -42
- package/dist/ai/BbPagination.md +21 -23
- package/dist/ai/BbPopover.md +15 -17
- package/dist/ai/BbProgress.md +40 -51
- package/dist/ai/BbRadio.md +9 -9
- package/dist/ai/BbRadioGroup.md +7 -11
- package/dist/ai/BbRating.md +8 -12
- package/dist/ai/BbSelect.md +32 -36
- package/dist/ai/BbSelectPopover.md +19 -31
- package/dist/ai/BbSlider.md +15 -19
- package/dist/ai/BbSmoothHeight.md +16 -31
- package/dist/ai/BbSpinner.md +118 -74
- package/dist/ai/BbSwitch.md +25 -18
- package/dist/ai/BbSwitchGroup.md +9 -14
- package/dist/ai/BbTable.md +102 -55
- package/dist/ai/BbTabs.md +59 -82
- package/dist/ai/BbTag.md +12 -23
- package/dist/ai/BbTextInput.md +20 -26
- package/dist/ai/BbTextarea.md +28 -34
- package/dist/ai/BbToast.md +14 -34
- package/dist/ai/BbTooltip.md +22 -20
- package/dist/ai/BbTree.md +46 -72
- package/dist/ai/changelog.json +169 -62
- package/dist/ai/components.json +1467 -9
- package/dist/ai/composables/useConfirm.md +5 -2
- package/dist/ai/composables/useToast.md +4 -2
- package/dist/ai/guides/agent-contract.md +7 -4
- package/dist/ai/guides/ai-router.md +37 -22
- package/dist/ai/guides/component-picker.md +23 -18
- package/dist/ai/guides/design-language.md +141 -13
- package/dist/ai/guides/design-tokens.md +29 -4
- package/dist/ai/guides/icons-policy.md +46 -21
- package/dist/ai/guides/installation-and-plugin-setup.md +253 -17
- package/dist/ai/guides/migration/components/bb-rating.md +26 -1
- package/dist/ai/guides/migration/components/bb-tooltip.md +18 -0
- package/dist/ai/guides/migration/v2-to-v3.md +50 -23
- package/dist/ai/index.md +1 -1
- package/dist/ai/recipes/inertia/approvals-inbox.md +3 -3
- package/dist/ai/recipes/inertia/inline-edit-workspace.md +2 -2
- package/dist/ai/recipes/inertia/onboarding.md +2 -2
- package/dist/ai/recipes/inertia/ownership-atlas.md +6 -6
- package/dist/ai/recipes/inertia/record-form.md +5 -5
- package/dist/ai/recipes/inertia/records-workspace.md +4 -4
- package/dist/ai/recipes/inertia/upload-center.md +6 -6
- package/dist/ai/recipes/inertia/wizard-form.md +5 -5
- package/dist/ai/recipes/nuxt/approvals-inbox.md +3 -3
- package/dist/ai/recipes/nuxt/inline-edit-workspace.md +2 -2
- package/dist/ai/recipes/nuxt/onboarding.md +2 -2
- package/dist/ai/recipes/nuxt/record-form.md +5 -5
- package/dist/ai/recipes/nuxt/records-workspace.md +4 -4
- package/dist/ai/recipes/nuxt/upload-center.md +6 -6
- package/dist/ai/recipes/nuxt/wizard-form.md +5 -5
- package/dist/ai/recipes/vue/approvals-inbox.md +3 -3
- package/dist/ai/recipes/vue/inline-edit-workspace.md +2 -2
- package/dist/ai/recipes/vue/onboarding.md +2 -2
- package/dist/ai/recipes/vue/record-form.md +10 -10
- package/dist/ai/recipes/vue/records-workspace.md +4 -4
- package/dist/ai/recipes/vue/upload-center.md +6 -6
- package/dist/ai/recipes/vue/wizard-form.md +5 -5
- package/dist/ai/source/BbBadge.md +1 -1
- package/dist/ai/source/BbBaseCheckbox.md +1 -1
- package/dist/ai/source/BbBaseDatePicker.md +5 -5
- package/dist/ai/source/BbBaseDatePickerInput.md +2 -2
- package/dist/ai/source/BbBaseRadio.md +1 -1
- package/dist/ai/source/BbBaseRating.md +5 -5
- package/dist/ai/source/BbBaseSelect.md +1 -1
- package/dist/ai/source/BbBaseSlider.md +5 -5
- package/dist/ai/source/BbBaseSwitch.md +1 -1
- package/dist/ai/source/BbBaseTimePickerInput.md +1 -1
- package/dist/ai/source/BbBreadcrumbs.md +20 -1
- package/dist/ai/source/BbButton.md +2 -2
- package/dist/ai/source/BbDialog.md +39 -8
- package/dist/ai/source/BbDropdown.md +1 -1
- package/dist/ai/source/BbDropzone.md +5 -5
- package/dist/ai/source/BbIcon.md +23 -10
- package/dist/ai/source/BbOffCanvas.md +50 -28
- package/dist/ai/source/BbPagination.md +2 -2
- package/dist/ai/source/BbPopover.md +12 -1
- package/dist/ai/source/BbSelectPopover.md +45 -7
- package/dist/ai/source/BbSpinner.md +2 -2
- package/dist/ai/source/BbTable.md +11 -11
- package/dist/ai/source/BbTooltip.md +57 -10
- package/dist/ai/source/ChipsBox.md +1 -1
- package/dist/ai/source/CommaBox.md +1 -1
- package/dist/ai/source/GuidesComponent.md +14 -7
- package/dist/ai/source/OptionsContainer.md +1 -1
- package/dist/components/BbBadge/BadgeBodyContent.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBadge/BbBadge.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseCheckbox/BbBaseCheckbox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseDatePicker/BbBaseDatePicker.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/BbBaseDatePicker/BbBaseDatePickerInputDaySelector.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseDatePickerInput/BbBaseDatePickerInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseInputContainer/BbBaseInputContainer.vue.d.ts +1 -1
- package/dist/components/BbBaseRadio/BbBaseRadio.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseRating/BbBaseRating.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/BbBaseSelect/BbBaseSelect.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseSlider/BbBaseSlider.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/BbBaseSwitch/BbBaseSwitch.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBaseTimePickerInput/BbBaseTimePickerInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue_vue_type_script_setup_true_lang.js +71 -71
- package/dist/components/BbButton/BbButton.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbDialog/BbDialog.vue_vue_type_script_setup_true_lang.js +102 -97
- package/dist/components/BbDropdown/AdaptiveDropdown.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbDropdown/BbDropdown.vue_vue_type_script_setup_true_lang.js +58 -58
- package/dist/components/BbDropzone/BbDropzone.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbIcon/BbIcon.vue_vue_type_script_setup_true_lang.js +33 -35
- package/dist/components/BbIcon/iconCache.d.ts +30 -0
- package/dist/components/BbIcon/iconCache.js +21 -3
- package/dist/components/BbOffCanvas/BbOffCanvas.vue_vue_type_script_setup_true_lang.js +57 -56
- package/dist/components/BbPagination/BbPagination.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/BbPopover/BbPopover.vue_vue_type_script_setup_true_lang.js +138 -138
- package/dist/components/BbSelectPopover/BbSelectPopover.vue_vue_type_script_setup_true_lang.js +43 -43
- package/dist/components/BbSpinner/BbSpinner.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BbSpinner/types.d.ts +1 -1
- package/dist/components/BbTable/BbTable.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/components/BbTable/BbTableDataRow.js +2 -2
- package/dist/components/BbToast/BbToastRegion.vue_vue_type_script_setup_true_lang.js +62 -62
- package/dist/components/BbTooltip/BbTooltip.vue_vue_type_script_setup_true_lang.js +81 -78
- package/dist/components/BbTooltip/types.d.ts +8 -1
- package/dist/components/ChipsBox/ChipsBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/CommaBox/CommaBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/OptionsContainer/OptionsContainer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/composables/useConfirm.d.ts +22 -0
- package/dist/composables/useConfirm.js +43 -40
- package/dist/composables/useSafeAreaInternal.js +1 -1
- package/dist/composables/useToast.d.ts +16 -0
- package/dist/composables/useToast.js +20 -16
- package/dist/composables/useViewportWidth.d.ts +20 -6
- package/dist/composables/useViewportWidth.js +8 -7
- package/dist/icon-scan.d.ts +276 -0
- package/dist/icon-scan.js +485 -0
- package/dist/icons-whitelist.d.ts +5 -4
- package/dist/llms-full.txt +1979 -1527
- package/dist/llms-medium.txt +461 -74
- package/dist/llms.txt +1 -1
- package/dist/nuxt.js +10 -7
- package/dist/plugin.js +1 -0
- package/dist/runtime/nuxt-plugin.js +2 -1
- package/dist/styles.css +1 -1
- package/dist/types/Config.d.ts +18 -0
- package/dist/utils/cssLayers.d.ts +91 -0
- package/dist/utils/cssLayers.js +43 -0
- package/dist/utils/injectLibraryStyles.d.ts +3 -1
- package/dist/utils/injectLibraryStyles.js +24 -23
- package/dist/vite-plugin.d.ts +74 -11
- package/dist/vite.js +292 -253
- package/llms.txt +1 -1
- package/package.json +7 -5
- package/scripts/lib/ensure-manifest.mjs +28 -5
- package/scripts/lib/eslint-plugin.d.ts +35 -0
- package/scripts/lib/eslint-plugin.mjs +299 -3
- package/scripts/lib/hand-roll-hints.mjs +50 -6
- package/scripts/lib/html-attributes.mjs +42 -0
- package/scripts/lib/mcp-config.mjs +38 -34
- package/scripts/lib/public-type-exports.mjs +246 -0
- package/scripts/lib/validate-bb-markup.mjs +205 -12
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import * as e from "node:fs";
|
|
2
|
+
import { existsSync as t, readFileSync as n } from "node:fs";
|
|
3
|
+
import { dirname as r, isAbsolute as i, join as a, relative as o, resolve as s, sep as c } from "node:path";
|
|
4
|
+
import l from "ignore";
|
|
5
|
+
import * as u from "node:crypto";
|
|
6
|
+
import { mkdir as d, readdir as f, stat as p, writeFile as m } from "node:fs/promises";
|
|
7
|
+
import { availableParallelism as h } from "node:os";
|
|
8
|
+
import { Worker as g } from "node:worker_threads";
|
|
9
|
+
//#region src/icon-scan.ts
|
|
10
|
+
var _ = /* @__PURE__ */ new Set([
|
|
11
|
+
"node_modules",
|
|
12
|
+
"vendor",
|
|
13
|
+
"storage"
|
|
14
|
+
]), v = 256 * 1024 * 1024, y = 8192, b = 48, x = 1500, S = 64, C = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
15
|
+
function w(e) {
|
|
16
|
+
let t = [...e].sort((e, t) => t.length - e.length).map(C).join("|");
|
|
17
|
+
return RegExp(`(?<![A-Za-z0-9_-])(${t}):([a-z0-9][a-z0-9-]*)`, "g");
|
|
18
|
+
}
|
|
19
|
+
function T(e, t) {
|
|
20
|
+
let n = e.toString("latin1"), r = /* @__PURE__ */ new Set();
|
|
21
|
+
t.lastIndex = 0;
|
|
22
|
+
for (let e of n.matchAll(t)) {
|
|
23
|
+
let t = e[2].replace(/-+$/, "");
|
|
24
|
+
t && r.add(`${e[1]}:${t}`);
|
|
25
|
+
}
|
|
26
|
+
return [...r];
|
|
27
|
+
}
|
|
28
|
+
var E = /[*?[{]/, D = (e) => E.test(e);
|
|
29
|
+
function O(e) {
|
|
30
|
+
let t = "^";
|
|
31
|
+
for (let n = 0; n < e.length; n++) {
|
|
32
|
+
let r = e[n];
|
|
33
|
+
if (r === "*") e[n + 1] === "*" ? e[n + 2] === "/" ? (t += "(?:.*/)?", n += 2) : (t += ".*", n += 1) : t += "[^/]*";
|
|
34
|
+
else if (r === "?") t += "[^/]";
|
|
35
|
+
else if (r === "[") {
|
|
36
|
+
let r = e.indexOf("]", n + 1);
|
|
37
|
+
r === -1 ? t += "\\[" : (t += `[${e.slice(n + 1, r).replace(/\\/g, "\\\\")}]`, n = r);
|
|
38
|
+
} else if (r === "{") {
|
|
39
|
+
let r = e.indexOf("}", n + 1);
|
|
40
|
+
r === -1 ? t += "\\{" : (t += `(?:${e.slice(n + 1, r).split(",").map(C).join("|")})`, n = r);
|
|
41
|
+
} else t += C(r);
|
|
42
|
+
}
|
|
43
|
+
return RegExp(t + "$");
|
|
44
|
+
}
|
|
45
|
+
var k = (e) => c === "/" ? e : e.split(c).join("/");
|
|
46
|
+
function A(e, t) {
|
|
47
|
+
let n = o(e, t);
|
|
48
|
+
return n === "" || !n.startsWith("..") && !i(n);
|
|
49
|
+
}
|
|
50
|
+
function j(e) {
|
|
51
|
+
let n = [], i = r(e), o = -1;
|
|
52
|
+
for (;;) {
|
|
53
|
+
if (n.push(i), t(a(i, ".git"))) {
|
|
54
|
+
o = n.length;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
let e = r(i);
|
|
58
|
+
if (e === i) break;
|
|
59
|
+
i = e;
|
|
60
|
+
}
|
|
61
|
+
return o === -1 ? [] : n.slice(0, o).reverse().flatMap((e) => {
|
|
62
|
+
let t = M(e);
|
|
63
|
+
return t ? [{
|
|
64
|
+
dir: e,
|
|
65
|
+
ig: t
|
|
66
|
+
}] : [];
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function M(e) {
|
|
70
|
+
let r = a(e, ".gitignore");
|
|
71
|
+
try {
|
|
72
|
+
return t(r) ? l().add(n(r, "utf-8")) : null;
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function N(e, t, n) {
|
|
78
|
+
let r = n.needles.map((e) => Buffer.from(e, "latin1")), i = new RegExp(n.regexSource, "g"), a = t.hash ? (e) => t.hash("sha1", e, "hex") : (e) => t.createHash("sha1").update(e).digest("hex"), o = (t, r) => {
|
|
79
|
+
let i = Math.min(r, n.probeBytes), a = Buffer.allocUnsafe(i), o = e.readSync(t, a, 0, i, 0);
|
|
80
|
+
if (a.subarray(0, o).indexOf(0) !== -1) return null;
|
|
81
|
+
if (o >= r) return a.subarray(0, o);
|
|
82
|
+
let s = Buffer.allocUnsafe(r);
|
|
83
|
+
a.copy(s, 0, 0, o);
|
|
84
|
+
let c = o;
|
|
85
|
+
for (; c < r;) {
|
|
86
|
+
let n = e.readSync(t, s, c, r - c, c);
|
|
87
|
+
if (n === 0) break;
|
|
88
|
+
c += n;
|
|
89
|
+
}
|
|
90
|
+
return s.subarray(0, c);
|
|
91
|
+
};
|
|
92
|
+
return (t) => {
|
|
93
|
+
let { path: s, prev: c } = t, l = -1, u;
|
|
94
|
+
try {
|
|
95
|
+
c ? u = e.statSync(s) : (l = e.openSync(s, "r"), u = e.fstatSync(l));
|
|
96
|
+
} catch {
|
|
97
|
+
return l !== -1 && e.closeSync(l), {
|
|
98
|
+
path: s,
|
|
99
|
+
outcome: "skip",
|
|
100
|
+
read: !1
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
if (!u.isFile() || u.size > n.maxFileSize) return {
|
|
105
|
+
path: s,
|
|
106
|
+
outcome: "skip",
|
|
107
|
+
read: !1
|
|
108
|
+
};
|
|
109
|
+
if (c && c.size === u.size && c.mtime === u.mtimeMs) return {
|
|
110
|
+
path: s,
|
|
111
|
+
outcome: "fresh",
|
|
112
|
+
size: u.size,
|
|
113
|
+
mtime: u.mtimeMs
|
|
114
|
+
};
|
|
115
|
+
let t;
|
|
116
|
+
try {
|
|
117
|
+
l === -1 && (l = e.openSync(s, "r")), t = o(l, u.size);
|
|
118
|
+
} catch {
|
|
119
|
+
return {
|
|
120
|
+
path: s,
|
|
121
|
+
outcome: "skip",
|
|
122
|
+
read: !1
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (t === null) return {
|
|
126
|
+
path: s,
|
|
127
|
+
outcome: "skip",
|
|
128
|
+
read: !0
|
|
129
|
+
};
|
|
130
|
+
let d = a(t);
|
|
131
|
+
if (c && c.hash === d) return {
|
|
132
|
+
path: s,
|
|
133
|
+
outcome: "same",
|
|
134
|
+
size: u.size,
|
|
135
|
+
mtime: u.mtimeMs,
|
|
136
|
+
hash: d
|
|
137
|
+
};
|
|
138
|
+
let f = [];
|
|
139
|
+
if (r.some((e) => t.indexOf(e) !== -1)) {
|
|
140
|
+
let e = t.toString("latin1"), n = /* @__PURE__ */ new Set();
|
|
141
|
+
i.lastIndex = 0;
|
|
142
|
+
for (let t of e.matchAll(i)) {
|
|
143
|
+
let e = t[2].replace(/-+$/, "");
|
|
144
|
+
e && n.add(`${t[1]}:${e}`);
|
|
145
|
+
}
|
|
146
|
+
f = [...n];
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
path: s,
|
|
150
|
+
outcome: "new",
|
|
151
|
+
size: u.size,
|
|
152
|
+
mtime: u.mtimeMs,
|
|
153
|
+
hash: d,
|
|
154
|
+
candidates: f
|
|
155
|
+
};
|
|
156
|
+
} finally {
|
|
157
|
+
l !== -1 && e.closeSync(l);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
var P = `
|
|
162
|
+
const { parentPort, workerData } = require('node:worker_threads');
|
|
163
|
+
const scan = (${N.toString()})(require('node:fs'), require('node:crypto'), workerData);
|
|
164
|
+
parentPort.on('message', (jobs) => parentPort.postMessage(jobs.map(scan)));
|
|
165
|
+
`;
|
|
166
|
+
function F(e) {
|
|
167
|
+
return Math.max(2, Math.min(4, e - 1));
|
|
168
|
+
}
|
|
169
|
+
function I(e, t) {
|
|
170
|
+
return Array.from({ length: e }, () => new g(P, {
|
|
171
|
+
eval: !0,
|
|
172
|
+
workerData: t
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
async function L(e, t) {
|
|
176
|
+
let n = [], r = [];
|
|
177
|
+
for (let t = 0; t < e.length; t += S) r.push(e.slice(t, t + S));
|
|
178
|
+
let i = 0;
|
|
179
|
+
try {
|
|
180
|
+
await Promise.all(t.map((e) => new Promise((t, a) => {
|
|
181
|
+
let o = () => {
|
|
182
|
+
let n = r[i++];
|
|
183
|
+
if (!n) return t();
|
|
184
|
+
e.postMessage(n);
|
|
185
|
+
};
|
|
186
|
+
e.on("message", (e) => {
|
|
187
|
+
n.push(...e), o();
|
|
188
|
+
}), e.on("error", a), e.on("exit", (e) => {
|
|
189
|
+
e !== 0 && a(/* @__PURE__ */ Error(`icon-scan worker exited with ${e}`));
|
|
190
|
+
}), o();
|
|
191
|
+
})));
|
|
192
|
+
} finally {
|
|
193
|
+
await Promise.all(t.map((e) => e.terminate()));
|
|
194
|
+
}
|
|
195
|
+
return n;
|
|
196
|
+
}
|
|
197
|
+
async function R(e, t, n) {
|
|
198
|
+
let r = Array(e.length), i = 0;
|
|
199
|
+
return await Promise.all(Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
200
|
+
for (;;) {
|
|
201
|
+
let t = i++;
|
|
202
|
+
if (t >= e.length) return;
|
|
203
|
+
r[t] = await n(e[t]);
|
|
204
|
+
}
|
|
205
|
+
})), r;
|
|
206
|
+
}
|
|
207
|
+
var z = class {
|
|
208
|
+
constructor(t) {
|
|
209
|
+
this.resolveMemo = /* @__PURE__ */ new Map(), this.gitignoreMemo = /* @__PURE__ */ new Map(), this.entries = /* @__PURE__ */ new Map(), this.cold = !0, this.dirty = !1, this.lastWorkers = 0, this.cfg = t, this.fileOptions = t.prefixes.length ? {
|
|
210
|
+
needles: t.prefixes.map((e) => `${e}:`),
|
|
211
|
+
regexSource: w(t.prefixes).source,
|
|
212
|
+
maxFileSize: t.scanner.maxFileSize ?? 268435456,
|
|
213
|
+
probeBytes: y
|
|
214
|
+
} : null, this.scanOne = this.fileOptions ? N(e, u, this.fileOptions) : null, this.workerThreshold = t.workerThreshold ?? 1500;
|
|
215
|
+
let n = t.scanner.exclude ?? [];
|
|
216
|
+
this.excludes = n.length ? l().add(n) : null, this.bases = [{
|
|
217
|
+
dir: t.root,
|
|
218
|
+
match: null,
|
|
219
|
+
ancestors: j(t.root)
|
|
220
|
+
}, ...(t.scanner.include ?? []).map((e) => this.includeBase(e))];
|
|
221
|
+
}
|
|
222
|
+
get includeDirs() {
|
|
223
|
+
return this.bases.slice(1).map((e) => e.dir).filter((e) => !A(this.cfg.root, e));
|
|
224
|
+
}
|
|
225
|
+
get icons() {
|
|
226
|
+
let e = /* @__PURE__ */ new Set();
|
|
227
|
+
for (let t of this.entries.values()) for (let n of t.icons) e.add(n);
|
|
228
|
+
return e;
|
|
229
|
+
}
|
|
230
|
+
includeBase(e) {
|
|
231
|
+
let t = k(e).split("/"), n = t.findIndex((e) => D(e));
|
|
232
|
+
if (n === -1) return {
|
|
233
|
+
dir: s(this.cfg.root, e),
|
|
234
|
+
match: null,
|
|
235
|
+
ancestors: []
|
|
236
|
+
};
|
|
237
|
+
let r = t.slice(0, n).join("/"), i = t.slice(n).join("/");
|
|
238
|
+
return {
|
|
239
|
+
dir: s(this.cfg.root, r || "."),
|
|
240
|
+
match: O(i),
|
|
241
|
+
ancestors: []
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
gitignoreFor(e) {
|
|
245
|
+
let t = this.gitignoreMemo.get(e);
|
|
246
|
+
return t === void 0 && (t = M(e), this.gitignoreMemo.set(e, t)), t;
|
|
247
|
+
}
|
|
248
|
+
resetGitignores() {
|
|
249
|
+
this.gitignoreMemo.clear(), this.bases[0].ancestors = j(this.cfg.root);
|
|
250
|
+
}
|
|
251
|
+
isGitignored(e, t, n) {
|
|
252
|
+
let r = !1;
|
|
253
|
+
for (let { dir: i, ig: a } of e) {
|
|
254
|
+
let e = k(o(i, t));
|
|
255
|
+
if (!e || e.startsWith("..")) continue;
|
|
256
|
+
n && (e += "/");
|
|
257
|
+
let s = a.test(e);
|
|
258
|
+
s.ignored ? r = !0 : s.unignored && (r = !1);
|
|
259
|
+
}
|
|
260
|
+
return r;
|
|
261
|
+
}
|
|
262
|
+
isExcluded(e, t, n) {
|
|
263
|
+
if (!this.excludes) return !1;
|
|
264
|
+
let r = k(o(A(this.cfg.root, t) ? this.cfg.root : e.dir, t));
|
|
265
|
+
return !r || r.startsWith("..") ? !1 : (n && (r += "/"), this.excludes.ignores(r));
|
|
266
|
+
}
|
|
267
|
+
admits(e, t, n, r, i) {
|
|
268
|
+
if (n.startsWith(".") || r && (_.has(n) || t === this.cfg.outDir) || this.isGitignored(i, t, r) || this.isExcluded(e, t, r)) return !1;
|
|
269
|
+
if (!r && e.match) {
|
|
270
|
+
let n = k(o(e.dir, t));
|
|
271
|
+
if (!e.match.test(n)) return !1;
|
|
272
|
+
}
|
|
273
|
+
return !0;
|
|
274
|
+
}
|
|
275
|
+
isCandidate(e) {
|
|
276
|
+
e = s(e);
|
|
277
|
+
let t = this.bases.find((t) => A(t.dir, e));
|
|
278
|
+
if (!t) return !1;
|
|
279
|
+
if (e === t.dir) return t.match === null;
|
|
280
|
+
let n = [...t.ancestors], r = this.gitignoreFor(t.dir);
|
|
281
|
+
r && n.push({
|
|
282
|
+
dir: t.dir,
|
|
283
|
+
ig: r
|
|
284
|
+
});
|
|
285
|
+
let i = k(o(t.dir, e)).split("/"), c = t.dir;
|
|
286
|
+
for (let e = 0; e < i.length; e++) {
|
|
287
|
+
let r = i[e], o = a(c, r), s = e < i.length - 1;
|
|
288
|
+
if (!this.admits(t, o, r, s, n)) return !1;
|
|
289
|
+
if (s) {
|
|
290
|
+
let e = this.gitignoreFor(o);
|
|
291
|
+
e && n.push({
|
|
292
|
+
dir: o,
|
|
293
|
+
ig: e
|
|
294
|
+
}), c = o;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return !0;
|
|
298
|
+
}
|
|
299
|
+
async walk(e, t, n, r) {
|
|
300
|
+
let i;
|
|
301
|
+
try {
|
|
302
|
+
i = await f(t, { withFileTypes: !0 });
|
|
303
|
+
} catch {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
let o = this.gitignoreFor(t), s = o ? [...n, {
|
|
307
|
+
dir: t,
|
|
308
|
+
ig: o
|
|
309
|
+
}] : n, c = [];
|
|
310
|
+
for (let n of i) {
|
|
311
|
+
if (n.isSymbolicLink()) continue;
|
|
312
|
+
let i = a(t, n.name), o = n.isDirectory();
|
|
313
|
+
!o && !n.isFile() || this.admits(e, i, n.name, o, s) && (o ? c.push(i) : r.add(i));
|
|
314
|
+
}
|
|
315
|
+
await Promise.all(c.map((t) => this.walk(e, t, s, r)));
|
|
316
|
+
}
|
|
317
|
+
async collectFiles() {
|
|
318
|
+
let e = /* @__PURE__ */ new Set();
|
|
319
|
+
for (let t of this.bases) {
|
|
320
|
+
let n;
|
|
321
|
+
try {
|
|
322
|
+
n = await p(t.dir);
|
|
323
|
+
} catch {
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (n.isFile()) {
|
|
327
|
+
t.match || e.add(t.dir);
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
await this.walk(t, t.dir, [...t.ancestors], e);
|
|
331
|
+
}
|
|
332
|
+
return [...e];
|
|
333
|
+
}
|
|
334
|
+
resolvesMemo(e) {
|
|
335
|
+
let t = this.resolveMemo.get(e);
|
|
336
|
+
if (t === void 0) {
|
|
337
|
+
let n = e.indexOf(":");
|
|
338
|
+
t = this.cfg.resolves(e.slice(0, n), e.slice(n + 1)), this.resolveMemo.set(e, t);
|
|
339
|
+
}
|
|
340
|
+
return t;
|
|
341
|
+
}
|
|
342
|
+
fold(e, t) {
|
|
343
|
+
switch (e.outcome) {
|
|
344
|
+
case "skip": return {
|
|
345
|
+
entry: null,
|
|
346
|
+
read: e.read,
|
|
347
|
+
extracted: !1
|
|
348
|
+
};
|
|
349
|
+
case "fresh": return {
|
|
350
|
+
entry: t,
|
|
351
|
+
read: !1,
|
|
352
|
+
extracted: !1
|
|
353
|
+
};
|
|
354
|
+
case "same": return {
|
|
355
|
+
entry: {
|
|
356
|
+
...t,
|
|
357
|
+
size: e.size,
|
|
358
|
+
mtime: e.mtime
|
|
359
|
+
},
|
|
360
|
+
read: !0,
|
|
361
|
+
extracted: !1
|
|
362
|
+
};
|
|
363
|
+
case "new": return {
|
|
364
|
+
entry: {
|
|
365
|
+
size: e.size,
|
|
366
|
+
mtime: e.mtime,
|
|
367
|
+
hash: e.hash,
|
|
368
|
+
icons: e.candidates.filter((e) => this.resolvesMemo(e))
|
|
369
|
+
},
|
|
370
|
+
read: !0,
|
|
371
|
+
extracted: !0
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async statOnly(e) {
|
|
376
|
+
try {
|
|
377
|
+
let t = await p(e);
|
|
378
|
+
return t.isFile() ? {
|
|
379
|
+
size: t.size,
|
|
380
|
+
mtime: t.mtimeMs,
|
|
381
|
+
hash: "",
|
|
382
|
+
icons: []
|
|
383
|
+
} : null;
|
|
384
|
+
} catch {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
async scanFile(e, t) {
|
|
389
|
+
return this.scanOne ? this.fold(await this.scanOne({
|
|
390
|
+
path: e,
|
|
391
|
+
prev: t ?? null
|
|
392
|
+
}), t) : {
|
|
393
|
+
entry: await this.statOnly(e),
|
|
394
|
+
read: !1,
|
|
395
|
+
extracted: !1
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
useWorkers(e) {
|
|
399
|
+
return this.fileOptions !== null && e >= this.workerThreshold;
|
|
400
|
+
}
|
|
401
|
+
async scanAll(e, t, n) {
|
|
402
|
+
let r = e.map((e) => ({
|
|
403
|
+
path: e,
|
|
404
|
+
prev: t.get(e) ?? null
|
|
405
|
+
}));
|
|
406
|
+
if (n && this.useWorkers(r.length)) try {
|
|
407
|
+
let e = await L(r, n);
|
|
408
|
+
return this.lastWorkers = n.length, e;
|
|
409
|
+
} catch {}
|
|
410
|
+
else n && Promise.all(n.map((e) => e.terminate()));
|
|
411
|
+
this.lastWorkers = 0;
|
|
412
|
+
let i = [];
|
|
413
|
+
for (let e = 0; e < r.length; e += S) {
|
|
414
|
+
for (let t of r.slice(e, e + S)) i.push(this.scanOne(t));
|
|
415
|
+
e + S < r.length && await new Promise((e) => setImmediate(e));
|
|
416
|
+
}
|
|
417
|
+
return i;
|
|
418
|
+
}
|
|
419
|
+
loadCache() {
|
|
420
|
+
try {
|
|
421
|
+
let e = JSON.parse(n(this.cfg.cacheFile, "utf-8"));
|
|
422
|
+
if (e.version === 4 && e.key === this.cfg.cacheKey && e.entries && typeof e.entries == "object") return this.cold = !1, new Map(Object.entries(e.entries));
|
|
423
|
+
} catch {}
|
|
424
|
+
return this.cold = !0, /* @__PURE__ */ new Map();
|
|
425
|
+
}
|
|
426
|
+
async scan() {
|
|
427
|
+
let e = performance.now(), t = this.loadCache(), n = this.cold ? 2 ** 53 - 1 : t.size, r = this.fileOptions && this.useWorkers(n) ? I(F(h()), this.fileOptions) : null, i = await this.collectFiles(), a = /* @__PURE__ */ new Map(), o = 0, s = 0, c = 0;
|
|
428
|
+
if (this.scanOne) for (let e of await this.scanAll(i, t, r)) {
|
|
429
|
+
let n = this.fold(e, t.get(e.path));
|
|
430
|
+
n.read && o++, n.extracted && s++, n.entry ? a.set(e.path, n.entry) : c++;
|
|
431
|
+
}
|
|
432
|
+
else await R(i, b, async (e) => {
|
|
433
|
+
let t = await this.statOnly(e);
|
|
434
|
+
t ? a.set(e, t) : c++;
|
|
435
|
+
});
|
|
436
|
+
return this.entries = a, this.dirty = this.cold || o > 0 || a.size !== t.size || [...a.keys()].some((e) => !t.has(e)), await this.persist(), {
|
|
437
|
+
files: i.length,
|
|
438
|
+
read: o,
|
|
439
|
+
extracted: s,
|
|
440
|
+
skipped: c,
|
|
441
|
+
elapsed: Math.round(performance.now() - e),
|
|
442
|
+
cold: this.cold,
|
|
443
|
+
workers: this.lastWorkers
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
async updateFile(e) {
|
|
447
|
+
if (e = s(e), !this.isCandidate(e)) return this.removeFile(e);
|
|
448
|
+
let t = this.icons, n = await this.scanFile(e, this.entries.get(e));
|
|
449
|
+
return n.entry ? this.entries.set(e, n.entry) : this.entries.delete(e), this.dirty = !0, !B(t, this.icons);
|
|
450
|
+
}
|
|
451
|
+
removeFile(e) {
|
|
452
|
+
if (e = s(e), !this.entries.has(e)) return !1;
|
|
453
|
+
let t = this.icons;
|
|
454
|
+
return this.entries.delete(e), this.dirty = !0, !B(t, this.icons);
|
|
455
|
+
}
|
|
456
|
+
async persist() {
|
|
457
|
+
if (!this.dirty) return;
|
|
458
|
+
this.dirty = !1;
|
|
459
|
+
let e = {
|
|
460
|
+
version: 4,
|
|
461
|
+
key: this.cfg.cacheKey,
|
|
462
|
+
entries: Object.fromEntries(this.entries)
|
|
463
|
+
};
|
|
464
|
+
try {
|
|
465
|
+
await d(r(this.cfg.cacheFile), { recursive: !0 }), await m(this.cfg.cacheFile, JSON.stringify(e), "utf-8");
|
|
466
|
+
} catch {}
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
function B(e, t) {
|
|
470
|
+
if (e.size !== t.size) return !1;
|
|
471
|
+
for (let n of e) if (!t.has(n)) return !1;
|
|
472
|
+
return !0;
|
|
473
|
+
}
|
|
474
|
+
function V(e) {
|
|
475
|
+
let n = s(e);
|
|
476
|
+
for (;;) {
|
|
477
|
+
if (t(a(n, "node_modules"))) return a(n, "node_modules", ".cache", "bitboss-ui", "icon-scan.json");
|
|
478
|
+
let e = r(n);
|
|
479
|
+
if (e === n) break;
|
|
480
|
+
n = e;
|
|
481
|
+
}
|
|
482
|
+
return a(e, "node_modules", ".cache", "bitboss-ui", "icon-scan.json");
|
|
483
|
+
}
|
|
484
|
+
//#endregion
|
|
485
|
+
export { _ as ALWAYS_SKIPPED_DIRS, v as DEFAULT_MAX_FILE_SIZE, x as DEFAULT_WORKER_THRESHOLD, z as IconScanner, N as createFileScanner, T as extractIconCandidates, O as globToRegExp, D as hasGlobMagic, w as iconLiteralRegExp, V as iconScanCacheFile, F as workerCountFor };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Storybook icon
|
|
2
|
+
* Storybook icon control options.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Historically this list existed so the `bitbossUi` build scanner — which
|
|
5
|
+
* once read only `.vue/.ts/.js` source and skipped `*.stories.*` — would see
|
|
6
|
+
* these names as literals. The scanner now reads every file in the project,
|
|
7
|
+
* stories included, so the list is purely the control's option set.
|
|
7
8
|
*/
|
|
8
9
|
export declare const STORYBOOK_ICON_WHITELIST: readonly ["lucide:plus", "lucide:download", "lucide:arrow-right", "lucide:settings", "lucide:trash-2", "lucide:bell"];
|