@marimo-team/islands 0.20.5-dev3 → 0.20.5-dev33
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/dist/{Combination-Du-o_hC9.js → Combination-Dk6JxauT.js} +1 -1
- package/dist/{ConnectedDataExplorerComponent-DUS-zJoR.js → ConnectedDataExplorerComponent-B07FkeWC.js} +10 -10
- package/dist/{any-language-editor-BL9o7y0_.js → any-language-editor-BIj11a2e.js} +19 -19
- package/dist/{architectureDiagram-VXUJARFQ-DrJeyFHq.js → architectureDiagram-VXUJARFQ-IZt4NuSd.js} +5 -5
- package/dist/{blockDiagram-VD42YOAC-BJrP6qKc.js → blockDiagram-VD42YOAC-mhFHC3Ty.js} +5 -5
- package/dist/{button-KYalaJYu.js → button-DQpBib29.js} +24 -11
- package/dist/{c4Diagram-YG6GDRKO-Bo4gytQ5.js → c4Diagram-YG6GDRKO-BzStmvfT.js} +4 -4
- package/dist/{channel-IWLGkaBE.js → channel-CUFaIkTh.js} +1 -1
- package/dist/{check-C50jsehH.js → check-DpqPQmzz.js} +1 -1
- package/dist/{chunk-ABZYJK2D-CRwanrkd.js → chunk-ABZYJK2D-7QYXAAhe.js} +1 -1
- package/dist/{chunk-ATLVNIR6-CMMCMvOK.js → chunk-ATLVNIR6-pmHPAPSd.js} +1 -1
- package/dist/{chunk-B4BG7PRW-BNsHrGHG.js → chunk-B4BG7PRW-C9mfKT9i.js} +4 -4
- package/dist/{chunk-DI55MBZ5-DQeYbfMV.js → chunk-DI55MBZ5-IKrK49rX.js} +4 -4
- package/dist/{chunk-EXTU4WIE-CV_DQeaX.js → chunk-EXTU4WIE-BRFl4iNd.js} +1 -1
- package/dist/{chunk-JA3XYJ7Z-Cmt--e0q.js → chunk-JA3XYJ7Z-C9q_MXZQ.js} +2 -2
- package/dist/{chunk-JZLCHNYA-CkyMJnI9.js → chunk-JZLCHNYA-DVjoFib5.js} +4 -4
- package/dist/{chunk-N4CR4FBY-BJfHtJbD.js → chunk-N4CR4FBY-BYr5N5mX.js} +5 -5
- package/dist/{chunk-QN33PNHL-WOLIPUAJ.js → chunk-QN33PNHL-CXfJywHv.js} +1 -1
- package/dist/{chunk-QXUST7PY-DYuD50pU.js → chunk-QXUST7PY-YO0PM8b3.js} +5 -5
- package/dist/{chunk-S3R3BYOJ-CsnX6RKs.js → chunk-S3R3BYOJ-DgI4FlvW.js} +1 -1
- package/dist/{chunk-TZMSLE5B-B3eYTGCw.js → chunk-TZMSLE5B-DSfBOnzx.js} +1 -1
- package/dist/{classDiagram-2ON5EDUG-C7C-oefv.js → classDiagram-2ON5EDUG-CvpnTWzz.js} +10 -10
- package/dist/{classDiagram-v2-WZHVMYZB-UTw37Gg8.js → classDiagram-v2-WZHVMYZB-DEQrBHLI.js} +10 -10
- package/dist/{copy-oc-FcZzt.js → copy-BkBF0Xgk.js} +2 -2
- package/dist/{dagre-6UL2VRFP-BgsUhJrV.js → dagre-6UL2VRFP-DC-emrm5.js} +7 -7
- package/dist/{diagram-PSM6KHXK-BIUUOfKo.js → diagram-PSM6KHXK-BAgNlpL8.js} +6 -6
- package/dist/{diagram-QEK2KX5R-BFjolZQv.js → diagram-QEK2KX5R-BM7QE5WA.js} +4 -4
- package/dist/{diagram-S2PKOQOG-4jfkWoZw.js → diagram-S2PKOQOG-qs4mB1gW.js} +4 -4
- package/dist/dist-B4MxkKHf.js +8 -0
- package/dist/{dist-De9X_Des.js → dist-B9EjSb9T.js} +1 -1
- package/dist/{dist-IW_ARJ3S.js → dist-BFxYppVR.js} +4 -4
- package/dist/{dist-D7ZGWV_9.js → dist-BGZ7TWS9.js} +3 -3
- package/dist/{dist-CwtEWuFb.js → dist-BSfYc7vq.js} +2 -2
- package/dist/{dist-DMS81OrU.js → dist-BUrWeMEP.js} +1 -1
- package/dist/dist-BYghZv6b.js +5 -0
- package/dist/dist-Be-uQhz5.js +6 -0
- package/dist/{dist-Ch_JuCvc.js → dist-BpMlUdNO.js} +3 -3
- package/dist/{dist-C6z8U-ms.js → dist-Bq5eYK43.js} +2 -2
- package/dist/{dist-BFL9TlzD.js → dist-Bq9zYwJs.js} +5 -5
- package/dist/{dist-7ZF--V_D.js → dist-C4K7pumm.js} +2 -2
- package/dist/{dist-Qjf6pcqK.js → dist-CAKwXCWI.js} +2 -2
- package/dist/dist-CB_xf0ju.js +5 -0
- package/dist/{dist-BwQHkjA9.js → dist-CDHl2i1x.js} +4 -4
- package/dist/dist-CK0qFAbF.js +8 -0
- package/dist/{dist-C4XMUaob.js → dist-CPlGUbk-.js} +2 -2
- package/dist/{dist-BT6_J2eq.js → dist-CSEWGuDq.js} +7 -2
- package/dist/dist-CYEk-qrr.js +8 -0
- package/dist/{dist-CYo3w-nC.js → dist-Cl5iM8xL.js} +3 -3
- package/dist/dist-CmKoWpMk.js +5 -0
- package/dist/{dist-I8MQW60_.js → dist-CseYuPtL.js} +2 -2
- package/dist/dist-D1nf4IQl.js +5 -0
- package/dist/{dist-CsqiXw7J.js → dist-D4gcY469.js} +2 -2
- package/dist/{dist-DUxS2paD.js → dist-D5NMgbbv.js} +2 -2
- package/dist/{dist-UYm1IE5s.js → dist-DERtJN02.js} +2 -2
- package/dist/{dist-CFToYDWO.js → dist-DEj2X26M.js} +2 -2
- package/dist/{dist-BuapEdlD.js → dist-DOoqn-VL.js} +70 -67
- package/dist/{dist-BLThQiU4.js → dist-DUretbKK.js} +2 -2
- package/dist/{dist-DEFZ7dnD.js → dist-D_-CGmlh.js} +2 -2
- package/dist/dist-Df3AcKpt.js +6 -0
- package/dist/dist-DgaFHt_I.js +5 -0
- package/dist/dist-Dk10C3ui.js +5 -0
- package/dist/{dist-D0f6Yrrb.js → dist-DodLQWPg.js} +1 -1
- package/dist/dist-DtyPVMHR.js +5 -0
- package/dist/{dist-Cb3cLT39.js → dist-HoZO6brh.js} +2 -2
- package/dist/{dist-Cqpjy6bK.js → dist-RNGn_-uD.js} +1 -1
- package/dist/{dist-BBcqvpvP.js → dist-Ux6dL_VB.js} +1 -1
- package/dist/{dist-B8Y11RWn.js → dist-WIWVvdBh.js} +2 -2
- package/dist/{dist-CB6qhQ8K.js → dist-gc9KgJuA.js} +1 -1
- package/dist/{dist-ovDpXuSB.js → dist-i-ud9aCA.js} +1 -1
- package/dist/dist-ko7WnHAO.js +5 -0
- package/dist/{dist-BTQbjEKU.js → dist-lNe4i1Nm.js} +1 -1
- package/dist/dist-of7gLRFK.js +8 -0
- package/dist/{erDiagram-Q2GNP2WA-Cq5Bz5lG.js → erDiagram-Q2GNP2WA-Dh5nhgY3.js} +10 -10
- package/dist/{error-banner-D0tXnwl4.js → error-banner-BctofTCP.js} +2 -2
- package/dist/{esm-BxMbHo0y.js → esm-BBkPJL8N.js} +29 -27
- package/dist/{flowDiagram-NV44I4VS-6WPJVFl7.js → flowDiagram-NV44I4VS-ChR1Vbmj.js} +10 -10
- package/dist/{ganttDiagram-JELNMOA3-AfDhh9CI.js → ganttDiagram-JELNMOA3-sK0z-5KM.js} +3 -3
- package/dist/{gitGraphDiagram-V2S2FVAM-BRSwuj0Q.js → gitGraphDiagram-V2S2FVAM-9S1VqQrL.js} +3 -3
- package/dist/{glide-data-editor-ByPNTNVG.js → glide-data-editor-DI5VFwRB.js} +63 -63
- package/dist/{infoDiagram-HS3SLOUP-Cmxo6jKx.js → infoDiagram-HS3SLOUP-C5A8b-2O.js} +3 -3
- package/dist/{journeyDiagram-XKPGCS4Q-CKYr8cSR.js → journeyDiagram-XKPGCS4Q-D5BIjS4N.js} +3 -3
- package/dist/{kanban-definition-3W4ZIXB7-DVvAZzQD.js → kanban-definition-3W4ZIXB7-C1vZZabj.js} +7 -7
- package/dist/{label-CV0KYhtH.js → label-Cx28eo0O.js} +5 -5
- package/dist/{loader-eJCvvApN.js → loader-C62dRCuy.js} +1 -1
- package/dist/main.js +1564 -1093
- package/dist/{mermaid-COOB_abB.js → mermaid-BgeZPIms.js} +41 -41
- package/dist/{mindmap-definition-VGOIOE7T-1ExmnvYy.js → mindmap-definition-VGOIOE7T-Cn9_H_5f.js} +9 -9
- package/dist/{pieDiagram-ADFJNKIX-CJlIsdsU.js → pieDiagram-ADFJNKIX-iA0mvRW9.js} +4 -4
- package/dist/{purify.es-CyOIw8ru.js → purify.es-DGenX2XH.js} +67 -67
- package/dist/{quadrantDiagram-AYHSOK5B-BU78RiaH.js → quadrantDiagram-AYHSOK5B-CAcVWXc-.js} +2 -2
- package/dist/{requirementDiagram-UZGBJVZJ-DACHtrFr.js → requirementDiagram-UZGBJVZJ-1HxQ6I5Z.js} +9 -9
- package/dist/{sankeyDiagram-TZEHDZUN-Bzg7_UWs.js → sankeyDiagram-TZEHDZUN-BVJnR4_b.js} +2 -2
- package/dist/{sequenceDiagram-WL72ISMW-agybEe9J.js → sequenceDiagram-WL72ISMW-ByirOtHb.js} +4 -4
- package/dist/{slides-component-B0yK5GXP.js → slides-component-DwvL_HJi.js} +2 -2
- package/dist/{spec-Dq_reDGM.js → spec-B8V2Bcbi.js} +4 -4
- package/dist/{stateDiagram-FKZM4ZOC-DehQAt8g.js → stateDiagram-FKZM4ZOC-DrYNXdQr.js} +10 -10
- package/dist/{stateDiagram-v2-4FDKWEC3-8VzeREl9.js → stateDiagram-v2-4FDKWEC3-C9CFKCSr.js} +10 -10
- package/dist/style.css +1 -1
- package/dist/{timeline-definition-IT6M3QCI-CdCfdaCF.js → timeline-definition-IT6M3QCI-D8B3p7ID.js} +2 -2
- package/dist/{tooltip-CL8m4f9y.js → tooltip-SPkubVH3.js} +3 -3
- package/dist/{types-BwnzGcE4.js → types-DqrGPzsT.js} +517 -406
- package/dist/{useAsyncData-B4hMFGnF.js → useAsyncData-Ioeh75f8.js} +1 -1
- package/dist/{useDeepCompareMemoize-DuPhOXzr.js → useDeepCompareMemoize-DtbTAJq3.js} +4 -4
- package/dist/{useIframeCapabilities-CAt6D2EI.js → useIframeCapabilities-DFGZKWkO.js} +1 -1
- package/dist/{useTheme-BNYQnvu-.js → useTheme-OvBNH9t3.js} +2 -2
- package/dist/{vega-component-DouPy8AI.js → vega-component-B_4Lp3hK.js} +8 -8
- package/dist/{xychartDiagram-PRI3JC2R-rEm_SIsC.js → xychartDiagram-PRI3JC2R-KuxgQuK9.js} +5 -5
- package/package.json +9 -9
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/app-config/ai-config.tsx +10 -0
- package/src/components/data-table/pagination.tsx +36 -30
- package/src/components/datasources/components.tsx +3 -6
- package/src/components/datasources/datasources.tsx +8 -21
- package/src/components/editor/actions/types.ts +6 -1
- package/src/components/editor/actions/useNotebookActions.tsx +50 -13
- package/src/components/editor/chrome/types.ts +17 -0
- package/src/components/editor/controls/command-palette.tsx +7 -0
- package/src/components/editor/controls/keyboard-shortcuts.tsx +3 -1
- package/src/components/editor/file-tree/file-explorer.tsx +48 -62
- package/src/components/editor/file-tree/file-icons.tsx +132 -0
- package/src/components/editor/file-tree/file-viewer.tsx +1 -1
- package/src/components/editor/file-tree/tree-actions.tsx +107 -0
- package/src/components/editor/file-tree/types.ts +2 -96
- package/src/components/editor/header/filename-input.tsx +4 -1
- package/src/components/icons/marimo-icons.tsx +2 -2
- package/src/components/pages/home-page.tsx +5 -5
- package/src/components/storage/components.tsx +0 -38
- package/src/components/storage/storage-file-viewer.tsx +1 -1
- package/src/components/storage/storage-inspector.tsx +28 -45
- package/src/components/ui/command.tsx +2 -0
- package/src/components/ui/links.tsx +1 -0
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +79 -0
- package/src/core/ai/tools/run-cells-tool.ts +63 -17
- package/src/core/hotkeys/__tests__/hotkeys.test.ts +64 -1
- package/src/core/hotkeys/hotkeys.ts +29 -3
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/network/__tests__/requests-network.test.ts +17 -0
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +9 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +1 -0
- package/src/core/network/types.ts +1 -0
- package/src/core/wasm/bridge.ts +1 -0
- package/src/plugins/impl/FileBrowserPlugin.tsx +4 -4
- package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +309 -0
- package/src/plugins/impl/mpl-interactive/__tests__/mpl-websocket-shim.test.ts +110 -0
- package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +57 -0
- package/src/plugins/plugins.ts +2 -0
- package/src/utils/__tests__/filenames.test.ts +7 -0
- package/src/utils/__tests__/smartMatch.test.ts +61 -0
- package/src/utils/filenames.ts +3 -0
- package/src/utils/smartMatch.ts +62 -0
- package/dist/dist-BAeGo2rp.js +0 -5
- package/dist/dist-BqwCMSEa.js +0 -5
- package/dist/dist-Bum8FwTO.js +0 -6
- package/dist/dist-C0YiOwt_.js +0 -5
- package/dist/dist-C2uPv4iU.js +0 -5
- package/dist/dist-C5hOLsJN.js +0 -8
- package/dist/dist-C9NIAKMs.js +0 -8
- package/dist/dist-CCrzTtvk.js +0 -5
- package/dist/dist-CFS9i1rS.js +0 -8
- package/dist/dist-CyHZuhPH.js +0 -5
- package/dist/dist-CzcjWdIk.js +0 -6
- package/dist/dist-DaYyUSNC.js +0 -5
- package/dist/dist-DpDcJYNh.js +0 -8
- package/dist/dist-U_BfxcPn.js +0 -5
package/src/plugins/plugins.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { MatrixPlugin } from "./impl/MatrixPlugin";
|
|
|
26
26
|
import { MicrophonePlugin } from "./impl/MicrophonePlugin";
|
|
27
27
|
import { MultiselectPlugin } from "./impl/MultiselectPlugin";
|
|
28
28
|
import { MatplotlibPlugin } from "./impl/matplotlib/MatplotlibPlugin";
|
|
29
|
+
import { MplInteractivePlugin } from "./impl/mpl-interactive/MplInteractivePlugin";
|
|
29
30
|
import { NumberPlugin } from "./impl/NumberPlugin";
|
|
30
31
|
import { PanelPlugin } from "./impl/panel/PanelPlugin";
|
|
31
32
|
import { PlotlyPlugin } from "./impl/plotly/PlotlyPlugin";
|
|
@@ -92,6 +93,7 @@ export const UI_PLUGINS: IPlugin<any, unknown>[] = [
|
|
|
92
93
|
AnyWidgetPlugin,
|
|
93
94
|
DataEditorPlugin,
|
|
94
95
|
PanelPlugin,
|
|
96
|
+
MplInteractivePlugin,
|
|
95
97
|
];
|
|
96
98
|
|
|
97
99
|
// List of output / layout plugins
|
|
@@ -23,6 +23,12 @@ describe("Filenames", () => {
|
|
|
23
23
|
expect(Filenames.toPNG("test.foo.py")).toEqual("test.foo.png");
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
it("should convert filename to ipynb", () => {
|
|
27
|
+
expect(Filenames.toIPYNB("test")).toEqual("test.ipynb");
|
|
28
|
+
expect(Filenames.toIPYNB("test.txt")).toEqual("test.ipynb");
|
|
29
|
+
expect(Filenames.toIPYNB("test.foo.py")).toEqual("test.foo.ipynb");
|
|
30
|
+
});
|
|
31
|
+
|
|
26
32
|
it("should remove extension from filename", () => {
|
|
27
33
|
expect(Filenames.withoutExtension("test")).toEqual("test");
|
|
28
34
|
expect(Filenames.withoutExtension("test.txt")).toEqual("test");
|
|
@@ -39,6 +45,7 @@ describe("Filenames", () => {
|
|
|
39
45
|
expect(Filenames.toHTML(filename)).toEqual(`${withoutExt}.html`);
|
|
40
46
|
expect(Filenames.toPNG(filename)).toEqual(`${withoutExt}.png`);
|
|
41
47
|
expect(Filenames.toPY(filename)).toEqual(`${withoutExt}.py`);
|
|
48
|
+
expect(Filenames.toIPYNB(filename)).toEqual(`${withoutExt}.ipynb`);
|
|
42
49
|
|
|
43
50
|
// Ensure operations preserve unicode and special characters in base name
|
|
44
51
|
expect(withoutExt).not.toEqual("");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { smartMatch, smartMatchFilter } from "../smartMatch";
|
|
4
|
+
|
|
5
|
+
describe("smartMatch", () => {
|
|
6
|
+
it("matches exact word", () => {
|
|
7
|
+
expect(smartMatch("run", "Run cell")).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("matches word prefix", () => {
|
|
11
|
+
expect(smartMatch("exe", "execute start")).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("matches across array of haystacks", () => {
|
|
15
|
+
expect(smartMatch("exe", ["Run", "execute start"])).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("does not match unrelated terms", () => {
|
|
19
|
+
expect(smartMatch("xyz", "Run cell")).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("empty search matches everything", () => {
|
|
23
|
+
expect(smartMatch("", "anything")).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("multi-word needle requires all words to match", () => {
|
|
27
|
+
expect(smartMatch("run cell", "Run cell")).toBe(true);
|
|
28
|
+
expect(smartMatch("run xyz", "Run cell")).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("is case-insensitive", () => {
|
|
32
|
+
expect(smartMatch("RUN", "run cell")).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("skips null/undefined haystacks", () => {
|
|
36
|
+
expect(smartMatch("run", [null, undefined, "Run cell"])).toBe(true);
|
|
37
|
+
expect(smartMatch("run", [null, undefined])).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("smartMatchFilter", () => {
|
|
42
|
+
it("returns 1 for value match", () => {
|
|
43
|
+
expect(smartMatchFilter("Run cell", "run")).toBe(1);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("returns 0 for no match", () => {
|
|
47
|
+
expect(smartMatchFilter("Run cell", "xyz")).toBe(0);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("returns 0.8 for keyword-only match", () => {
|
|
51
|
+
expect(smartMatchFilter("Run", "execute", ["execute", "start"])).toBe(0.8);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("returns 1 when value matches even if keywords also match", () => {
|
|
55
|
+
expect(smartMatchFilter("Run", "run", ["execute", "start"])).toBe(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("does not match without relevant keywords", () => {
|
|
59
|
+
expect(smartMatchFilter("Run", "preferences", ["execute"])).toBe(0);
|
|
60
|
+
});
|
|
61
|
+
});
|
package/src/utils/filenames.ts
CHANGED
|
@@ -15,6 +15,9 @@ export const Filenames = {
|
|
|
15
15
|
toPY: (filename: string): string => {
|
|
16
16
|
return Filenames.replace(filename, "py");
|
|
17
17
|
},
|
|
18
|
+
toIPYNB: (filename: string): string => {
|
|
19
|
+
return Filenames.replace(filename, "ipynb");
|
|
20
|
+
},
|
|
18
21
|
withoutExtension: (filename: string): string => {
|
|
19
22
|
// Just remove the last extension
|
|
20
23
|
const parts = filename.split(".");
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Split a string into lowercase words (letters/digits only).
|
|
5
|
+
*/
|
|
6
|
+
function words(s: string): string[] {
|
|
7
|
+
return s.toLowerCase().match(/[\da-z]+/g) || [];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns true when every word in `needle` is a prefix of at least one word
|
|
12
|
+
* in one of the `haystacks`.
|
|
13
|
+
*
|
|
14
|
+
* Examples:
|
|
15
|
+
* smartMatch("run", "Run cell") // true – "run" prefixes "run"
|
|
16
|
+
* smartMatch("exe", ["Run", "execute start"]) // true – "exe" prefixes "execute"
|
|
17
|
+
* smartMatch("xyz", "Run cell") // false
|
|
18
|
+
*/
|
|
19
|
+
export function smartMatch(
|
|
20
|
+
needle: string,
|
|
21
|
+
haystackOrHaystacks: string | (string | null | undefined)[],
|
|
22
|
+
): boolean {
|
|
23
|
+
const needleWords = words(needle);
|
|
24
|
+
if (needleWords.length === 0) {
|
|
25
|
+
return true; // empty search matches everything
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const haystacks = Array.isArray(haystackOrHaystacks)
|
|
29
|
+
? haystackOrHaystacks
|
|
30
|
+
: [haystackOrHaystacks];
|
|
31
|
+
|
|
32
|
+
// Collect all words from all haystacks
|
|
33
|
+
const haystackWords: string[] = [];
|
|
34
|
+
for (const h of haystacks) {
|
|
35
|
+
if (h) {
|
|
36
|
+
haystackWords.push(...words(h));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Every needle word must be a prefix of at least one haystack word
|
|
41
|
+
return needleWords.every((nw) => {
|
|
42
|
+
return haystackWords.some((hw) => hw.startsWith(nw));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* cmdk-compatible filter function.
|
|
48
|
+
* Returns 1 for a value match, 0.8 for a keyword-only match, 0 for no match.
|
|
49
|
+
*/
|
|
50
|
+
export function smartMatchFilter(
|
|
51
|
+
value: string,
|
|
52
|
+
search: string,
|
|
53
|
+
keywords?: string[],
|
|
54
|
+
): number {
|
|
55
|
+
if (smartMatch(search, value)) {
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
if (keywords && smartMatch(search, keywords)) {
|
|
59
|
+
return 0.8;
|
|
60
|
+
}
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
package/dist/dist-BAeGo2rp.js
DELETED
package/dist/dist-BqwCMSEa.js
DELETED
package/dist/dist-Bum8FwTO.js
DELETED
package/dist/dist-C0YiOwt_.js
DELETED
package/dist/dist-C2uPv4iU.js
DELETED
package/dist/dist-C5hOLsJN.js
DELETED
package/dist/dist-C9NIAKMs.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./dist-BuapEdlD.js";
|
|
2
|
-
import "./dist-Ch_JuCvc.js";
|
|
3
|
-
import "./dist-BBcqvpvP.js";
|
|
4
|
-
import "./dist-CsqiXw7J.js";
|
|
5
|
-
import { i as jinjaLanguage, n as jinja, r as jinjaCompletionSource, t as closePercentBrace } from "./dist-I8MQW60_.js";
|
|
6
|
-
export {
|
|
7
|
-
jinja
|
|
8
|
-
};
|
package/dist/dist-CCrzTtvk.js
DELETED
package/dist/dist-CFS9i1rS.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./dist-BuapEdlD.js";
|
|
2
|
-
import "./dist-Ch_JuCvc.js";
|
|
3
|
-
import "./dist-BBcqvpvP.js";
|
|
4
|
-
import "./dist-CsqiXw7J.js";
|
|
5
|
-
import { i as liquidLanguage, n as liquid, r as liquidCompletionSource, t as closePercentBrace } from "./dist-BLThQiU4.js";
|
|
6
|
-
export {
|
|
7
|
-
liquid
|
|
8
|
-
};
|
package/dist/dist-CyHZuhPH.js
DELETED
package/dist/dist-CzcjWdIk.js
DELETED
package/dist/dist-DaYyUSNC.js
DELETED
package/dist/dist-DpDcJYNh.js
DELETED