@fluid-topics/ft-wc-utils 1.1.100 → 1.1.101
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/build/FluidTopicsScrollHelper.d.ts +22 -0
- package/build/FluidTopicsScrollHelper.js +96 -0
- package/build/globals.min.js +12 -12
- package/build/highlight-html.d.ts +5 -1
- package/build/highlight-html.js +14 -7
- package/build/index.d.ts +1 -0
- package/build/index.js +9 -2
- package/package.json +2 -2
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export declare const highlightHtmlColorCssVariable: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
2
2
|
export declare const highlightHtmlStyles: import("lit").CSSResult;
|
|
3
|
-
export
|
|
3
|
+
export type HighlightHtmlOptions = {
|
|
4
|
+
className?: string;
|
|
5
|
+
attributes?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare function highlightHtml(container: HTMLElement, query?: string, options?: HighlightHtmlOptions): void;
|
package/build/highlight-html.js
CHANGED
|
@@ -11,18 +11,25 @@ export const highlightHtmlStyles = css `
|
|
|
11
11
|
background: ${highlightHtmlColorCssVariable};
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export function highlightHtml(container, query) {
|
|
18
|
-
var _a;
|
|
14
|
+
export function highlightHtml(container, query, options) {
|
|
15
|
+
var _a, _b;
|
|
19
16
|
let lastQuery = container.getAttribute("data-highlight-html-query");
|
|
20
17
|
if ((lastQuery !== null && lastQuery !== void 0 ? lastQuery : "") !== (query !== null && query !== void 0 ? query : "")) {
|
|
21
18
|
const mark = new Mark(container);
|
|
22
|
-
mark.unmark(
|
|
19
|
+
mark.unmark();
|
|
23
20
|
if (query && query.trim()) {
|
|
21
|
+
const markOptions = {
|
|
22
|
+
className: (_a = options === null || options === void 0 ? void 0 : options.className) !== null && _a !== void 0 ? _a : "highlight-html-match"
|
|
23
|
+
};
|
|
24
|
+
if ((options === null || options === void 0 ? void 0 : options.attributes) != undefined) {
|
|
25
|
+
markOptions.each = ((e) => {
|
|
26
|
+
for (let attr in options.attributes) {
|
|
27
|
+
e.setAttribute(attr, options.attributes[attr]);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
24
31
|
mark.mark(query.replace(/"[^"]+"/g, ""), { ...markOptions, separateWordSearch: true });
|
|
25
|
-
const exactWords = (
|
|
32
|
+
const exactWords = (_b = query.match(/"[^"]+"/g)) !== null && _b !== void 0 ? _b : [];
|
|
26
33
|
exactWords.forEach(words => mark.mark(words.replace(/"/g, ""), { ...markOptions, separateWordSearch: false }));
|
|
27
34
|
}
|
|
28
35
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from "./models";
|
|
|
29
29
|
export * from "./ParametrizedLabelResolver";
|
|
30
30
|
export * from "./redux";
|
|
31
31
|
export * from "./ScopedRegistryLitElement";
|
|
32
|
+
export * from "./FluidTopicsScrollHelper";
|
|
32
33
|
export * from "./shadowQuerySelector";
|
|
33
34
|
export * from "./urlHelpers";
|
|
34
35
|
export * from "./FtFormComponent";
|
package/build/index.js
CHANGED
|
@@ -25,9 +25,12 @@ import * as models from "./models";
|
|
|
25
25
|
import * as ParametrizedLabelResolver from "./ParametrizedLabelResolver";
|
|
26
26
|
import * as redux from "./redux";
|
|
27
27
|
import * as ScopedRegistryLitElement from "./ScopedRegistryLitElement";
|
|
28
|
+
import * as FluidTopicsScrollHelper from "./FluidTopicsScrollHelper";
|
|
29
|
+
import * as shadowQuerySelector from "./shadowQuerySelector";
|
|
28
30
|
import * as urlHelpers from "./urlHelpers";
|
|
29
31
|
import * as FtFormComponent from "./FtFormComponent";
|
|
30
|
-
import
|
|
32
|
+
import * as DateFormatter from "./DateFormatter";
|
|
33
|
+
import { setVariable } from "@fluid-topics/design-system-variables";
|
|
31
34
|
export const isSafari = (navigator.vendor && !!navigator.vendor.match(/apple/i))
|
|
32
35
|
|| ((_c = (_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "") === "[object SafariRemoteNotification]";
|
|
33
36
|
export const isTouchScreen = (("ontouchstart" in window)
|
|
@@ -62,10 +65,13 @@ window.ftGlobals = (_d = window.ftGlobals) !== null && _d !== void 0 ? _d : {
|
|
|
62
65
|
...ParametrizedLabelResolver,
|
|
63
66
|
...redux,
|
|
64
67
|
...ScopedRegistryLitElement,
|
|
68
|
+
...FluidTopicsScrollHelper,
|
|
69
|
+
...shadowQuerySelector,
|
|
65
70
|
...urlHelpers,
|
|
66
71
|
...FtFormComponent,
|
|
67
72
|
isSafari,
|
|
68
|
-
isTouchScreen
|
|
73
|
+
isTouchScreen,
|
|
74
|
+
setVariable,
|
|
69
75
|
}
|
|
70
76
|
};
|
|
71
77
|
export * from "./CacheRegistry";
|
|
@@ -88,6 +94,7 @@ export * from "./models";
|
|
|
88
94
|
export * from "./ParametrizedLabelResolver";
|
|
89
95
|
export * from "./redux";
|
|
90
96
|
export * from "./ScopedRegistryLitElement";
|
|
97
|
+
export * from "./FluidTopicsScrollHelper";
|
|
91
98
|
export * from "./shadowQuerySelector";
|
|
92
99
|
export * from "./urlHelpers";
|
|
93
100
|
export * from "./FtFormComponent";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-wc-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.101",
|
|
4
4
|
"description": "Internal web components tools",
|
|
5
5
|
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"mark.js": "8.11.1",
|
|
25
25
|
"moment": "2.29.4"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "2d444ace3306098342639937b95d84f13f24cb2d"
|
|
28
28
|
}
|