diff --git a/src/i18n/message/app/option-resource.json b/src/i18n/message/app/option-resource.json index 9e307096d..097e0bcd7 100644 --- a/src/i18n/message/app/option-resource.json +++ b/src/i18n/message/app/option-resource.json @@ -5,8 +5,6 @@ "popup": { "title": "弹窗页", "max": "只显示前 {input} 条数据,剩下的条目合并显示", - "defaultMergeMethod": "默认数据合并方式 {input}", - "defaultDisplay": "打开时显示 {duration} {type}", "displaySiteName": "{input} 显示时是否使用 {siteName} 来代替域名" }, "appearance": { @@ -136,8 +134,6 @@ "popup": { "title": "彈出視窗", "max": "僅顯示前 {input} 筆資料,其餘項目合併", - "defaultMergeMethod": "預設資料合併方式 {input}", - "defaultDisplay": "開啟時顯示 {duration} {type}", "displaySiteName": "{input} 是否使用 {siteName} 取代網域" }, "appearance": { @@ -266,8 +262,6 @@ "popup": { "title": "Popup Page", "max": "Show the first {input} data items", - "defaultMergeMethod": "Default data merging method {input}", - "defaultDisplay": "Show {duration} {type} on open", "displaySiteName": "{input} Whether to display {siteName} instead of URL" }, "appearance": { @@ -397,8 +391,6 @@ "popup": { "title": "ポップアップページ", "max": "最初の {input} 個のデータのみを表示し、残りのエントリは結合されます", - "defaultMergeMethod": "デフォルトのデータマージ方法 {input}", - "defaultDisplay": "開くと {duration} {type} が表示されます", "displaySiteName": "{input} ホストの代わりに {siteName} を表示するかどうか" }, "appearance": { @@ -527,8 +519,6 @@ "popup": { "title": "Página de Pop-up", "max": "Mostrar os primeiros {input} itens de dados", - "defaultMergeMethod": "Método padrão de fusão de dados {input}", - "defaultDisplay": "Mostrar {type} de {duration} em aberto", "displaySiteName": "{input} Se deve exibir {siteName} em vez de URL" }, "appearance": { @@ -656,8 +646,6 @@ "popup": { "title": "Вікно розширення", "max": "Кількість записів для показу: {input}", - "defaultMergeMethod": "Метод злиття даних за замовчуванням {input}", - "defaultDisplay": "Дані для показу: {duration} {type}", "displaySiteName": "{input} Показувати {siteName} замість URL-адреси" }, "appearance": { @@ -786,8 +774,6 @@ "popup": { "title": "Página emergente", "max": "Mostrar los primeros {input} elementos de datos", - "defaultMergeMethod": "Método de fusión de datos predeterminado {input}", - "defaultDisplay": "Mostrar {duration} {type} al abrir", "displaySiteName": "{input} Mostrar {siteName} en lugar de la URL" }, "appearance": { @@ -915,8 +901,6 @@ "popup": { "title": "Popup-Seite", "max": "Zeige die ersten {input} Datenelemente", - "defaultMergeMethod": "Standardmethode zum Zusammenführen von Daten {input}", - "defaultDisplay": "{duration} {type} beim Öffnen anzeigen", "displaySiteName": "{input} {siteName} statt URL anzeigen" }, "appearance": { @@ -1041,8 +1025,6 @@ "popup": { "title": "Page pop-up", "max": "Afficher les {input} premiers éléments de données", - "defaultMergeMethod": "Méthode de fusion des données par défaut {input}", - "defaultDisplay": "Afficher {duration} {type} à l'ouverture", "displaySiteName": "{input} S'il faut afficher {siteName} au lieu de l'URL" }, "appearance": { @@ -1167,7 +1149,6 @@ "popup": { "title": "Всплывающее окно", "max": "Показать первые {input} элементов данных", - "defaultDisplay": "Показать {duration} {type} при открытии", "displaySiteName": "{input} Отображать ли {siteName} вместо URL" }, "appearance": { diff --git a/src/i18n/message/app/option.ts b/src/i18n/message/app/option.ts index 1b3184120..c3f2946e1 100644 --- a/src/i18n/message/app/option.ts +++ b/src/i18n/message/app/option.ts @@ -12,8 +12,6 @@ export type OptionMessage = { popup: { title: string max: string - defaultMergeMethod: string - defaultDisplay: string displaySiteName: string } appearance: { diff --git a/src/pages/app/components/Option/components/PopupOption.tsx b/src/pages/app/components/Option/components/PopupOption.tsx index 74cb496a3..cf5c9a718 100644 --- a/src/pages/app/components/Option/components/PopupOption.tsx +++ b/src/pages/app/components/Option/components/PopupOption.tsx @@ -5,54 +5,18 @@ * https://opensource.org/licenses/MIT */ import { t } from "@app/locale" -import { type I18nKey, t as t_ } from "@i18n" -import DurationSelect, { rangeLabel } from "@popup/components/Footer/DurationSelect" import { IS_ANDROID } from "@util/constant/environment" import { defaultPopup } from "@util/constant/option" -import { ALL_DIMENSIONS } from "@util/stat" -import { ElInputNumber, ElOption, ElSelect, ElSwitch } from "element-plus" +import { ElInputNumber, ElSwitch } from "element-plus" import { defineComponent } from "vue" import { type OptionInstance } from "../common" import { useOption } from "../useOption" import OptionItem from "./OptionItem" import OptionTag from "./OptionTag" -type LocaleStyle = { - /** - * Width of duration select - */ - duration: number - /** - * Width and type select - */ - type: number -} - -const STYLES: Messages = { - zh_CN: { type: 85, duration: 100 }, - en: { type: 115, duration: 110 }, - ja: { type: 85, duration: 110 }, - pt_PT: { type: 155, duration: 120 }, - zh_TW: { type: 85, duration: 100 }, - uk: { type: 145, duration: 120 }, - es: { type: 160, duration: 125 }, - de: { duration: 120 }, - fr: { type: 150, duration: 130 }, - ru: { type: 170, duration: 150 }, -} - -const tStyle = (key: I18nKey) => t_(STYLES, { key }) - const defaultPopOptions = defaultPopup() -const defaultTypeLabel = t(msg => msg.item[defaultPopOptions.defaultType]) -const defaultDurationLabel = rangeLabel(defaultPopOptions.defaultDuration, defaultPopOptions.defaultDurationNum) -const displayDefaultLabel = `${defaultDurationLabel}/${defaultTypeLabel}` function copy(target: timer.option.PopupOption, source: timer.option.PopupOption) { - target.defaultMergeMethod = source.defaultMergeMethod - target.defaultDuration = source.defaultDuration - target.defaultDurationNum = source.defaultDurationNum - target.defaultType = source.defaultType target.displaySiteName = source.displaySiteName target.popupMax = source.popupMax } @@ -66,51 +30,7 @@ const _default = defineComponent((_props, ctx) => { return () => <> msg.option.popup.defaultMergeMethod} - defaultValue={t(msg => msg.shared.merge.mergeMethod.notMerge)} hideDivider - > - msg.shared.merge.mergeMethod.notMerge)} - onChange={(val: timer.stat.MergeMethod) => option.defaultMergeMethod = val || undefined} - > - msg.shared.merge.mergeMethod.notMerge)} /> - {(['domain', 'cate'] satisfies timer.stat.MergeMethod[]).map(m => ( - msg.shared.merge.mergeMethod[m])} /> - ))} - - - msg.option.popup.defaultDisplay} - defaultValue={displayDefaultLabel} - v-slots={{ - duration: () => ( - { - option.defaultDuration = duration - option.defaultDurationNum = num - }} - style={{ width: `${tStyle(m => m.duration)}px` }} - /> - ), - type: () => ( - m.type)}px` }} - onChange={(val: timer.core.Dimension) => option.defaultType = val} - > - {ALL_DIMENSIONS.map(item => msg.item[item])} />)} - - ) - }} - /> - msg.option.popup.max} defaultValue={defaultPopOptions.popupMax} > diff --git a/src/pages/popup/Main.tsx b/src/pages/popup/Main.tsx index 17ac97007..311b63bff 100644 --- a/src/pages/popup/Main.tsx +++ b/src/pages/popup/Main.tsx @@ -1,23 +1,13 @@ import Flex from "@pages/components/Flex" -import { DefaultOption } from "@util/constant/option" -import { defineComponent, inject } from "vue" +import { defineComponent } from "vue" import { RouterView } from "vue-router" import Footer from "./components/Footer" import Header from "./components/Header" import { initPopupContext } from "./context" -export const PROVIDE_KEY = 'POPUP_OPTION' - const Main = defineComponent(() => { - const option = inject(PROVIDE_KEY) as DefaultOption - const { defaultDuration, defaultType, defaultDurationNum, defaultMergeMethod } = option - const appKey = initPopupContext({ - mergeMethod: defaultMergeMethod, - duration: defaultDuration, - type: defaultType, - durationNum: defaultDurationNum, - }) + const appKey = initPopupContext() return () => ( diff --git a/src/pages/popup/common.tsx b/src/pages/popup/common.tsx index 3ba7dfcfe..2488aa3db 100644 --- a/src/pages/popup/common.tsx +++ b/src/pages/popup/common.tsx @@ -5,13 +5,7 @@ import { type StatQueryParam } from "@service/stat-service" import { isRemainHost } from "@util/constant/remain-host" import { getAppPageUrl } from "@util/constant/url" import { getMonthTime, MILL_PER_DAY } from "@util/time" - -export type PopupQuery = { - mergeMethod: timer.stat.MergeMethod | undefined - duration: timer.option.PopupDuration - durationNum?: number - type: timer.core.Dimension -} +import { type PopupQuery } from "./context" type DateRangeCalculator = (now: Date, num?: number) => Awaitable @@ -28,12 +22,12 @@ const DATE_RANGE_CALCULATORS: { [duration in timer.option.PopupDuration]: DateRa } export const cvt2StatQuery = async (param: PopupQuery): Promise => { - const { duration, durationNum, mergeMethod, type } = param + const { duration, durationNum, mergeMethod, dimension } = param const stat: StatQueryParam = { date: await DATE_RANGE_CALCULATORS[duration]?.(new Date(), durationNum), mergeHost: mergeMethod === 'domain', mergeCate: mergeMethod === 'cate', - sort: type, + sort: dimension, sortOrder: 'DESC', mergeDate: true, exclusiveVirtual: true, diff --git a/src/pages/popup/components/Footer/index.tsx b/src/pages/popup/components/Footer/index.tsx index a3322e08b..3d75f1824 100644 --- a/src/pages/popup/components/Footer/index.tsx +++ b/src/pages/popup/components/Footer/index.tsx @@ -1,5 +1,4 @@ import Flex from "@pages/components/Flex" -import { type PopupQuery } from "@popup/common" import DurationSelect from "@popup/components/Footer/DurationSelect" import { usePopupContext } from "@popup/context" import { t } from "@popup/locale" @@ -8,58 +7,49 @@ import { ElOption, ElSelect, ElText } from "element-plus" import { defineComponent } from "vue" import Menu from "./Menu" -const Footer = defineComponent({ - props: { - total: String, - }, - setup() { - const { query, setQuery } = usePopupContext() +const Footer = defineComponent(() => { + const { query } = usePopupContext() - const updateQuery = (k: K, v: PopupQuery[K]) => { - setQuery({ ...query.value, [k]: v } satisfies PopupQuery) - } - - return () => ( - - - - - - - {t(msg => msg.shared.merge.mergeBy)} - updateQuery('mergeMethod', val || undefined)} - placeholder={t(msg => msg.shared.merge.mergeMethod.notMerge)} - popperOptions={{ placement: 'top' }} - style={{ width: '90px' }} - > - msg.shared.merge.mergeMethod.notMerge)} /> - {(['domain', 'cate'] satisfies timer.stat.MergeMethod[]).map(method => ( - msg.shared.merge.mergeMethod[method])} /> - ))} - - - setQuery({ ...query.value, duration, durationNum })} - /> + return () => ( + + + + + + + {t(msg => msg.shared.merge.mergeBy)} updateQuery('type', v)} + modelValue={query.mergeMethod} + onChange={v => query.mergeMethod = v} + placeholder={t(msg => msg.shared.merge.mergeMethod.notMerge)} popperOptions={{ placement: 'top' }} - style={{ width: '120px' }} + style={{ width: '90px' }} > - {ALL_DIMENSIONS.map(item => msg.item[item])} />)} + msg.shared.merge.mergeMethod.notMerge)} /> + {(['domain', 'cate'] satisfies timer.stat.MergeMethod[]).map(method => ( + msg.shared.merge.mergeMethod[method])} /> + ))} - - ) - } + { + query.duration = duration + query.durationNum = durationNum + }} + /> + query.dimension = v} + popperOptions={{ placement: 'top' }} + style={{ width: '120px' }} + > + {ALL_DIMENSIONS.map(item => msg.item[item])} />)} + + + + ) }) export default Footer \ No newline at end of file diff --git a/src/pages/popup/components/Percentage/Cate/Wrapper.ts b/src/pages/popup/components/Percentage/Cate/Wrapper.ts index 4fd3dd86d..ef3a2bda0 100644 --- a/src/pages/popup/components/Percentage/Cate/Wrapper.ts +++ b/src/pages/popup/components/Percentage/Cate/Wrapper.ts @@ -64,8 +64,8 @@ export default class SiteWrapper extends EchartsWrapper r?.cateKey === this.selectedCache)?.[0] : undefined const textColor = getPrimaryTextColor() @@ -112,7 +112,7 @@ export default class SiteWrapper extends EchartsWrapper ({ - value: row[type], + value: row[dimension], cateKey: row.cateKey, selected: row.cateKey === selected?.cateKey, name: cateNameMap[row.cateKey ?? ''], @@ -133,7 +133,7 @@ export default class SiteWrapper extends EchartsWrapper (b[type] ?? 0) - (a[type] ?? 0)) + const mergedRows = (selected?.mergedRows || []).sort((a, b) => (b[dimension] ?? 0) - (a[dimension] ?? 0)) const siteSeries = generateSiteSeriesOption(mergedRows, result, { center: ['60%', '58%'], diff --git a/src/pages/popup/components/Percentage/Site/Wrapper.ts b/src/pages/popup/components/Percentage/Site/Wrapper.ts index 4f2fc9da9..ed9077759 100644 --- a/src/pages/popup/components/Percentage/Site/Wrapper.ts +++ b/src/pages/popup/components/Percentage/Site/Wrapper.ts @@ -52,8 +52,8 @@ export default class SiteWrapper extends EchartsWrapper !!str) isRtl() && (parts = parts.reverse()) return parts.join(' @ ') @@ -195,9 +195,9 @@ type CustomOption = Pick< > export function generateSiteSeriesOption(rows: timer.stat.Row[], result: PercentageResult, customOption: CustomOption): PieSeriesOption { - const { displaySiteName, query: { type }, itemCount } = result || {} + const { displaySiteName, query: { dimension }, itemCount } = result || {} - const chartRows = cvt2ChartRows(rows, type, itemCount) + const chartRows = cvt2ChartRows(rows, dimension, itemCount) const iconRich: PieLabelRichOption = {} const data = chartRows.map(d => { const { siteKey, cateKey, alias, isOther, iconUrl } = d @@ -207,7 +207,7 @@ export function generateSiteSeriesOption(rows: timer.stat.Row[], result: Percent iconUrl && (richValue.backgroundColor = { image: iconUrl }) iconRich[legend2LabelStyle(legend)] = richValue - return { name: legend, value: d[type] || 0, siteKey, cateKey, isOther, iconUrl } satisfies PieSeriesItemOption + return { name: legend, value: d[dimension] || 0, siteKey, cateKey, isOther, iconUrl } satisfies PieSeriesItemOption }) const textColor = getPrimaryTextColor() @@ -258,13 +258,13 @@ export function formatTooltip({ query, dateLength }: PercentageResult, params: C const label = host ? generateSiteLabel(host, name) : name let result = label const itemValue = typeof value === 'number' ? value as number : 0 - const { type } = query - const valueText = type === 'time' ? itemValue : formatPeriodCommon(itemValue) + const { dimension } = query + const valueText = dimension === 'time' ? itemValue : formatPeriodCommon(itemValue) result += '
' + valueText // Display percent only when query focus time - type === 'focus' && (result += ` (${percent}%)`) + dimension === 'focus' && (result += ` (${percent}%)`) if (!data.isOther && dateLength && dateLength > 1) { - const averageValueText = calculateAverageText(type, itemValue / dateLength) + const averageValueText = calculateAverageText(dimension, itemValue / dateLength) averageValueText && (result += `
${averageValueText}`) } return result diff --git a/src/pages/popup/components/Percentage/index.tsx b/src/pages/popup/components/Percentage/index.tsx index 2b6893c49..907beda01 100644 --- a/src/pages/popup/components/Percentage/index.tsx +++ b/src/pages/popup/components/Percentage/index.tsx @@ -14,7 +14,7 @@ use([CanvasRenderer, PieChart, AriaComponent, LegendComponent, TitleComponent, T const Percentage = defineComponent(() => { const { query } = usePopupContext() - const { data } = useRequest(() => doQuery(query.value), { deps: [query] }) + const { data } = useRequest(() => doQuery(query), { deps: () => ({ ...query }) }) return () => ( { style={{ width: '100%', height: '100%' }} bodyStyle={{ height: '100%', boxSizing: 'border-box', padding: 0 }} > - {query.value?.mergeMethod === 'cate' + {query.mergeMethod === 'cate' ? : } diff --git a/src/pages/popup/components/Percentage/query.ts b/src/pages/popup/components/Percentage/query.ts index 63a62179e..5f5f6c5db 100644 --- a/src/pages/popup/components/Percentage/query.ts +++ b/src/pages/popup/components/Percentage/query.ts @@ -1,4 +1,5 @@ -import { cvt2StatQuery, type PopupQuery } from "@popup/common" +import { cvt2StatQuery, } from "@popup/common" +import { type PopupQuery } from "@popup/context" import { t } from "@popup/locale" import optionHolder from "@service/components/option-holder" import statService from "@service/stat-service" diff --git a/src/pages/popup/components/Ranking/index.tsx b/src/pages/popup/components/Ranking/index.tsx index bb8f1d9a5..f7f97a483 100644 --- a/src/pages/popup/components/Ranking/index.tsx +++ b/src/pages/popup/components/Ranking/index.tsx @@ -7,7 +7,7 @@ import { doQuery } from "./query" const Ranking = defineComponent(() => { const { query } = usePopupContext() - const { data: result } = useRequest(() => doQuery(query.value), { deps: query }) + const { data: result } = useRequest(() => doQuery(query), { deps: () => ({ ...query }) }) return () => ( diff --git a/src/pages/popup/components/Ranking/query.tsx b/src/pages/popup/components/Ranking/query.tsx index e0b900c01..b9e205857 100644 --- a/src/pages/popup/components/Ranking/query.tsx +++ b/src/pages/popup/components/Ranking/query.tsx @@ -1,4 +1,5 @@ -import { cvt2StatQuery, type PopupQuery } from "@popup/common" +import { cvt2StatQuery } from "@popup/common" +import { type PopupQuery } from "@popup/context" import optionHolder from "@service/components/option-holder" import statService from "@service/stat-service" import { sum } from "@util/array" @@ -14,8 +15,8 @@ export type RankingResult = { export const doQuery = async (query: PopupQuery): Promise => { const statQuery = await cvt2StatQuery(query) const rows = await statService.select(statQuery, true) - const { type } = query || {} - const values = rows?.map(r => r?.[type] ?? 0) ?? [] + const { dimension } = query + const values = rows?.map(r => r?.[dimension] ?? 0) ?? [] const max = values.sort((a, b) => (b ?? 0) - (a ?? 0))[0] ?? 0 const total = sum(values) const date = statQuery.date diff --git a/src/pages/popup/context.ts b/src/pages/popup/context.ts index be5ca8e06..c74c7fe30 100644 --- a/src/pages/popup/context.ts +++ b/src/pages/popup/context.ts @@ -1,33 +1,45 @@ -import { useRequest, useState } from "@hooks" +import { useLocalStorage, useRequest } from "@hooks" import { useProvide, useProvider } from "@hooks/useProvider" import cateService from "@service/cate-service" import optionService from "@service/option-service" import { groupBy } from "@util/array" import { isDarkMode, toggle } from "@util/dark-mode" import { CATE_NOT_SET_ID } from "@util/site" -import { computed, ComputedRef, ref, type Ref } from "vue" -import { type PopupQuery } from "./common" +import { computed, type ComputedRef, reactive, type Reactive, ref, type Ref, toRaw, watch } from "vue" import { t } from "./locale" +export type PopupQuery = { + mergeMethod: timer.stat.MergeMethod | undefined + duration: timer.option.PopupDuration + durationNum?: number + dimension: timer.core.Dimension +} + type PopupContextValue = { reload: () => void darkMode: Ref setDarkMode: (val: boolean) => void - query: Ref - setQuery: (val: PopupQuery) => void + query: Reactive dimension: ComputedRef cateNameMap: Ref> } const NAMESPACE = '_' -export const initPopupContext = (defaultQuery: PopupQuery): Ref => { +export const initPopupContext = (): Ref => { const appKey = ref(Date.now()) const reload = () => appKey.value = Date.now() const { data: darkMode, refresh: refreshDarkMode } = useRequest(() => optionService.isDarkMode(), { defaultValue: isDarkMode() }) - const [query, setQuery] = useState(defaultQuery) + const [queryCache, setQueryCache] = useLocalStorage('popup-query', { + dimension: 'focus', + duration: 'today', + mergeMethod: undefined, + }) + + const query = reactive(queryCache) + watch(query, () => setQueryCache(toRaw(query)), { deep: true }) const setDarkMode = async (val: boolean) => { const option: timer.option.DarkMode = val ? 'on' : 'off' @@ -43,14 +55,14 @@ export const initPopupContext = (defaultQuery: PopupQuery): Ref => { return result }, { defaultValue: {} }) - const dimension = computed(() => query.value.type) - useProvide(NAMESPACE, { reload, darkMode, setDarkMode, query, setQuery, cateNameMap, dimension }) + const dimension = computed(() => query.dimension) + useProvide(NAMESPACE, { reload, darkMode, setDarkMode, query, cateNameMap, dimension }) return appKey } -export const usePopupContext = () => useProvider( - NAMESPACE, 'reload', 'darkMode', 'setDarkMode', 'query', 'setQuery', 'cateNameMap' +export const usePopupContext = () => useProvider( + NAMESPACE, 'reload', 'darkMode', 'setDarkMode', 'query', 'cateNameMap' ) export const useDimension = () => useProvider(NAMESPACE, 'dimension').dimension diff --git a/src/pages/popup/index.ts b/src/pages/popup/index.ts index 4dd98a348..a532b796e 100644 --- a/src/pages/popup/index.ts +++ b/src/pages/popup/index.ts @@ -11,11 +11,10 @@ import optionService from "@service/option-service" import { toggle } from "@util/dark-mode" import "element-plus/theme-chalk/index.css" import { createApp } from "vue" -import Main, { PROVIDE_KEY } from "./Main" +import Main from "./Main" import { type FrameRequest, type FrameResponse } from "./message" import initRouter from "./router" import "./style" -import optionHolder from "@service/components/option-holder" function send2ParentWindow(data: any): Promise { return new Promise(resolve => { @@ -47,9 +46,7 @@ async function main() { el.id = 'app' document.body.append(el) - const option = await optionHolder.get() const app = createApp(Main) - app.provide(PROVIDE_KEY, option) initRouter(app) app.mount(el) diff --git a/src/service/components/option-holder.ts b/src/service/components/option-holder.ts index 9181c370d..2981163ac 100644 --- a/src/service/components/option-holder.ts +++ b/src/service/components/option-holder.ts @@ -3,17 +3,6 @@ import { type DefaultOption, defaultOption } from "@util/constant/option" const db = new OptionDatabase(chrome.storage.local) -function migrateOld(result: T): T { - const newRes = { ...result } - const duration = newRes['defaultDuration'] - if (duration as string === 'last30Days') { - // old option, deprecated since v2.5.3, Nov 23 2024 - newRes.defaultDuration = 'lastDays' - newRes.defaultDurationNum = 30 - } - return newRes -} - type ChangeListener = (option: timer.option.AllOption) => void class OptionHolder { @@ -31,9 +20,8 @@ class OptionHolder { const exist: Partial = await db.getOption() const result = defaultOption() Object.entries(exist).forEach(([key, val]) => (result as any)[key] = val) - const newVal = migrateOld(result) - this.option = newVal - return newVal + this.option = result + return result } async get(): Promise { diff --git a/src/util/constant/option.ts b/src/util/constant/option.ts index bf6e9dd69..6a3395404 100644 --- a/src/util/constant/option.ts +++ b/src/util/constant/option.ts @@ -5,20 +5,14 @@ * https://opensource.org/licenses/MIT */ -type PopupRequired = MakeRequired - -export function defaultPopup(): PopupRequired { +export function defaultPopup(): timer.option.PopupOption { // Use template return { popupMax: 10, - defaultType: 'focus', - defaultDuration: "today", - defaultDurationNum: 7, /** * Change the default value to 'true' since v0.5.4 */ displaySiteName: true, - defaultMergeMethod: undefined, } } @@ -86,7 +80,7 @@ export function defaultAccessibility(): timer.option.AccessibilityOption { } export type DefaultOption = - & PopupRequired & AppearanceRequired & StatisticsRequired & DailyLimitRequired + & timer.option.PopupOption & AppearanceRequired & StatisticsRequired & DailyLimitRequired & timer.option.BackupOption & timer.option.AccessibilityOption export function defaultOption(): DefaultOption { diff --git a/types/timer/option.d.ts b/types/timer/option.d.ts index 991a734ab..470722d28 100644 --- a/types/timer/option.d.ts +++ b/types/timer/option.d.ts @@ -16,21 +16,6 @@ declare namespace timer.option { * The max count of today's data to display on popup page */ popupMax: number - /** - * The default type to display - */ - defaultType: core.Dimension - /** - * The default duration to search - * @since 0.6.0 - */ - defaultDuration: PopupDuration - /** - * The default duration number to search - * - * @since 2.5.3 - */ - defaultDurationNum?: number /** * Replace the host name with site name which is detected automatically from the title of site homepages, * or modified manually by the user