|
1614 | 1614 | )), /* @__PURE__ */ _("defs", null, /* @__PURE__ */ _("linearGradient", { id: "Search-Find-Color-16_svg__b", x1: "8", x2: "8", y1: "0", y2: "16", gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ _("stop", { "stop-color": "#557FF3" }), /* @__PURE__ */ _("stop", { offset: "1", "stop-color": "#2B55CA" })), /* @__PURE__ */ _("clipPath", { id: "Search-Find-Color-16_svg__a" }, /* @__PURE__ */ _("path", { fill: "#fff", d: "M0 0h16v16H0z" }))));
|
1615 | 1615 | }
|
1616 | 1616 | function SearchOnDarkColorIcon(props) {
|
1617 |
| - return /* @__PURE__ */ _("svg", { width: "16", height: "16", fill: "none", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ _("g", { "clip-path": "url(#Search-Find-OnDark-Color-16_svg__a)" }, /* @__PURE__ */ _("path", { fill: "#444", d: "M13 7A6 6 0 1 1 1 7a6 6 0 0 1 12 0Z" }), /* @__PURE__ */ _( |
| 1617 | + return /* @__PURE__ */ _("svg", { width: "16", height: "16", fill: "none", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ _("g", { "clip-path": "url(#Search-Find-OnDark-Color-16_svg__a)" }, /* @__PURE__ */ _("path", { fill: "#000", d: "M13 7A6 6 0 1 1 1 7a6 6 0 0 1 12 0Z", opacity: ".2" }), /* @__PURE__ */ _( |
1618 | 1618 | "path",
|
1619 | 1619 | {
|
1620 | 1620 | fill: "#fff",
|
|
1920 | 1920 | function CustomizerMenuPositionedFixed({ children }) {
|
1921 | 1921 | return /* @__PURE__ */ _("div", { class: Customizer_default.lowerRightFixed }, children);
|
1922 | 1922 | }
|
1923 |
| - function useCustomizer({ title, id, icon, toggle, visibility, index: index2 }) { |
| 1923 | + function useCustomizer({ title, id, icon, toggle, visibility, index: index2, enabled }) { |
1924 | 1924 | y2(() => {
|
1925 | 1925 | const handler = (e4) => {
|
1926 |
| - e4.detail.register({ title, id, icon, toggle, visibility, index: index2 }); |
| 1926 | + e4.detail.register({ title, id, icon, toggle, visibility, index: index2, enabled }); |
1927 | 1927 | };
|
1928 | 1928 | window.addEventListener(OPEN_EVENT, handler);
|
1929 | 1929 | return () => window.removeEventListener(OPEN_EVENT, handler);
|
1930 |
| - }, [title, id, icon, toggle, visibility, index2]); |
| 1930 | + }, [title, id, icon, toggle, visibility, index2, enabled]); |
1931 | 1931 | y2(() => {
|
1932 | 1932 | window.dispatchEvent(new Event(UPDATE_EVENT));
|
1933 | 1933 | return () => {
|
|
6743 | 6743 | );
|
6744 | 6744 | const { id, visibility, toggle, index: index2 } = useVisibility();
|
6745 | 6745 | const title = t4("favorites_menu_title");
|
6746 |
| - useCustomizer({ title, id, icon: /* @__PURE__ */ _(Shield, null), toggle, visibility: visibility.value, index: index2 }); |
| 6746 | + useCustomizer({ title, id, icon: /* @__PURE__ */ _(Shield, null), toggle, visibility: visibility.value, index: index2, enabled: true }); |
6747 | 6747 | if (visibility.value === "hidden") {
|
6748 | 6748 | return null;
|
6749 | 6749 | }
|
|
8784 | 8784 | * @param {T} args.value
|
8785 | 8785 | */
|
8786 | 8786 | update({ id, value: value2 }) {
|
8787 |
| - if (string(id) && string(value2)) { |
| 8787 | + if (string(id)) { |
8788 | 8788 | __privateGet(this, _values).set(id, value2);
|
8789 | 8789 | }
|
8790 | 8790 | }
|
|
8826 | 8826 | byId(id) {
|
8827 | 8827 | if (typeof id !== "string") return null;
|
8828 | 8828 | const value2 = __privateGet(this, _values).get(id);
|
8829 |
| - if (!value2 || !string(value2)) return null; |
| 8829 | + if (value2 === void 0) return null; |
8830 | 8830 | return value2;
|
8831 | 8831 | }
|
8832 | 8832 | print() {
|
|
8996 | 8996 |
|
8997 | 8997 | // pages/new-tab/app/omnibar/components/OmnibarConsumer.js
|
8998 | 8998 | function OmnibarConsumer() {
|
8999 |
| - const { state } = x2(OmnibarContext); |
| 8999 | + const { state, setEnableAi } = x2(OmnibarContext); |
9000 | 9000 | const { current } = useTabState();
|
9001 |
| - if (state.status === "ready") { |
9002 |
| - return /* @__PURE__ */ _(OmnibarReadyState, { config: state.config, key: current.value, tabId: current.value }); |
9003 |
| - } |
9004 |
| - return null; |
| 9001 | + const { visibility } = useVisibility(); |
| 9002 | + if (state.status !== "ready") return null; |
| 9003 | + const visible = visibility.value === "visible"; |
| 9004 | + return /* @__PURE__ */ _(k, null, state.config.showAiSetting && /* @__PURE__ */ _(AiSetting, { enableAi: state.config?.enableAi === true, setEnableAi, omnibarVisible: visible }), visible && /* @__PURE__ */ _(OmnibarReadyState, { config: state.config, key: current.value, tabId: current.value })); |
9005 | 9005 | }
|
9006 | 9006 | function OmnibarReadyState({ config, tabId }) {
|
9007 | 9007 | const { enableAi = true, showAiSetting = true, mode: defaultMode } = config;
|
9008 |
| - const { setEnableAi, setMode } = x2(OmnibarContext); |
| 9008 | + const { setMode } = x2(OmnibarContext); |
9009 | 9009 | const modeForCurrentTab = useModeWithLocalPersistence(tabId, defaultMode);
|
9010 |
| - return /* @__PURE__ */ _(k, null, showAiSetting && /* @__PURE__ */ _(AiSetting, { enableAi, setEnableAi }), /* @__PURE__ */ _(Omnibar, { mode: modeForCurrentTab, setMode, enableAi: showAiSetting && enableAi, tabId })); |
| 9010 | + return /* @__PURE__ */ _(Omnibar, { mode: modeForCurrentTab, setMode, enableAi: showAiSetting && enableAi, tabId }); |
9011 | 9011 | }
|
9012 |
| - function AiSetting({ enableAi, setEnableAi }) { |
| 9012 | + function AiSetting({ enableAi, setEnableAi, omnibarVisible }) { |
9013 | 9013 | const { t: t4 } = useTypedTranslationWith(
|
9014 | 9014 | /** @type {Strings} */
|
9015 | 9015 | {}
|
|
9020 | 9020 | id: `_${id}-toggleAi`,
|
9021 | 9021 | icon: /* @__PURE__ */ _(ArrowIndentCenteredIcon, { style: { color: "var(--ntp-icons-tertiary)" } }),
|
9022 | 9022 | toggle: () => setEnableAi(!enableAi),
|
9023 |
| - visibility: enableAi ? "visible" : "hidden", |
9024 |
| - index: index2 + 0.1 |
| 9023 | + /** |
| 9024 | + * Duck.ai is only ever shown as 'visible' (eg: switch is checked) if the omnibar is also visible. |
| 9025 | + */ |
| 9026 | + visibility: omnibarVisible && enableAi ? "visible" : "hidden", |
| 9027 | + index: index2 + 0.1, |
| 9028 | + enabled: omnibarVisible |
9025 | 9029 | });
|
9026 | 9030 | return null;
|
9027 | 9031 | }
|
|
9049 | 9053 | );
|
9050 | 9054 | const sectionTitle = t4("omnibar_menuTitle");
|
9051 | 9055 | const { visibility, id, toggle, index: index2 } = useVisibility();
|
9052 |
| - useCustomizer({ title: sectionTitle, id, icon: /* @__PURE__ */ _(SearchIcon, null), toggle, visibility: visibility.value, index: index2 }); |
9053 |
| - return /* @__PURE__ */ _(PersistentTextInputProvider, null, /* @__PURE__ */ _(PersistentModeProvider, null, visibility.value === "visible" && /* @__PURE__ */ _(OmnibarProvider, null, /* @__PURE__ */ _(OmnibarConsumer, null)))); |
| 9056 | + useCustomizer({ title: sectionTitle, id, icon: /* @__PURE__ */ _(SearchIcon, null), toggle, visibility: visibility.value, index: index2, enabled: true }); |
| 9057 | + return /* @__PURE__ */ _(PersistentTextInputProvider, null, /* @__PURE__ */ _(PersistentModeProvider, null, /* @__PURE__ */ _(OmnibarProvider, null, /* @__PURE__ */ _(OmnibarConsumer, null)))); |
9054 | 9058 | }
|
9055 | 9059 | var init_OmnibarCustomized = __esm({
|
9056 | 9060 | "pages/new-tab/app/omnibar/components/OmnibarCustomized.js"() {
|
|
27537 | 27541 | );
|
27538 | 27542 | const sectionTitle = t4("protections_menuTitle");
|
27539 | 27543 | const { visibility, id, toggle, index: index2 } = useVisibility();
|
27540 |
| - useCustomizer({ title: sectionTitle, id, icon: /* @__PURE__ */ _(DuckFoot, null), toggle, visibility: visibility.value, index: index2 }); |
| 27544 | + useCustomizer({ title: sectionTitle, id, icon: /* @__PURE__ */ _(DuckFoot, null), toggle, visibility: visibility.value, index: index2, enabled: true }); |
27541 | 27545 | if (visibility.value === "hidden") {
|
27542 | 27546 | return null;
|
27543 | 27547 | }
|
|
28274 | 28278 | icon: /* @__PURE__ */ _(DuckFoot, null),
|
28275 | 28279 | visibility: isOpen ? "visible" : "hidden",
|
28276 | 28280 | toggle: (_id) => setOpen((prev) => !prev),
|
28277 |
| - index: index2 |
| 28281 | + index: index2, |
| 28282 | + enabled: true |
28278 | 28283 | });
|
28279 | 28284 | return /* @__PURE__ */ _("div", null, isOpen && /* @__PURE__ */ _(Debug, { telemetry: telemetry2, isOpen: true }));
|
28280 | 28285 | }
|
|
28784 | 28789 | };
|
28785 | 28790 |
|
28786 | 28791 | // shared/components/Switch/Switch.js
|
28787 |
| - function Switch({ checked = false, platformName, size, theme, ...props }) { |
| 28792 | + function Switch({ checked = false, platformName, size, theme, inputProps, ...props }) { |
28788 | 28793 | const { onChecked, onUnchecked, ariaLabel, pending } = props;
|
28789 | 28794 | function change(e4) {
|
28790 | 28795 | if (e4.target.checked === true) {
|
|
28802 | 28807 | "aria-label": ariaLabel,
|
28803 | 28808 | class: Switch_default.input,
|
28804 | 28809 | checked,
|
28805 |
| - onChange: change |
| 28810 | + onChange: change, |
| 28811 | + ...inputProps |
28806 | 28812 | }
|
28807 | 28813 | ), /* @__PURE__ */ _("span", { class: Switch_default.switch, style: "transition-duration: 130ms;transition-delay: 0ms;" }));
|
28808 | 28814 | }
|
|
28816 | 28822 | list: "VisibilityMenu_list",
|
28817 | 28823 | embedded: "VisibilityMenu_embedded",
|
28818 | 28824 | menuItemLabel: "VisibilityMenu_menuItemLabel",
|
| 28825 | + title: "VisibilityMenu_title", |
28819 | 28826 | menuItemLabelEmbedded: "VisibilityMenu_menuItemLabelEmbedded",
|
28820 | 28827 | svg: "VisibilityMenu_svg"
|
28821 | 28828 | };
|
|
28825 | 28832 | const platformName = usePlatformName();
|
28826 | 28833 | const { browser } = x2(CustomizerThemesContext);
|
28827 | 28834 | return /* @__PURE__ */ _("ul", { className: (0, import_classnames16.default)(VisibilityMenu_default.list, VisibilityMenu_default.embedded) }, rows.map((row) => {
|
28828 |
| - return /* @__PURE__ */ _("li", { key: row.id }, /* @__PURE__ */ _("div", { class: (0, import_classnames16.default)(VisibilityMenu_default.menuItemLabel, VisibilityMenu_default.menuItemLabelEmbedded) }, /* @__PURE__ */ _("span", { className: VisibilityMenu_default.svg }, row.icon), /* @__PURE__ */ _("span", null, row.title ?? row.id), /* @__PURE__ */ _( |
| 28835 | + return /* @__PURE__ */ _("li", { key: row.id }, /* @__PURE__ */ _("div", { class: (0, import_classnames16.default)(VisibilityMenu_default.menuItemLabel, VisibilityMenu_default.menuItemLabelEmbedded) }, /* @__PURE__ */ _("span", { class: VisibilityMenu_default.svg }, row.icon), /* @__PURE__ */ _("span", { class: VisibilityMenu_default.title }, row.title ?? row.id), /* @__PURE__ */ _( |
28829 | 28836 | Switch,
|
28830 | 28837 | {
|
28831 | 28838 | theme: browser.value,
|
|
28835 | 28842 | onChecked: () => row.toggle?.(row.id),
|
28836 | 28843 | onUnchecked: () => row.toggle?.(row.id),
|
28837 | 28844 | ariaLabel: `Toggle ${row.title}`,
|
28838 |
| - pending: false |
| 28845 | + pending: false, |
| 28846 | + inputProps: { |
| 28847 | + disabled: row.enabled === false |
| 28848 | + } |
28839 | 28849 | }
|
28840 | 28850 | )));
|
28841 | 28851 | }));
|
|
29891 | 29901 | init_utils2();
|
29892 | 29902 | init_CustomizerMenu();
|
29893 | 29903 | init_signals_module();
|
| 29904 | + init_Icons2(); |
| 29905 | + var ROWS = [ |
| 29906 | + { |
| 29907 | + id: "omnibar", |
| 29908 | + title: "Search", |
| 29909 | + icon: /* @__PURE__ */ _(SearchIcon, null), |
| 29910 | + toggle: noop("toggle search"), |
| 29911 | + visibility: "visible", |
| 29912 | + index: 1, |
| 29913 | + enabled: true |
| 29914 | + }, |
| 29915 | + { |
| 29916 | + id: "omnibar-toggleAi", |
| 29917 | + title: "Duck.ai", |
| 29918 | + icon: /* @__PURE__ */ _(ArrowIndentCenteredIcon, { style: { color: "var(--ntp-icons-tertiary)" } }), |
| 29919 | + toggle: noop("toggle Duck.ai"), |
| 29920 | + visibility: "visible", |
| 29921 | + index: 1.1, |
| 29922 | + enabled: true |
| 29923 | + }, |
| 29924 | + { |
| 29925 | + id: "favorites", |
| 29926 | + title: "Favorites", |
| 29927 | + icon: /* @__PURE__ */ _(Shield, null), |
| 29928 | + toggle: noop("toggle favorites"), |
| 29929 | + visibility: "hidden", |
| 29930 | + index: 0, |
| 29931 | + enabled: true |
| 29932 | + }, |
| 29933 | + { |
| 29934 | + id: "privacyStats", |
| 29935 | + title: "Privacy Stats", |
| 29936 | + icon: /* @__PURE__ */ _(DuckFoot, null), |
| 29937 | + toggle: noop("toggle favorites"), |
| 29938 | + visibility: "visible", |
| 29939 | + index: 1, |
| 29940 | + enabled: true |
| 29941 | + } |
| 29942 | + ]; |
29894 | 29943 | var customizerExamples = {
|
29895 | 29944 | "customizer.backgroundSection": {
|
29896 | 29945 | factory: () => {
|
@@ -29931,27 +29980,21 @@
|
29931 | 29980 | }
|
29932 | 29981 | },
|
29933 | 29982 | "customizer-menu": {
|
| 29983 | + factory: () => /* @__PURE__ */ _(MaxContent, null, /* @__PURE__ */ _(CustomizerButton, { isOpen: true, kind: "menu" }), /* @__PURE__ */ _("br", null), /* @__PURE__ */ _("div", { style: "width: 206px; border: 1px dotted black" }, /* @__PURE__ */ _(EmbeddedVisibilityMenu, { rows: ROWS }))) |
| 29984 | + }, |
| 29985 | + "customizer-menu-disabled-item": { |
29934 | 29986 | factory: () => /* @__PURE__ */ _(MaxContent, null, /* @__PURE__ */ _(CustomizerButton, { isOpen: true, kind: "menu" }), /* @__PURE__ */ _("br", null), /* @__PURE__ */ _("div", { style: "width: 206px; border: 1px dotted black" }, /* @__PURE__ */ _(
|
29935 | 29987 | EmbeddedVisibilityMenu,
|
29936 | 29988 | {
|
29937 |
| - rows: [ |
29938 |
| - { |
29939 |
| - id: "favorites", |
29940 |
| - title: "Favorites", |
29941 |
| - icon: "star", |
29942 |
| - toggle: noop("toggle favorites"), |
29943 |
| - visibility: "hidden", |
29944 |
| - index: 0 |
29945 |
| - }, |
29946 |
| - { |
29947 |
| - id: "privacyStats", |
29948 |
| - title: "Privacy Stats", |
29949 |
| - icon: "shield", |
29950 |
| - toggle: noop("toggle favorites"), |
29951 |
| - visibility: "visible", |
29952 |
| - index: 1 |
29953 |
| - } |
29954 |
| - ] |
| 29989 | + rows: ROWS.map((row) => { |
| 29990 | + if (row.id === "omnibar") { |
| 29991 | + return { ...row, visibility: "hidden" }; |
| 29992 | + } |
| 29993 | + if (row.id === "omnibar-toggleAi") { |
| 29994 | + return { ...row, enabled: false, visibility: "hidden" }; |
| 29995 | + } |
| 29996 | + return row; |
| 29997 | + }) |
29955 | 29998 | }
|
29956 | 29999 | )))
|
29957 | 30000 | }
|
|
0 commit comments