@shadow-garden/bapbong-ui 0.3.0 → 0.4.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/index.cjs +14 -4
- package/dist/index.js +14 -4
- package/dist/lib/find.d.ts +1 -1
- package/dist/lib/find.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -868,8 +868,11 @@ var STYLE4 = `
|
|
|
868
868
|
.bb-find-btn:hover:not(:disabled){background:var(--bb-ui-hover,#f1efe8)}
|
|
869
869
|
.bb-find-btn:disabled{opacity:.4;cursor:default}
|
|
870
870
|
`;
|
|
871
|
-
function createFindDialog(
|
|
871
|
+
function createFindDialog(handle, options = {}) {
|
|
872
872
|
injectStyle("bb-ui-find-styles", STYLE4);
|
|
873
|
+
const find = typeof handle === "function" ? new Proxy({}, {
|
|
874
|
+
get: (_t, prop) => handle()[prop]
|
|
875
|
+
}) : handle;
|
|
873
876
|
const labels = { ...DEFAULT_LABELS2, ...options.labels ?? {} };
|
|
874
877
|
const root = document.createElement("div");
|
|
875
878
|
root.className = "bb-find";
|
|
@@ -916,8 +919,14 @@ function createFindDialog(find, options = {}) {
|
|
|
916
919
|
});
|
|
917
920
|
prev.addEventListener("click", () => find.prev());
|
|
918
921
|
next.addEventListener("click", () => find.next());
|
|
919
|
-
replaceOne.addEventListener(
|
|
920
|
-
|
|
922
|
+
replaceOne.addEventListener(
|
|
923
|
+
"click",
|
|
924
|
+
() => find.replaceCurrent(replaceInput.value)
|
|
925
|
+
);
|
|
926
|
+
replaceAll.addEventListener(
|
|
927
|
+
"click",
|
|
928
|
+
() => find.replaceAll(replaceInput.value)
|
|
929
|
+
);
|
|
921
930
|
const off = find.onState((s) => {
|
|
922
931
|
count.textContent = s.count ? `${s.active}/${s.count}` : "0";
|
|
923
932
|
for (const b of matchButtons) b.disabled = s.count === 0;
|
|
@@ -945,7 +954,8 @@ function createFindDialog(find, options = {}) {
|
|
|
945
954
|
openPanel();
|
|
946
955
|
}
|
|
947
956
|
};
|
|
948
|
-
if (options.shortcut !== false)
|
|
957
|
+
if (options.shortcut !== false)
|
|
958
|
+
document.addEventListener("keydown", onHotkey);
|
|
949
959
|
return {
|
|
950
960
|
open: openPanel,
|
|
951
961
|
close() {
|
package/dist/index.js
CHANGED
|
@@ -832,8 +832,11 @@ var STYLE4 = `
|
|
|
832
832
|
.bb-find-btn:hover:not(:disabled){background:var(--bb-ui-hover,#f1efe8)}
|
|
833
833
|
.bb-find-btn:disabled{opacity:.4;cursor:default}
|
|
834
834
|
`;
|
|
835
|
-
function createFindDialog(
|
|
835
|
+
function createFindDialog(handle, options = {}) {
|
|
836
836
|
injectStyle("bb-ui-find-styles", STYLE4);
|
|
837
|
+
const find = typeof handle === "function" ? new Proxy({}, {
|
|
838
|
+
get: (_t, prop) => handle()[prop]
|
|
839
|
+
}) : handle;
|
|
837
840
|
const labels = { ...DEFAULT_LABELS2, ...options.labels ?? {} };
|
|
838
841
|
const root = document.createElement("div");
|
|
839
842
|
root.className = "bb-find";
|
|
@@ -880,8 +883,14 @@ function createFindDialog(find, options = {}) {
|
|
|
880
883
|
});
|
|
881
884
|
prev.addEventListener("click", () => find.prev());
|
|
882
885
|
next.addEventListener("click", () => find.next());
|
|
883
|
-
replaceOne.addEventListener(
|
|
884
|
-
|
|
886
|
+
replaceOne.addEventListener(
|
|
887
|
+
"click",
|
|
888
|
+
() => find.replaceCurrent(replaceInput.value)
|
|
889
|
+
);
|
|
890
|
+
replaceAll.addEventListener(
|
|
891
|
+
"click",
|
|
892
|
+
() => find.replaceAll(replaceInput.value)
|
|
893
|
+
);
|
|
885
894
|
const off = find.onState((s) => {
|
|
886
895
|
count.textContent = s.count ? `${s.active}/${s.count}` : "0";
|
|
887
896
|
for (const b of matchButtons) b.disabled = s.count === 0;
|
|
@@ -909,7 +918,8 @@ function createFindDialog(find, options = {}) {
|
|
|
909
918
|
openPanel();
|
|
910
919
|
}
|
|
911
920
|
};
|
|
912
|
-
if (options.shortcut !== false)
|
|
921
|
+
if (options.shortcut !== false)
|
|
922
|
+
document.addEventListener("keydown", onHotkey);
|
|
913
923
|
return {
|
|
914
924
|
open: openPanel,
|
|
915
925
|
close() {
|
package/dist/lib/find.d.ts
CHANGED
|
@@ -49,5 +49,5 @@ export interface FindDialogHandle {
|
|
|
49
49
|
* closing clears the search so highlights go away. The host (any framework)
|
|
50
50
|
* just opens it from a menu / shortcut.
|
|
51
51
|
*/
|
|
52
|
-
export declare function createFindDialog(
|
|
52
|
+
export declare function createFindDialog(handle: FindHandle | (() => FindHandle), options?: FindDialogOptions): FindDialogHandle;
|
|
53
53
|
//# sourceMappingURL=find.d.ts.map
|
package/dist/lib/find.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../src/lib/find.ts"],"names":[],"mappings":"AAGA,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,IAAI,CAAC;IACb,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,OAAO,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E,MAAM,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAuBD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,EACvC,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB,CA2HlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shadow-garden/bapbong-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "bapbong — framework-agnostic editor UI (toolbar/menubar) that mounts into a host element and binds to editor.commands",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@shadow-garden/bapbong-contracts": "^0.
|
|
59
|
+
"@shadow-garden/bapbong-contracts": "^0.4.0"
|
|
60
60
|
}
|
|
61
61
|
}
|