decocms 2.280.0 → 2.281.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/dist/client/assets/{AlertCircle-Dv4ZIM5J.js → AlertCircle-BxQaCgH5.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-BvT4bMLP.js → ArrowNarrowLeft-DvPafpou.js} +1 -1
- package/dist/client/assets/{CheckCircle-DeGJG8Ey.js → CheckCircle-BXxeGcqo.js} +1 -1
- package/dist/client/assets/{ChevronDown-DA_i6htU.js → ChevronDown-CrxTrcXn.js} +1 -1
- package/dist/client/assets/{ChevronRight-CPnYdMqx.js → ChevronRight-fzPkai24.js} +1 -1
- package/dist/client/assets/{ChevronUp-BAjyIVOE.js → ChevronUp-BbLFuIn6.js} +1 -1
- package/dist/client/assets/{Container-D86p6vhP.js → Container-BvBvuKbb.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Cfxvdz-p.js → LinkExternal01-DbT6EESI.js} +1 -1
- package/dist/client/assets/{Lock01-DMzDPwhT.js → Lock01-CaWJFuU-.js} +1 -1
- package/dist/client/assets/{Palette-DVhkaDgv.js → Palette-C1a--nf0.js} +1 -1
- package/dist/client/assets/{Play-Dx7-OOlg.js → Play-CY93msn5.js} +1 -1
- package/dist/client/assets/{Plus-D9-fqNSD.js → Plus-BZVr8DYe.js} +1 -1
- package/dist/client/assets/{SearchMd-DNA-TN_H.js → SearchMd-C9eIKicL.js} +1 -1
- package/dist/client/assets/{Settings02-DQjDcLoY.js → Settings02-B7X_pyal.js} +1 -1
- package/dist/client/assets/{Star01-CaUtmy-K.js → Star01-D0sHRGJP.js} +1 -1
- package/dist/client/assets/{Sun-CEZa3eLS.js → Sun-D9auuaNU.js} +1 -1
- package/dist/client/assets/{Tool01-B1xrcBi5.js → Tool01-CrowYf0-.js} +1 -1
- package/dist/client/assets/{Trash01-B4DTIo_P.js → Trash01-DS4oT9KI.js} +1 -1
- package/dist/client/assets/{Upload01-DH1j0KZc.js → Upload01-CNVpf4nT.js} +1 -1
- package/dist/client/assets/{User01-BZLj0_M8.js → User01-BFQVnPPl.js} +1 -1
- package/dist/client/assets/{Users03-DrJ8OfaH.js → Users03-eD4p_y7L.js} +1 -1
- package/dist/client/assets/{X-DoL-OQpW.js → X-C8EYjrnS.js} +1 -1
- package/dist/client/assets/{XCircle-BEVX_MSl.js → XCircle-CCZmjsk3.js} +1 -1
- package/dist/client/assets/{Zap-CAlzQ_SF.js → Zap-Cf5ECRwQ.js} +1 -1
- package/dist/client/assets/{ZapSquare-6X_ovY4u.js → ZapSquare-ltoYi26-.js} +1 -1
- package/dist/client/assets/{accordion-DPKwR5jf.js → accordion-KwUoYs08.js} +1 -1
- package/dist/client/assets/{agent-icon-E67drceM.js → agent-icon-oD9g1mwD.js} +1 -1
- package/dist/client/assets/{agents-list-Ch7lWVOr.js → agents-list-CrpnpHtt.js} +1 -1
- package/dist/client/assets/ai-providers-Ev953-TG.js +1 -0
- package/dist/client/assets/{alert-dialog-82nIWhf3.js → alert-dialog-EHv7SCLp.js} +1 -1
- package/dist/client/assets/{auth-catchall-BJdcQwN-.js → auth-catchall-D7l2F51O.js} +1 -1
- package/dist/client/assets/{automation-list-row-DXJDNS03.js → automation-list-row-DUYCHEU2.js} +1 -1
- package/dist/client/assets/{automations-CkAigK39.js → automations-CPz-FBJP.js} +1 -1
- package/dist/client/assets/{avatar-CKWhFcDc.js → avatar-DVFg5UBS.js} +1 -1
- package/dist/client/assets/{badge-DPuCicf3.js → badge-CEpuOO6h.js} +1 -1
- package/dist/client/assets/{brand-context-xEuKSfj0.js → brand-context-w6gl12tg.js} +1 -1
- package/dist/client/assets/{card-BJoLtmz9.js → card-CngHfm2n.js} +1 -1
- package/dist/client/assets/{chat-context-Bf3aWPzj.js → chat-context-Be9aaK6U.js} +1 -1
- package/dist/client/assets/{checkbox-C12E3_oq.js → checkbox-DCZkLdlq.js} +1 -1
- package/dist/client/assets/{collection-detail-ByVwt639.js → collection-detail-CYHWDRuK.js} +1 -1
- package/dist/client/assets/{collection-display-button-CXXhefCT.js → collection-display-button-5JFAZW6R.js} +1 -1
- package/dist/client/assets/{collection-search-tscZfmSz.js → collection-search-DOIVhdIq.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-C82FjZ_i.js → collection-table-wrapper-Bw7EUBa7.js} +1 -1
- package/dist/client/assets/{collection-tabs-XtEbMyOP.js → collection-tabs-xS34vPZX.js} +1 -1
- package/dist/client/assets/{collections-8sPPrJ7A.js → collections-DjXpvr0c.js} +1 -1
- package/dist/client/assets/{command-C8CTcwNt.js → command-DJOBLkaO.js} +1 -1
- package/dist/client/assets/{connection-card-Dfd5kF4A.js → connection-card-7nEv8xwt.js} +1 -1
- package/dist/client/assets/{connection-detail-LgljwVBZ.js → connection-detail-8OghRNyX.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-D1CgFjH6.js → connection-form-helpers-CiO0nSGf.js} +1 -1
- package/dist/client/assets/{connections-welzjCFH.js → connections-CzFYE0ru.js} +1 -1
- package/dist/client/assets/{constants-CgzsWzve.js → constants-BUXCK41y.js} +1 -1
- package/dist/client/assets/{constants-DlB9FruN.js → constants-Duv9JUYf.js} +1 -1
- package/dist/client/assets/{dialog-D3TqImE0.js → dialog-D16krwkE.js} +1 -1
- package/dist/client/assets/{drawer-1xwox4c6.js → drawer-BX0Q18X0.js} +1 -1
- package/dist/client/assets/{dropdown-menu-ccbFc3oF.js → dropdown-menu-CjdH3cnv.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-C7MWhlg7.js → dynamic-plugin-layout-LnDvBseE.js} +1 -1
- package/dist/client/assets/{empty-state-C1zz-mei.js → empty-state-CkAWq1uC.js} +1 -1
- package/dist/client/assets/{empty-state-BuT1lOPL.js → empty-state-HrQlq1nn.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Aua_YhKg.js → extract-connection-data-9XD6WNvd.js} +1 -1
- package/dist/client/assets/{features-CXUvkC78.js → features-CYVl713Z.js} +1 -1
- package/dist/client/assets/{form-ruWBs7d7.js → form-qTCrGaqv.js} +1 -1
- package/dist/client/assets/{general-DH_bFCOl.js → general-B2a79noc.js} +1 -1
- package/dist/client/assets/{index-DrsCmq1f.js → index-BBombKt7.js} +1 -1
- package/dist/client/assets/{index-DJgqpEYW.js → index-BoejYp30.js} +2 -2
- package/dist/client/assets/{index-BV6L1SjJ.js → index-BpigqXCX.js} +1 -1
- package/dist/client/assets/{index-CQ8ZZoPX.js → index-C_XD7MWY.js} +1 -1
- package/dist/client/assets/{index-CCmiT65y.js → index-DAl9JCz9.js} +1 -1
- package/dist/client/assets/{index-BEoI9ZVb.js → index-DP8VKV0C.js} +1 -1
- package/dist/client/assets/{index-z8VezSz0.js → index-DVTmEE7D.js} +1 -1
- package/dist/client/assets/{index-DumcCt6F.js → index-D_-c2np7.js} +1 -1
- package/dist/client/assets/{index-AHroOw7q.js → index-YYrDBPo1.js} +1 -1
- package/dist/client/assets/{index-CTmUD6-Y.js → index-e34ed6Pn.js} +4 -4
- package/dist/client/assets/{infiniteQueryObserver-DH4hUCgR.js → infiniteQueryObserver-BLfYLX2L.js} +1 -1
- package/dist/client/assets/{input-DV5eim50.js → input-hIdCxVlM.js} +1 -1
- package/dist/client/assets/{integration-icon-D2tCV60I.js → integration-icon-bKnN2waE.js} +1 -1
- package/dist/client/assets/{label-C86GM8X1.js → label-DJdRi88u.js} +1 -1
- package/dist/client/assets/{layout-DxCigiwD.js → layout-BIHsvZTQ.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-CCGjmni2.js → lean-canvas-recruit-modal-DPZgXrE8.js} +1 -1
- package/dist/client/assets/{login-DprsK4_L.js → login-DB8h2HWK.js} +1 -1
- package/dist/client/assets/{members-B-VFLfzJ.js → members-0FgWuNC0.js} +1 -1
- package/dist/client/assets/{monaco-editor-R56ulXRY.js → monaco-editor-CHhwvtI4.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row--PsDRgYi.js → monitoring-stats-row-C6LTe68M.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DDk9IcKl.js → oauth-callback-ai-provider-C_-yG4iT.js} +1 -1
- package/dist/client/assets/{oauth-callback-Ca5_CCq3.js → oauth-callback-k8xXYSid.js} +1 -1
- package/dist/client/assets/{onboarding-DerxM89t.js → onboarding-B5xnY3QT.js} +1 -1
- package/dist/client/assets/{org-layout-DIERSToF.js → org-layout-6EKPoipE.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-ClNRZqNK.js → org-plugin-layout-DYZIRSwp.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-D0vL52dh.js → plugin-empty-state-BbybNTeM.js} +1 -1
- package/dist/client/assets/{plugin-header-DmExVElz.js → plugin-header-B2RXVpJh.js} +1 -1
- package/dist/client/assets/{plugin-layout-DW3szgLc.js → plugin-layout-DHLvO9Dh.js} +1 -1
- package/dist/client/assets/{popover-MsdpfhQu.js → popover-C90GtPgC.js} +1 -1
- package/dist/client/assets/{profile-G3V9Se8H.js → profile-DNZ3qnav.js} +1 -1
- package/dist/client/assets/{project-app-view-8soha8U5.js → project-app-view-PfZah6FJ.js} +1 -1
- package/dist/client/assets/registry-C8wiys5D.js +2 -0
- package/dist/client/assets/{registry-layout-DmdT-OpW.js → registry-layout-BGtCYpl3.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CExQRzBC.js → required-auth-layout-CcZu2eiU.js} +1 -1
- package/dist/client/assets/{reset-password-CKscqHTM.js → reset-password-Baelzqwt.js} +1 -1
- package/dist/client/assets/{scroll-area-Co4wJj7O.js → scroll-area-CPiePQfy.js} +1 -1
- package/dist/client/assets/{search-input-C1TJuPFM.js → search-input-CqO18JkA.js} +1 -1
- package/dist/client/assets/{select-pAgHYIrL.js → select-CCLwskrC.js} +1 -1
- package/dist/client/assets/{select-model-FUOpAZDM.js → select-model-DRcCvlGm.js} +1 -1
- package/dist/client/assets/{settings-layout-DQBzl0lu.js → settings-layout-BGlOTmCZ.js} +1 -1
- package/dist/client/assets/{shell-layout-DUNitdZU.js → shell-layout-BYFHDWBl.js} +1 -1
- package/dist/client/assets/{skeleton-qER9eMeG.js → skeleton-DkloI2z9.js} +1 -1
- package/dist/client/assets/{sso-CJiIyGby.js → sso-Dqmth7wr.js} +1 -1
- package/dist/client/assets/{store-rkPIhDm8.js → store-CYvqBBPo.js} +1 -1
- package/dist/client/assets/store-registry-B7rvRMWn.js +2 -0
- package/dist/client/assets/{switch-D5-PzV-X.js → switch-SQOxx_BP.js} +1 -1
- package/dist/client/assets/{table-DvXCcwv1.js → table-Biv5Zl2S.js} +1 -1
- package/dist/client/assets/{tabs-Ce-3s0xL.js → tabs-BE5QvfFm.js} +1 -1
- package/dist/client/assets/{task-status-CffQzU_t.js → task-status-BahLevpJ.js} +1 -1
- package/dist/client/assets/{textarea-BVTjXq38.js → textarea-O7MTYJio.js} +1 -1
- package/dist/client/assets/{toggle-group-gsh8C-OR.js → toggle-group-BBXD8yQY.js} +1 -1
- package/dist/client/assets/{tools-list-PtfMhobA.js → tools-list-jfk3mcX8.js} +1 -1
- package/dist/client/assets/{types-BvKkBpVu.js → types-hhFb4L42.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B5sNJvkO.js → use-ai-providers-DKOqE3I1.js} +1 -1
- package/dist/client/assets/{use-collections-BrU9UZ67.js → use-collections-CtLjZXHp.js} +1 -1
- package/dist/client/assets/{use-connection-8il0FBHR.js → use-connection-B36YYtyz.js} +1 -1
- package/dist/client/assets/{use-copy-CyDx0Roq.js → use-copy-ISngWsJv.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DVarqFbA.js → use-create-virtual-mcp-P3ThMp2c.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-ZWKgln1k.js → use-decopilot-events-CqlYsGHg.js} +1 -1
- package/dist/client/assets/{use-delete-connection-D0QU8RrP.js → use-delete-connection-dweYZdv3.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BxyvVOYa.js → use-infinite-scroll-D5138Ysw.js} +1 -1
- package/dist/client/assets/{use-list-state-DJ-Ih_V8.js → use-list-state-BxqDajfT.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Dtq2tMkx.js → use-mcp-tools-Rbcl8RAc.js} +1 -1
- package/dist/client/assets/{use-members-DJxwunXF.js → use-members-Cpr8Lly2.js} +1 -1
- package/dist/client/assets/{use-mobile-BsrW-Uvz.js → use-mobile-CjtYs6gm.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-IOD6ymJx.js → use-navigate-to-agent-0m1reJMx.js} +1 -1
- package/dist/client/assets/{use-org-sso-MYxHdY37.js → use-org-sso-DoUQ063I.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DgEflTxA.js → use-organization-settings-j9ISdWd3.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DOXnVkDT.js → use-registry-connections-FiU8g9bc.js} +1 -1
- package/dist/client/assets/{use-status-sounds-Bw0QWLxv.js → use-status-sounds-g-sVxPRo.js} +1 -1
- package/dist/client/assets/{use-tasks-OBM9Y7nP.js → use-tasks-CBiZHQE7.js} +1 -1
- package/dist/client/assets/{use-view-mode-BGx43I5y.js → use-view-mode-DpJ_I2Mv.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-zjP22P87.js → use-virtual-mcp-Byg6Gkle.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DwiWoB3G.js +1 -0
- package/dist/client/assets/{user-Ct2oIzgq.js → user-CehMCPUl.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DG-ttgGl.js → view-mode-toggle-Oi2Jp3cj.js} +1 -1
- package/dist/client/assets/{workflow-xyFm_Ta1.js → workflow-Go__bVq7.js} +1 -1
- package/dist/client/assets/workflow-detail-C5Vcc_6S.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +460 -430
- package/dist/server/node_modules/pg-pool/LICENSE +21 -0
- package/dist/server/node_modules/pg-pool/README.md +357 -0
- package/dist/server/node_modules/pg-pool/esm/index.mjs +5 -0
- package/dist/server/node_modules/pg-pool/index.js +517 -0
- package/dist/server/node_modules/pg-pool/package.json +51 -0
- package/dist/server/node_modules/slice-ansi/index.d.ts +19 -0
- package/dist/server/node_modules/slice-ansi/index.js +260 -0
- package/dist/server/node_modules/{get-east-asian-width → slice-ansi}/license +1 -0
- package/dist/server/node_modules/slice-ansi/package.json +59 -0
- package/dist/server/node_modules/slice-ansi/readme.md +54 -0
- package/dist/server/node_modules/slice-ansi/tokenize-ansi.js +752 -0
- package/dist/server/server.js +380 -350
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-nM9qYzBZ.js +0 -1
- package/dist/client/assets/registry-1MdxVVj5.js +0 -2
- package/dist/client/assets/store-registry-C3XskpEA.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BE9sdfbg.js +0 -1
- package/dist/client/assets/workflow-detail-BvQnVA1D.js +0 -1
- package/dist/server/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/dist/server/node_modules/get-east-asian-width/index.js +0 -30
- package/dist/server/node_modules/get-east-asian-width/lookup-data.js +0 -18
- package/dist/server/node_modules/get-east-asian-width/lookup.js +0 -135
- package/dist/server/node_modules/get-east-asian-width/package.json +0 -71
- package/dist/server/node_modules/get-east-asian-width/readme.md +0 -65
- package/dist/server/node_modules/get-east-asian-width/utilities.js +0 -24
- package/dist/server/node_modules/is-unicode-supported/index.d.ts +0 -12
- package/dist/server/node_modules/is-unicode-supported/index.js +0 -21
- package/dist/server/node_modules/is-unicode-supported/license +0 -9
- package/dist/server/node_modules/is-unicode-supported/package.json +0 -47
- package/dist/server/node_modules/is-unicode-supported/readme.md +0 -35
- package/dist/server/node_modules/restore-cursor/index.d.ts +0 -11
- package/dist/server/node_modules/restore-cursor/index.js +0 -11
- package/dist/server/node_modules/restore-cursor/license +0 -9
- package/dist/server/node_modules/restore-cursor/package.json +0 -55
- package/dist/server/node_modules/restore-cursor/readme.md +0 -31
- package/dist/server/node_modules/string-width/index.d.ts +0 -39
- package/dist/server/node_modules/string-width/index.js +0 -82
- package/dist/server/node_modules/string-width/license +0 -9
- package/dist/server/node_modules/string-width/package.json +0 -64
- package/dist/server/node_modules/string-width/readme.md +0 -66
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import tokenizeAnsi from './tokenize-ansi.js';
|
|
2
|
+
|
|
3
|
+
function applySgrFragments(activeStyles, fragments) {
|
|
4
|
+
for (const fragment of fragments) {
|
|
5
|
+
switch (fragment.type) {
|
|
6
|
+
case 'reset': {
|
|
7
|
+
activeStyles.clear();
|
|
8
|
+
break;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
case 'end': {
|
|
12
|
+
activeStyles.delete(fragment.endCode);
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
case 'start': {
|
|
17
|
+
activeStyles.delete(fragment.endCode);
|
|
18
|
+
activeStyles.set(fragment.endCode, fragment.code);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
default: {
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return activeStyles;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function undoAnsiCodes(activeStyles) {
|
|
32
|
+
return [...activeStyles.keys()].reverse().join('');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function closeHyperlink(hyperlinkToken) {
|
|
36
|
+
return `${hyperlinkToken.closePrefix}${hyperlinkToken.terminator}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function shouldIncludeSgrAfterEnd(token, activeStyles) {
|
|
40
|
+
let hasStartFragment = false;
|
|
41
|
+
let hasClosingEffect = false;
|
|
42
|
+
|
|
43
|
+
for (const fragment of token.fragments) {
|
|
44
|
+
if (fragment.type === 'start') {
|
|
45
|
+
hasStartFragment = true;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (fragment.type === 'reset' && activeStyles.size > 0) {
|
|
50
|
+
hasClosingEffect = true;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (fragment.type === 'end' && activeStyles.has(fragment.endCode)) {
|
|
55
|
+
hasClosingEffect = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return hasClosingEffect && !hasStartFragment;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function applySgrToken({token, isPastEnd, activeStyles, returnValue, include, activeHyperlink, position}) {
|
|
63
|
+
if (isPastEnd && !shouldIncludeSgrAfterEnd(token, activeStyles)) {
|
|
64
|
+
return {
|
|
65
|
+
activeStyles,
|
|
66
|
+
activeHyperlink,
|
|
67
|
+
position,
|
|
68
|
+
returnValue,
|
|
69
|
+
include,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
activeStyles = applySgrFragments(activeStyles, token.fragments);
|
|
74
|
+
if (include) {
|
|
75
|
+
returnValue += token.code;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
activeStyles,
|
|
80
|
+
activeHyperlink,
|
|
81
|
+
position,
|
|
82
|
+
returnValue,
|
|
83
|
+
include,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function applyHyperlinkToken({token, isPastEnd, activeStyles, activeHyperlink, position, returnValue, include}) {
|
|
88
|
+
if (
|
|
89
|
+
isPastEnd
|
|
90
|
+
&& (
|
|
91
|
+
token.action !== 'close'
|
|
92
|
+
|| !activeHyperlink
|
|
93
|
+
)
|
|
94
|
+
) {
|
|
95
|
+
return {
|
|
96
|
+
activeStyles,
|
|
97
|
+
activeHyperlink,
|
|
98
|
+
position,
|
|
99
|
+
returnValue,
|
|
100
|
+
include,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (token.action === 'open') {
|
|
105
|
+
activeHyperlink = token;
|
|
106
|
+
} else if (token.action === 'close') {
|
|
107
|
+
activeHyperlink = undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (include) {
|
|
111
|
+
returnValue += token.code;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
activeStyles,
|
|
116
|
+
activeHyperlink,
|
|
117
|
+
position,
|
|
118
|
+
returnValue,
|
|
119
|
+
include,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function applyControlToken({token, isPastEnd, activeStyles, activeHyperlink, position, returnValue, include}) {
|
|
124
|
+
if (!isPastEnd && include) {
|
|
125
|
+
returnValue += token.code;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
activeStyles,
|
|
130
|
+
activeHyperlink,
|
|
131
|
+
position,
|
|
132
|
+
returnValue,
|
|
133
|
+
include,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function applyCharacterToken({token, start, activeStyles, activeHyperlink, position, returnValue, include}) {
|
|
138
|
+
if (
|
|
139
|
+
!include
|
|
140
|
+
&& position >= start
|
|
141
|
+
&& !token.isGraphemeContinuation
|
|
142
|
+
) {
|
|
143
|
+
include = true;
|
|
144
|
+
returnValue = [...activeStyles.values()].join('');
|
|
145
|
+
if (activeHyperlink) {
|
|
146
|
+
returnValue += activeHyperlink.code;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (include) {
|
|
151
|
+
returnValue += token.value;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
position += token.visibleWidth;
|
|
155
|
+
return {
|
|
156
|
+
activeStyles,
|
|
157
|
+
activeHyperlink,
|
|
158
|
+
position,
|
|
159
|
+
returnValue,
|
|
160
|
+
include,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const tokenHandlers = {
|
|
165
|
+
sgr: applySgrToken,
|
|
166
|
+
hyperlink: applyHyperlinkToken,
|
|
167
|
+
control: applyControlToken,
|
|
168
|
+
character: applyCharacterToken,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
function applyToken(parameters) {
|
|
172
|
+
const tokenHandler = tokenHandlers[parameters.token.type];
|
|
173
|
+
if (!tokenHandler) {
|
|
174
|
+
const {
|
|
175
|
+
activeStyles,
|
|
176
|
+
activeHyperlink,
|
|
177
|
+
position,
|
|
178
|
+
returnValue,
|
|
179
|
+
include,
|
|
180
|
+
} = parameters;
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
activeStyles,
|
|
184
|
+
activeHyperlink,
|
|
185
|
+
position,
|
|
186
|
+
returnValue,
|
|
187
|
+
include,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return tokenHandler(parameters);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function createHasContinuationAheadMap(tokens) {
|
|
195
|
+
const hasContinuationAhead = Array.from({length: tokens.length}, () => false);
|
|
196
|
+
let nextCharacterIsContinuation = false;
|
|
197
|
+
|
|
198
|
+
for (let tokenIndex = tokens.length - 1; tokenIndex >= 0; tokenIndex--) {
|
|
199
|
+
const token = tokens[tokenIndex];
|
|
200
|
+
hasContinuationAhead[tokenIndex] = nextCharacterIsContinuation;
|
|
201
|
+
if (token.type === 'character') {
|
|
202
|
+
nextCharacterIsContinuation = Boolean(token.isGraphemeContinuation);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return hasContinuationAhead;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export default function sliceAnsi(string, start, end) {
|
|
210
|
+
const tokens = tokenizeAnsi(string, {endCharacter: end});
|
|
211
|
+
const hasContinuationAhead = createHasContinuationAheadMap(tokens);
|
|
212
|
+
let activeStyles = new Map();
|
|
213
|
+
let activeHyperlink;
|
|
214
|
+
let position = 0;
|
|
215
|
+
let returnValue = '';
|
|
216
|
+
let include = false;
|
|
217
|
+
|
|
218
|
+
for (const [tokenIndex, token] of tokens.entries()) {
|
|
219
|
+
let isPastEnd = end !== undefined && position >= end;
|
|
220
|
+
if (
|
|
221
|
+
isPastEnd
|
|
222
|
+
&& token.type !== 'character'
|
|
223
|
+
&& hasContinuationAhead[tokenIndex]
|
|
224
|
+
) {
|
|
225
|
+
isPastEnd = false;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (
|
|
229
|
+
isPastEnd
|
|
230
|
+
&& token.type === 'character'
|
|
231
|
+
&& !token.isGraphemeContinuation
|
|
232
|
+
) {
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
({activeStyles, activeHyperlink, position, returnValue, include} = applyToken({
|
|
237
|
+
token,
|
|
238
|
+
isPastEnd,
|
|
239
|
+
start,
|
|
240
|
+
activeStyles,
|
|
241
|
+
activeHyperlink,
|
|
242
|
+
position,
|
|
243
|
+
returnValue,
|
|
244
|
+
include,
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (!include) {
|
|
249
|
+
return '';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (activeHyperlink) {
|
|
253
|
+
returnValue += closeHyperlink(activeHyperlink);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Disable active codes at the end
|
|
257
|
+
returnValue += undoAnsiCodes(activeStyles);
|
|
258
|
+
|
|
259
|
+
return returnValue;
|
|
260
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
+
Copyright (c) DC <threedeecee@gmail.com>
|
|
3
4
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slice-ansi",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "Slice a string with ANSI escape codes",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "chalk/slice-ansi",
|
|
7
|
+
"funding": "https://github.com/chalk/slice-ansi?sponsor=1",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
},
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "xo && ava && tsc --lib esnext index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"tokenize-ansi.js",
|
|
23
|
+
"index.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"slice",
|
|
27
|
+
"string",
|
|
28
|
+
"ansi",
|
|
29
|
+
"styles",
|
|
30
|
+
"color",
|
|
31
|
+
"colour",
|
|
32
|
+
"colors",
|
|
33
|
+
"terminal",
|
|
34
|
+
"console",
|
|
35
|
+
"cli",
|
|
36
|
+
"tty",
|
|
37
|
+
"escape",
|
|
38
|
+
"formatting",
|
|
39
|
+
"rgb",
|
|
40
|
+
"256",
|
|
41
|
+
"shell",
|
|
42
|
+
"xterm",
|
|
43
|
+
"log",
|
|
44
|
+
"logging",
|
|
45
|
+
"command-line",
|
|
46
|
+
"text"
|
|
47
|
+
],
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"ansi-styles": "^6.2.3",
|
|
50
|
+
"is-fullwidth-code-point": "^5.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"ava": "^6.4.1",
|
|
54
|
+
"chalk": "^5.6.2",
|
|
55
|
+
"random-item": "^4.0.1",
|
|
56
|
+
"strip-ansi": "^7.1.2",
|
|
57
|
+
"xo": "^1.2.3"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# slice-ansi [](https://github.com/xojs/xo)
|
|
2
|
+
|
|
3
|
+
> Slice a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install slice-ansi
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
import sliceAnsi from 'slice-ansi';
|
|
16
|
+
|
|
17
|
+
const string = 'The quick brown ' + chalk.red('fox jumped over ') +
|
|
18
|
+
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
|
|
19
|
+
|
|
20
|
+
console.log(sliceAnsi(string, 20, 30));
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### sliceAnsi(string, startSlice, endSlice?)
|
|
26
|
+
|
|
27
|
+
#### string
|
|
28
|
+
|
|
29
|
+
Type: `string`
|
|
30
|
+
|
|
31
|
+
String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).
|
|
32
|
+
|
|
33
|
+
#### startSlice
|
|
34
|
+
|
|
35
|
+
Type: `number`
|
|
36
|
+
|
|
37
|
+
Zero-based visible-column index at which to start the slice. Grapheme clusters (for example, emoji sequences and combining marks) are kept intact.
|
|
38
|
+
|
|
39
|
+
#### endSlice
|
|
40
|
+
|
|
41
|
+
Type: `number`
|
|
42
|
+
|
|
43
|
+
Zero-based visible-column index at which to end the slice.
|
|
44
|
+
|
|
45
|
+
## Related
|
|
46
|
+
|
|
47
|
+
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
|
48
|
+
- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
|
|
49
|
+
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
|
50
|
+
|
|
51
|
+
## Maintainers
|
|
52
|
+
|
|
53
|
+
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
54
|
+
- [Josh Junon](https://github.com/qix-)
|