@cloudflare/kumo 1.5.0 → 1.6.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 +108 -0
- package/ai/component-registry.json +62 -7
- package/ai/component-registry.md +378 -37
- package/ai/schemas.ts +12 -2
- package/bin/kumo.js +23 -19
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +2166 -0
- package/dist/ai/schemas.d.ts.map +1 -0
- package/dist/catalog.js +1 -1
- package/dist/{checkbox-CWANiedi.js → checkbox-Dt8iSNOg.js} +3 -3
- package/dist/{checkbox-CWANiedi.js.map → checkbox-Dt8iSNOg.js.map} +1 -1
- package/dist/clipboard-text-Bw5rKPXz.js +185 -0
- package/dist/clipboard-text-Bw5rKPXz.js.map +1 -0
- package/dist/{combobox-C9koouxM.js → combobox-BIC-YZ2L.js} +41 -41
- package/dist/combobox-BIC-YZ2L.js.map +1 -0
- package/dist/command-line/cli.js +104 -47
- package/dist/command-line/commands/add.js +88 -30
- package/dist/command-line/commands/ai.js +2 -3
- package/dist/{command-palette-TGXgr6Vq.js → command-palette-D3MNR7w9.js} +31 -31
- package/dist/{command-palette-TGXgr6Vq.js.map → command-palette-D3MNR7w9.js.map} +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/date-picker.js +6 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/label.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/date-picker-M6uNX5Ca.js +2921 -0
- package/dist/date-picker-M6uNX5Ca.js.map +1 -0
- package/dist/{dialog-CpCeOqSZ.js → dialog-toS9krNF.js} +17 -17
- package/dist/dialog-toS9krNF.js.map +1 -0
- package/dist/{dropdown-DFeFcKfn.js → dropdown-BquiYKKC.js} +38 -38
- package/dist/dropdown-BquiYKKC.js.map +1 -0
- package/dist/{field-Dt-XuSaQ.js → field-DCq04TgZ.js} +3 -3
- package/dist/{field-Dt-XuSaQ.js.map → field-DCq04TgZ.js.map} +1 -1
- package/dist/index.js +86 -73
- package/dist/index.js.map +1 -1
- package/dist/{input-GZAWBXYX.js → input-CCR8NGG7.js} +3 -3
- package/dist/{input-GZAWBXYX.js.map → input-CCR8NGG7.js.map} +1 -1
- package/dist/{input-area-CS1-ceY4.js → input-area-DU2Yvp_t.js} +3 -3
- package/dist/{input-area-CS1-ceY4.js.map → input-area-DU2Yvp_t.js.map} +1 -1
- package/dist/{input-group-COo-wz5O.js → input-group-C365-qBq.js} +2 -2
- package/dist/{input-group-COo-wz5O.js.map → input-group-C365-qBq.js.map} +1 -1
- package/dist/{label-ChZ2Pp5p.js → label-zjtV7oXa.js} +2 -2
- package/dist/{label-ChZ2Pp5p.js.map → label-zjtV7oXa.js.map} +1 -1
- package/dist/{link-Mj2WM1AS.js → link-C8pUZ4Q-.js} +8 -8
- package/dist/{link-Mj2WM1AS.js.map → link-C8pUZ4Q-.js.map} +1 -1
- package/dist/{menubar-CbXWXQYR.js → menubar-D7WvAf6x.js} +6 -6
- package/dist/menubar-D7WvAf6x.js.map +1 -0
- package/dist/{meter-Bu5f3mAc.js → meter-jQGKS1z4.js} +4 -4
- package/dist/{meter-Bu5f3mAc.js.map → meter-jQGKS1z4.js.map} +1 -1
- package/dist/{pagination-Bm8eMWpj.js → pagination-BN80iKY6.js} +21 -20
- package/dist/pagination-BN80iKY6.js.map +1 -0
- package/dist/{popover-D7yeRosi.js → popover-syU1104E.js} +4 -4
- package/dist/{popover-D7yeRosi.js.map → popover-syU1104E.js.map} +1 -1
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +1 -1
- package/dist/{radio-CKn09bGo.js → radio-CWMtSx65.js} +8 -8
- package/dist/{radio-CKn09bGo.js.map → radio-CWMtSx65.js.map} +1 -1
- package/dist/{schemas-B-D2OT-O.js → schemas-DbIwo0ET.js} +254 -240
- package/dist/{schemas-B-D2OT-O.js.map → schemas-DbIwo0ET.js.map} +1 -1
- package/dist/{select-DvpgiOau.js → select-G6JqBVkg.js} +37 -37
- package/dist/{select-DvpgiOau.js.map → select-G6JqBVkg.js.map} +1 -1
- package/dist/{sensitive-input-BuYT6U6C.js → sensitive-input-DNFpycoy.js} +4 -4
- package/dist/{sensitive-input-BuYT6U6C.js.map → sensitive-input-DNFpycoy.js.map} +1 -1
- package/dist/src/blocks/delete-resource/delete-resource.d.ts.map +1 -1
- package/dist/src/blocks/delete-resource/delete-resource.tsx +213 -0
- package/dist/src/blocks/page-header/page-header.tsx +99 -0
- package/dist/src/blocks/resource-list/resource-list.test.tsx +28 -0
- package/dist/src/blocks/resource-list/resource-list.tsx +69 -0
- package/dist/src/command-line/commands/ai.d.ts.map +1 -1
- package/dist/src/command-line/utils/transformer.d.ts +8 -4
- package/dist/src/command-line/utils/transformer.d.ts.map +1 -1
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +23 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -1
- package/dist/src/components/date-picker/date-picker.d.ts +65 -0
- package/dist/src/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/src/components/date-picker/index.d.ts +4 -0
- package/dist/src/components/date-picker/index.d.ts.map +1 -0
- package/dist/src/components/dropdown/dropdown.d.ts.map +1 -1
- package/dist/src/components/pagination/pagination.d.ts +8 -1
- package/dist/src/components/pagination/pagination.d.ts.map +1 -1
- package/dist/src/components/table/table.d.ts +2 -0
- package/dist/src/components/table/table.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/styles/kumo-binding.css +0 -4
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/kumo.css +541 -0
- package/dist/{switch-Tu34uFoa.js → switch-CmsZ4z-g.js} +9 -9
- package/dist/{switch-Tu34uFoa.js.map → switch-CmsZ4z-g.js.map} +1 -1
- package/dist/table-Dc0AGcLV.js +149 -0
- package/dist/table-Dc0AGcLV.js.map +1 -0
- package/dist/{tabs-B7THfqHW.js → tabs-BpD1iUiz.js} +2 -2
- package/dist/{tabs-B7THfqHW.js.map → tabs-BpD1iUiz.js.map} +1 -1
- package/dist/{toast-Du4y8qng.js → toast-BrR0pjLE.js} +8 -8
- package/dist/{toast-Du4y8qng.js.map → toast-BrR0pjLE.js.map} +1 -1
- package/dist/{tooltip-BxV1H6AV.js → tooltip-daVJYtXY.js} +2 -2
- package/dist/{tooltip-BxV1H6AV.js.map → tooltip-daVJYtXY.js.map} +1 -1
- package/dist/{vendor-base-ui-CQ6wEonS.js → vendor-base-ui-9w7J6BvW.js} +7246 -7245
- package/dist/{vendor-base-ui-CQ6wEonS.js.map → vendor-base-ui-9w7J6BvW.js.map} +1 -1
- package/package.json +6 -1
- package/scripts/component-registry/discovery.ts +1 -7
- package/scripts/css-build.ts +47 -1
- package/dist/clipboard-text-CqueQiB8.js +0 -108
- package/dist/clipboard-text-CqueQiB8.js.map +0 -1
- package/dist/combobox-C9koouxM.js.map +0 -1
- package/dist/dialog-CpCeOqSZ.js.map +0 -1
- package/dist/dropdown-DFeFcKfn.js.map +0 -1
- package/dist/menubar-CbXWXQYR.js.map +0 -1
- package/dist/pagination-Bm8eMWpj.js.map +0 -1
- package/dist/table-BUmvaBj8.js +0 -153
- package/dist/table-BUmvaBj8.js.map +0 -1
package/dist/command-line/cli.js
CHANGED
|
@@ -5,8 +5,8 @@ import { readFileSync } from "node:fs";
|
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
function getRegistryPath() {
|
|
8
|
-
const
|
|
9
|
-
return join(
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
return join(__dirname, "..", "..", "ai", "component-registry.json");
|
|
10
10
|
}
|
|
11
11
|
function loadRegistry() {
|
|
12
12
|
const registryPath = getRegistryPath();
|
|
@@ -54,8 +54,8 @@ import { readFileSync as readFileSync2 } from "node:fs";
|
|
|
54
54
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
55
55
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
56
56
|
function getRegistryPath2() {
|
|
57
|
-
const
|
|
58
|
-
return join2(
|
|
57
|
+
const __dirname = dirname2(fileURLToPath2(import.meta.url));
|
|
58
|
+
return join2(__dirname, "..", "..", "ai", "component-registry.json");
|
|
59
59
|
}
|
|
60
60
|
function loadRegistry2() {
|
|
61
61
|
const registryPath = getRegistryPath2();
|
|
@@ -324,8 +324,8 @@ import { readFileSync as readFileSync4 } from "node:fs";
|
|
|
324
324
|
import { dirname as dirname3, join as join4 } from "node:path";
|
|
325
325
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
326
326
|
function getRegistryPath3() {
|
|
327
|
-
const
|
|
328
|
-
return join4(
|
|
327
|
+
const __dirname = dirname3(fileURLToPath3(import.meta.url));
|
|
328
|
+
return join4(__dirname, "..", "..", "ai", "component-registry.json");
|
|
329
329
|
}
|
|
330
330
|
function loadRegistry3() {
|
|
331
331
|
const registryPath = getRegistryPath3();
|
|
@@ -382,50 +382,108 @@ import { dirname as dirname4, join as join5, resolve, relative, isAbsolute } fro
|
|
|
382
382
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
383
383
|
|
|
384
384
|
// src/command-line/utils/transformer.ts
|
|
385
|
-
function
|
|
386
|
-
const importRegex = /import\s+(
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
385
|
+
function parseImports(content) {
|
|
386
|
+
const importRegex = /import\s+(type\s+)?{([^}]+)}\s+from\s+["']([^"']+)["'];?/g;
|
|
387
|
+
const imports = [];
|
|
388
|
+
let match;
|
|
389
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
390
|
+
imports.push({
|
|
391
|
+
fullMatch: match[0],
|
|
392
|
+
imports: match[2],
|
|
393
|
+
path: match[3],
|
|
394
|
+
startIndex: match.index,
|
|
395
|
+
endIndex: match.index + match[0].length,
|
|
396
|
+
isTypeOnlyImport: match[1] !== void 0
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return imports;
|
|
400
|
+
}
|
|
401
|
+
function shouldTransformToKumo(path) {
|
|
402
|
+
if (!path.startsWith("../")) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
return path.includes("/components/") || path.includes("/utils/");
|
|
406
|
+
}
|
|
407
|
+
function parseImportItems(imports, isTypeOnlyImport) {
|
|
408
|
+
const items = imports.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
409
|
+
const valueImports = [];
|
|
410
|
+
const typeImports = [];
|
|
411
|
+
for (const item of items) {
|
|
412
|
+
if (isTypeOnlyImport || item.startsWith("type ")) {
|
|
413
|
+
const typeName = item.startsWith("type ") ? item.slice(5).trim() : item;
|
|
414
|
+
typeImports.push(typeName);
|
|
415
|
+
} else {
|
|
416
|
+
valueImports.push(item);
|
|
394
417
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
418
|
+
}
|
|
419
|
+
return { valueImports, typeImports };
|
|
420
|
+
}
|
|
421
|
+
function buildConsolidatedImport(valueImports, typeImports) {
|
|
422
|
+
const parts = [];
|
|
423
|
+
for (const item of valueImports) {
|
|
424
|
+
parts.push(item);
|
|
425
|
+
}
|
|
426
|
+
for (const item of typeImports) {
|
|
427
|
+
parts.push(`type ${item}`);
|
|
428
|
+
}
|
|
429
|
+
return `import { ${parts.join(", ")} } from "@cloudflare/kumo";`;
|
|
430
|
+
}
|
|
431
|
+
function transformImports(content) {
|
|
432
|
+
const parsedImports = parseImports(content);
|
|
433
|
+
const kumoImports = [];
|
|
434
|
+
const nonKumoImports = [];
|
|
435
|
+
for (const imp of parsedImports) {
|
|
436
|
+
if (shouldTransformToKumo(imp.path)) {
|
|
437
|
+
kumoImports.push(imp);
|
|
438
|
+
} else {
|
|
439
|
+
nonKumoImports.push(imp);
|
|
405
440
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
441
|
+
}
|
|
442
|
+
if (kumoImports.length === 0) {
|
|
443
|
+
return content;
|
|
444
|
+
}
|
|
445
|
+
const allValueImports = [];
|
|
446
|
+
const allTypeImports = [];
|
|
447
|
+
for (const imp of kumoImports) {
|
|
448
|
+
const { valueImports, typeImports } = parseImportItems(
|
|
449
|
+
imp.imports,
|
|
450
|
+
imp.isTypeOnlyImport
|
|
451
|
+
);
|
|
452
|
+
allValueImports.push(...valueImports);
|
|
453
|
+
allTypeImports.push(...typeImports);
|
|
454
|
+
}
|
|
455
|
+
const consolidatedImport = buildConsolidatedImport(
|
|
456
|
+
allValueImports,
|
|
457
|
+
allTypeImports
|
|
458
|
+
);
|
|
459
|
+
let result = content;
|
|
460
|
+
const sortedKumoImports = [...kumoImports].sort(
|
|
461
|
+
(a, b) => b.startIndex - a.startIndex
|
|
462
|
+
);
|
|
463
|
+
for (let i = 0; i < sortedKumoImports.length; i++) {
|
|
464
|
+
const imp = sortedKumoImports[i];
|
|
465
|
+
if (i === sortedKumoImports.length - 1) {
|
|
466
|
+
result = result.slice(0, imp.startIndex) + consolidatedImport + result.slice(imp.endIndex);
|
|
415
467
|
} else {
|
|
416
|
-
|
|
468
|
+
let startIndex = imp.startIndex;
|
|
469
|
+
let endIndex = imp.endIndex;
|
|
470
|
+
if (startIndex > 0 && result[startIndex - 1] === "\n") {
|
|
471
|
+
startIndex--;
|
|
472
|
+
}
|
|
473
|
+
result = result.slice(0, startIndex) + result.slice(endIndex);
|
|
417
474
|
}
|
|
418
|
-
}
|
|
475
|
+
}
|
|
476
|
+
return result;
|
|
419
477
|
}
|
|
420
478
|
|
|
421
479
|
// src/command-line/commands/add.ts
|
|
422
480
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
423
481
|
function getRegistryPath4() {
|
|
424
|
-
const
|
|
482
|
+
const __dirname = dirname4(fileURLToPath4(import.meta.url));
|
|
425
483
|
const possiblePaths = [
|
|
426
|
-
join5(
|
|
427
|
-
join5(
|
|
428
|
-
join5(
|
|
484
|
+
join5(__dirname, "..", "..", "ai", "component-registry.json"),
|
|
485
|
+
join5(__dirname, "..", "ai", "component-registry.json"),
|
|
486
|
+
join5(__dirname, "ai", "component-registry.json")
|
|
429
487
|
];
|
|
430
488
|
for (const path of possiblePaths) {
|
|
431
489
|
if (existsSync2(path)) {
|
|
@@ -437,11 +495,11 @@ function getRegistryPath4() {
|
|
|
437
495
|
);
|
|
438
496
|
}
|
|
439
497
|
function getBlocksSourcePath() {
|
|
440
|
-
const
|
|
498
|
+
const __dirname = dirname4(fileURLToPath4(import.meta.url));
|
|
441
499
|
const possiblePaths = [
|
|
442
|
-
join5(
|
|
443
|
-
join5(
|
|
444
|
-
join5(
|
|
500
|
+
join5(__dirname, "..", "..", "src", "blocks"),
|
|
501
|
+
join5(__dirname, "..", "src", "blocks"),
|
|
502
|
+
join5(__dirname, "src", "blocks")
|
|
445
503
|
];
|
|
446
504
|
for (const path of possiblePaths) {
|
|
447
505
|
if (existsSync2(path)) {
|
|
@@ -696,10 +754,9 @@ function migrate(args) {
|
|
|
696
754
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
697
755
|
import { dirname as dirname5, join as join6 } from "node:path";
|
|
698
756
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
699
|
-
var __dirname = dirname5(fileURLToPath5(import.meta.url));
|
|
700
757
|
function ai() {
|
|
701
|
-
const
|
|
702
|
-
const usagePath = join6(
|
|
758
|
+
const __dirname = dirname5(fileURLToPath5(import.meta.url));
|
|
759
|
+
const usagePath = join6(__dirname, "..", "..", "ai", "USAGE.md");
|
|
703
760
|
try {
|
|
704
761
|
const content = readFileSync6(usagePath, "utf-8");
|
|
705
762
|
console.log(content);
|
|
@@ -33,40 +33,98 @@ function readConfig(projectRoot = process.cwd()) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// src/command-line/utils/transformer.ts
|
|
36
|
-
function
|
|
37
|
-
const importRegex = /import\s+(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
function parseImports(content) {
|
|
37
|
+
const importRegex = /import\s+(type\s+)?{([^}]+)}\s+from\s+["']([^"']+)["'];?/g;
|
|
38
|
+
const imports = [];
|
|
39
|
+
let match;
|
|
40
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
41
|
+
imports.push({
|
|
42
|
+
fullMatch: match[0],
|
|
43
|
+
imports: match[2],
|
|
44
|
+
path: match[3],
|
|
45
|
+
startIndex: match.index,
|
|
46
|
+
endIndex: match.index + match[0].length,
|
|
47
|
+
isTypeOnlyImport: match[1] !== void 0
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return imports;
|
|
51
|
+
}
|
|
52
|
+
function shouldTransformToKumo(path) {
|
|
53
|
+
if (!path.startsWith("../")) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return path.includes("/components/") || path.includes("/utils/");
|
|
57
|
+
}
|
|
58
|
+
function parseImportItems(imports, isTypeOnlyImport) {
|
|
59
|
+
const items = imports.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
|
|
60
|
+
const valueImports = [];
|
|
61
|
+
const typeImports = [];
|
|
62
|
+
for (const item of items) {
|
|
63
|
+
if (isTypeOnlyImport || item.startsWith("type ")) {
|
|
64
|
+
const typeName = item.startsWith("type ") ? item.slice(5).trim() : item;
|
|
65
|
+
typeImports.push(typeName);
|
|
66
|
+
} else {
|
|
67
|
+
valueImports.push(item);
|
|
45
68
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
}
|
|
70
|
+
return { valueImports, typeImports };
|
|
71
|
+
}
|
|
72
|
+
function buildConsolidatedImport(valueImports, typeImports) {
|
|
73
|
+
const parts = [];
|
|
74
|
+
for (const item of valueImports) {
|
|
75
|
+
parts.push(item);
|
|
76
|
+
}
|
|
77
|
+
for (const item of typeImports) {
|
|
78
|
+
parts.push(`type ${item}`);
|
|
79
|
+
}
|
|
80
|
+
return `import { ${parts.join(", ")} } from "@cloudflare/kumo";`;
|
|
81
|
+
}
|
|
82
|
+
function transformImports(content) {
|
|
83
|
+
const parsedImports = parseImports(content);
|
|
84
|
+
const kumoImports = [];
|
|
85
|
+
const nonKumoImports = [];
|
|
86
|
+
for (const imp of parsedImports) {
|
|
87
|
+
if (shouldTransformToKumo(imp.path)) {
|
|
88
|
+
kumoImports.push(imp);
|
|
89
|
+
} else {
|
|
90
|
+
nonKumoImports.push(imp);
|
|
56
91
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
92
|
+
}
|
|
93
|
+
if (kumoImports.length === 0) {
|
|
94
|
+
return content;
|
|
95
|
+
}
|
|
96
|
+
const allValueImports = [];
|
|
97
|
+
const allTypeImports = [];
|
|
98
|
+
for (const imp of kumoImports) {
|
|
99
|
+
const { valueImports, typeImports } = parseImportItems(
|
|
100
|
+
imp.imports,
|
|
101
|
+
imp.isTypeOnlyImport
|
|
102
|
+
);
|
|
103
|
+
allValueImports.push(...valueImports);
|
|
104
|
+
allTypeImports.push(...typeImports);
|
|
105
|
+
}
|
|
106
|
+
const consolidatedImport = buildConsolidatedImport(
|
|
107
|
+
allValueImports,
|
|
108
|
+
allTypeImports
|
|
109
|
+
);
|
|
110
|
+
let result = content;
|
|
111
|
+
const sortedKumoImports = [...kumoImports].sort(
|
|
112
|
+
(a, b) => b.startIndex - a.startIndex
|
|
113
|
+
);
|
|
114
|
+
for (let i = 0; i < sortedKumoImports.length; i++) {
|
|
115
|
+
const imp = sortedKumoImports[i];
|
|
116
|
+
if (i === sortedKumoImports.length - 1) {
|
|
117
|
+
result = result.slice(0, imp.startIndex) + consolidatedImport + result.slice(imp.endIndex);
|
|
66
118
|
} else {
|
|
67
|
-
|
|
119
|
+
let startIndex = imp.startIndex;
|
|
120
|
+
let endIndex = imp.endIndex;
|
|
121
|
+
if (startIndex > 0 && result[startIndex - 1] === "\n") {
|
|
122
|
+
startIndex--;
|
|
123
|
+
}
|
|
124
|
+
result = result.slice(0, startIndex) + result.slice(endIndex);
|
|
68
125
|
}
|
|
69
|
-
}
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
70
128
|
}
|
|
71
129
|
|
|
72
130
|
// src/command-line/commands/add.ts
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
7
|
function ai() {
|
|
9
|
-
const
|
|
10
|
-
const usagePath = join(
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const usagePath = join(__dirname, "..", "..", "ai", "USAGE.md");
|
|
11
10
|
try {
|
|
12
11
|
const content = readFileSync(usagePath, "utf-8");
|
|
13
12
|
console.log(content);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs as
|
|
2
|
+
import { jsx as e, jsxs as p, Fragment as E } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef as K, useContext as N, createContext as v, useCallback as b, useRef as T } from "react";
|
|
4
4
|
import { CaretRightIcon as M, ArrowSquareOutIcon as H, ArrowRightIcon as _, MagnifyingGlassIcon as F } from "@phosphor-icons/react";
|
|
5
5
|
import { S as G } from "./surface-BIC6CXiz.js";
|
|
6
6
|
import { L as j } from "./loader-DHGMYlC6.js";
|
|
7
7
|
import { c as m } from "./cn-Bhsu1vx2.js";
|
|
8
|
-
import {
|
|
8
|
+
import { a3 as U, a4 as z, a8 as O, aa as w, a7 as V, a6 as $, a9 as q, bf as B, am as S, ar as J, as as Q, at as W } from "./vendor-base-ui-9w7J6BvW.js";
|
|
9
9
|
const C = v({});
|
|
10
10
|
function I({
|
|
11
11
|
open: t,
|
|
@@ -18,9 +18,9 @@ function I({
|
|
|
18
18
|
}, c = b(() => {
|
|
19
19
|
n(!1);
|
|
20
20
|
}, [n]);
|
|
21
|
-
return /* @__PURE__ */ e(
|
|
21
|
+
return /* @__PURE__ */ e(S, { open: t, onOpenChange: n, modal: !0, children: /* @__PURE__ */ p(J, { children: [
|
|
22
22
|
/* @__PURE__ */ e(
|
|
23
|
-
|
|
23
|
+
Q,
|
|
24
24
|
{
|
|
25
25
|
className: "fixed inset-0 bg-kumo-overlay opacity-80 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",
|
|
26
26
|
onClick: s
|
|
@@ -29,7 +29,7 @@ function I({
|
|
|
29
29
|
/* @__PURE__ */ e(
|
|
30
30
|
G,
|
|
31
31
|
{
|
|
32
|
-
as:
|
|
32
|
+
as: W,
|
|
33
33
|
className: m(
|
|
34
34
|
"fixed top-[10vh] left-1/2 w-full max-w-2xl -translate-x-1/2",
|
|
35
35
|
"overflow-hidden rounded-lg",
|
|
@@ -44,7 +44,7 @@ function I({
|
|
|
44
44
|
)
|
|
45
45
|
] }) });
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function X({
|
|
48
48
|
open: t,
|
|
49
49
|
onOpenChange: n,
|
|
50
50
|
onBackdropClick: o,
|
|
@@ -65,7 +65,7 @@ function Y({
|
|
|
65
65
|
onOpenChange: n,
|
|
66
66
|
onBackdropClick: o,
|
|
67
67
|
children: /* @__PURE__ */ e(
|
|
68
|
-
|
|
68
|
+
L,
|
|
69
69
|
{
|
|
70
70
|
items: s,
|
|
71
71
|
value: c,
|
|
@@ -82,12 +82,12 @@ function Y({
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Y({
|
|
86
86
|
children: t,
|
|
87
87
|
leading: n,
|
|
88
88
|
trailing: o
|
|
89
89
|
}) {
|
|
90
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ p("div", { className: "flex items-center gap-3 bg-kumo-base px-4 py-3", children: [
|
|
91
91
|
n ?? /* @__PURE__ */ e(
|
|
92
92
|
F,
|
|
93
93
|
{
|
|
@@ -113,7 +113,7 @@ const D = K(function({ children: n, className: o }, l) {
|
|
|
113
113
|
);
|
|
114
114
|
});
|
|
115
115
|
D.displayName = "CommandPalette.List";
|
|
116
|
-
function
|
|
116
|
+
function Z({
|
|
117
117
|
children: t,
|
|
118
118
|
className: n,
|
|
119
119
|
...o
|
|
@@ -125,7 +125,7 @@ function ee({
|
|
|
125
125
|
className: n
|
|
126
126
|
}) {
|
|
127
127
|
return /* @__PURE__ */ e(
|
|
128
|
-
|
|
128
|
+
V,
|
|
129
129
|
{
|
|
130
130
|
className: m(
|
|
131
131
|
"mb-2 px-2 pt-1 text-xs font-semibold text-kumo-strong",
|
|
@@ -160,7 +160,7 @@ function te({
|
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
162
|
function ne({ children: t }) {
|
|
163
|
-
return /* @__PURE__ */ e(
|
|
163
|
+
return /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e("div", { className: "p-8 text-center", children: /* @__PURE__ */ e("p", { className: "text-kumo-strong", children: t ?? "No results found" }) }) });
|
|
164
164
|
}
|
|
165
165
|
function oe({ children: t }) {
|
|
166
166
|
return /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: t ?? /* @__PURE__ */ e(j, { size: 24 }) });
|
|
@@ -209,7 +209,7 @@ function se({
|
|
|
209
209
|
external: d = !1,
|
|
210
210
|
nonInteractive: r = !1
|
|
211
211
|
}) {
|
|
212
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ p(
|
|
213
213
|
w,
|
|
214
214
|
{
|
|
215
215
|
value: u,
|
|
@@ -220,13 +220,13 @@ function se({
|
|
|
220
220
|
),
|
|
221
221
|
children: [
|
|
222
222
|
c && /* @__PURE__ */ e("div", { className: "flex flex-shrink-0 items-center text-kumo-subtle", children: c }),
|
|
223
|
-
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */
|
|
224
|
-
n?.map((f,
|
|
223
|
+
/* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ p("div", { className: "flex items-center gap-2 truncate", children: [
|
|
224
|
+
n?.map((f, g) => /* @__PURE__ */ p("span", { className: "flex items-center gap-2", children: [
|
|
225
225
|
/* @__PURE__ */ e(
|
|
226
226
|
y,
|
|
227
227
|
{
|
|
228
228
|
text: f,
|
|
229
|
-
highlights: l?.[
|
|
229
|
+
highlights: l?.[g],
|
|
230
230
|
className: "text-base text-kumo-default"
|
|
231
231
|
}
|
|
232
232
|
),
|
|
@@ -237,7 +237,7 @@ function se({
|
|
|
237
237
|
weight: "bold"
|
|
238
238
|
}
|
|
239
239
|
)
|
|
240
|
-
] },
|
|
240
|
+
] }, g)),
|
|
241
241
|
/* @__PURE__ */ e(
|
|
242
242
|
y,
|
|
243
243
|
{
|
|
@@ -247,7 +247,7 @@ function se({
|
|
|
247
247
|
}
|
|
248
248
|
),
|
|
249
249
|
d && /* @__PURE__ */ e(H, { className: "h-3.5 w-3.5 flex-shrink-0 text-kumo-subtle" }),
|
|
250
|
-
s && /* @__PURE__ */
|
|
250
|
+
s && /* @__PURE__ */ p(E, { children: [
|
|
251
251
|
/* @__PURE__ */ e("span", { className: "text-kumo-strong", children: "—" }),
|
|
252
252
|
/* @__PURE__ */ e("span", { className: "truncate text-sm text-kumo-strong", children: s })
|
|
253
253
|
] })
|
|
@@ -272,8 +272,8 @@ function re({
|
|
|
272
272
|
}
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
function
|
|
275
|
+
const A = v({}), le = () => !0;
|
|
276
|
+
function L({
|
|
277
277
|
children: t,
|
|
278
278
|
items: n,
|
|
279
279
|
value: o,
|
|
@@ -286,12 +286,12 @@ function A({
|
|
|
286
286
|
onSelect: d,
|
|
287
287
|
getSelectableItems: r
|
|
288
288
|
}) {
|
|
289
|
-
const f = T(-1),
|
|
289
|
+
const f = T(-1), g = b(
|
|
290
290
|
(h, x) => {
|
|
291
291
|
f.current = x.index, s?.(h, x);
|
|
292
292
|
},
|
|
293
293
|
[s]
|
|
294
|
-
),
|
|
294
|
+
), P = b(
|
|
295
295
|
(h) => {
|
|
296
296
|
const x = h.key === "Enter", R = h.metaKey || h.ctrlKey;
|
|
297
297
|
if (x && R && d && r) {
|
|
@@ -307,13 +307,13 @@ function A({
|
|
|
307
307
|
items: n,
|
|
308
308
|
value: o,
|
|
309
309
|
onValueChange: l,
|
|
310
|
-
onItemHighlighted:
|
|
310
|
+
onItemHighlighted: g,
|
|
311
311
|
itemToStringValue: c,
|
|
312
312
|
filter: u,
|
|
313
313
|
autoHighlight: "always",
|
|
314
314
|
keepHighlight: !0,
|
|
315
315
|
open: i,
|
|
316
|
-
children: /* @__PURE__ */ e(
|
|
316
|
+
children: /* @__PURE__ */ e(A.Provider, { value: { onInputKeyDown: P }, children: t })
|
|
317
317
|
}
|
|
318
318
|
) });
|
|
319
319
|
}
|
|
@@ -326,7 +326,7 @@ function ie({
|
|
|
326
326
|
trailing: c,
|
|
327
327
|
...u
|
|
328
328
|
}) {
|
|
329
|
-
const { onInputKeyDown: i } = N(
|
|
329
|
+
const { onInputKeyDown: i } = N(A), { onClose: a } = N(C), d = b(
|
|
330
330
|
(r) => {
|
|
331
331
|
if (l?.(r), !r.defaultPrevented) {
|
|
332
332
|
if (r.key === "Escape" && a) {
|
|
@@ -338,7 +338,7 @@ function ie({
|
|
|
338
338
|
},
|
|
339
339
|
[i, l, a]
|
|
340
340
|
);
|
|
341
|
-
return /* @__PURE__ */ e(
|
|
341
|
+
return /* @__PURE__ */ e(Y, { leading: s, trailing: c, children: /* @__PURE__ */ e(
|
|
342
342
|
q,
|
|
343
343
|
{
|
|
344
344
|
placeholder: n,
|
|
@@ -357,21 +357,21 @@ function ce({
|
|
|
357
357
|
children: t,
|
|
358
358
|
className: n
|
|
359
359
|
}) {
|
|
360
|
-
return /* @__PURE__ */ e(
|
|
360
|
+
return /* @__PURE__ */ e(z, { className: m("space-y-3", n), children: t });
|
|
361
361
|
}
|
|
362
362
|
const ue = U, ye = {}, ke = {}, Ne = {
|
|
363
363
|
/** Modal dialog wrapper - use with Panel for content that can swap */
|
|
364
364
|
Dialog: I,
|
|
365
365
|
/** Dialog + Panel combined - for simple single-view command palettes */
|
|
366
|
-
Root:
|
|
366
|
+
Root: X,
|
|
367
367
|
/** Autocomplete panel without dialog - use inside Dialog for swappable content */
|
|
368
|
-
Panel:
|
|
368
|
+
Panel: L,
|
|
369
369
|
/** Input for use inside Panel */
|
|
370
370
|
Input: ie,
|
|
371
371
|
/** Scrollable results container */
|
|
372
372
|
List: D,
|
|
373
373
|
/** Category grouping */
|
|
374
|
-
Group:
|
|
374
|
+
Group: Z,
|
|
375
375
|
/** Section header text */
|
|
376
376
|
GroupLabel: ee,
|
|
377
377
|
/** Basic item */
|
|
@@ -396,4 +396,4 @@ export {
|
|
|
396
396
|
ye as K,
|
|
397
397
|
ke as a
|
|
398
398
|
};
|
|
399
|
-
//# sourceMappingURL=command-palette-
|
|
399
|
+
//# sourceMappingURL=command-palette-D3MNR7w9.js.map
|