mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Use eslint for sorting our imports (#1637)
* Make eslint sort our imports * fix missing deps in eslint rule (dae) Caught on Linux due to the stricter sandboxing * Remove exports-last eslint rule (for now?) * Adjust browserslist settings - We use ResizeObserver which is not supported in browsers like KaiOS, Baidu or Android UC * Raise minimum iOS version 13.4 - It's the first version that supports ResizeObserver * Apply new eslint rules to sort imports
This commit is contained in:
parent
83baa946dd
commit
30bbbaf00b
209 changed files with 2764 additions and 902 deletions
|
@ -65,6 +65,9 @@
|
||||||
"codemirror": "^5.63.1",
|
"codemirror": "^5.63.1",
|
||||||
"css-browser-selector": "^0.6.5",
|
"css-browser-selector": "^0.6.5",
|
||||||
"d3": "^7.0.0",
|
"d3": "^7.0.0",
|
||||||
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||||
|
"eslint-plugin-svelte3": "^3.4.0",
|
||||||
"intl-pluralrules": "^1.2.2",
|
"intl-pluralrules": "^1.2.2",
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.5.1",
|
||||||
"jquery-ui-dist": "^1.12.1",
|
"jquery-ui-dist": "^1.12.1",
|
||||||
|
@ -83,9 +86,9 @@
|
||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"defaults",
|
"defaults",
|
||||||
"not IE 11",
|
|
||||||
"not op_mini all",
|
"not op_mini all",
|
||||||
|
"not < 1%",
|
||||||
"Chrome 77",
|
"Chrome 77",
|
||||||
"iOS 12"
|
"iOS 13.4"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,53 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: ["eslint:recommended", "plugin:compat/recommended"],
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:compat/recommended",
|
|
||||||
],
|
|
||||||
parser: "@typescript-eslint/parser",
|
parser: "@typescript-eslint/parser",
|
||||||
plugins: ["@typescript-eslint"],
|
plugins: [
|
||||||
|
"svelte3",
|
||||||
|
"import",
|
||||||
|
"simple-import-sort",
|
||||||
|
"@typescript-eslint",
|
||||||
|
"@typescript-eslint/eslint-plugin",
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"prefer-const": "warn",
|
|
||||||
"no-nested-ternary": "warn",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "warn",
|
"@typescript-eslint/ban-ts-comment": "warn",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"warn",
|
"warn",
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||||||
],
|
],
|
||||||
|
"import/newline-after-import": "warn",
|
||||||
|
"import/no-useless-path-segments": "warn",
|
||||||
|
"simple-import-sort/imports": "warn",
|
||||||
|
"simple-import-sort/exports": "warn",
|
||||||
|
"prefer-const": "warn",
|
||||||
|
"no-nested-ternary": "warn",
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: "**/*.ts",
|
||||||
|
extends: [
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: "**/*.svelte",
|
||||||
|
processor: "svelte3/svelte3",
|
||||||
|
rules: {
|
||||||
|
"no-redeclare": "off",
|
||||||
|
"no-global-assign": "off",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
env: { browser: true },
|
env: { browser: true },
|
||||||
ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts"],
|
ignorePatterns: ["backend_proto.d.ts", "*.svelte.d.ts"],
|
||||||
|
globals: {
|
||||||
|
globalThis: false,
|
||||||
|
NodeListOf: false,
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
"svelte3/typescript": () => require("typescript"),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,12 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Stats } from "../lib/proto";
|
|
||||||
import { stats as statsService } from "../lib/proto";
|
|
||||||
import Container from "../components/Container.svelte";
|
import Container from "../components/Container.svelte";
|
||||||
import Row from "../components/Row.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import CardStats from "./CardStats.svelte";
|
import type { Stats } from "../lib/proto";
|
||||||
|
import { stats as statsService } from "../lib/proto";
|
||||||
import CardInfoPlaceholder from "./CardInfoPlaceholder.svelte";
|
import CardInfoPlaceholder from "./CardInfoPlaceholder.svelte";
|
||||||
|
import CardStats from "./CardStats.svelte";
|
||||||
import Revlog from "./Revlog.svelte";
|
import Revlog from "./Revlog.svelte";
|
||||||
|
|
||||||
export let cardId: number | null = null;
|
export let cardId: number | null = null;
|
||||||
|
|
|
@ -5,7 +5,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr2 from "../lib/ftl";
|
import * as tr2 from "../lib/ftl";
|
||||||
import { Stats, unwrapOptionalNumber } from "../lib/proto";
|
import { Stats, unwrapOptionalNumber } from "../lib/proto";
|
||||||
import { Timestamp, timeSpan, DAY } from "../lib/time";
|
import { DAY, timeSpan, Timestamp } from "../lib/time";
|
||||||
|
|
||||||
export let stats: Stats.CardStatsResponse;
|
export let stats: Stats.CardStatsResponse;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr2 from "../lib/ftl";
|
import * as tr2 from "../lib/ftl";
|
||||||
import { Stats } from "../lib/proto";
|
import { Stats } from "../lib/proto";
|
||||||
import { Timestamp, timeSpan } from "../lib/time";
|
import { timeSpan, Timestamp } from "../lib/time";
|
||||||
|
|
||||||
type StatsRevlogEntry = Stats.CardStatsResponse.StatsRevlogEntry;
|
type StatsRevlogEntry = Stats.CardStatsResponse.StatsRevlogEntry;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
||||||
import { checkNightMode } from "../lib/nightmode";
|
|
||||||
|
|
||||||
import CardInfo from "./CardInfo.svelte";
|
|
||||||
import "./card-info-base.css";
|
import "./card-info-base.css";
|
||||||
|
|
||||||
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
||||||
|
import { checkNightMode } from "../lib/nightmode";
|
||||||
|
import CardInfo from "./CardInfo.svelte";
|
||||||
|
|
||||||
const i18n = setupI18n({
|
const i18n = setupI18n({
|
||||||
modules: [ModuleName.CARD_STATS, ModuleName.SCHEDULING, ModuleName.STATISTICS],
|
modules: [ModuleName.CARD_STATS, ModuleName.SCHEDULING, ModuleName.STATISTICS],
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,12 +3,13 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
|
||||||
import { MapContext } from "./lib";
|
|
||||||
import { plusIcon, minusIcon } from "./icons";
|
|
||||||
import { slide } from "svelte/transition";
|
import { slide } from "svelte/transition";
|
||||||
|
|
||||||
|
import Badge from "../components/Badge.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { minusIcon, plusIcon } from "./icons";
|
||||||
|
import { MapContext } from "./lib";
|
||||||
|
|
||||||
export let unused: string[];
|
export let unused: string[];
|
||||||
export let ctx: MapContext;
|
export let ctx: MapContext;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
? tr.changeNotetypeWillDiscardContent()
|
? tr.changeNotetypeWillDiscardContent()
|
||||||
: tr.changeNotetypeWillDiscardCards();
|
: tr.changeNotetypeWillDiscardCards();
|
||||||
|
|
||||||
let maxItems: number = 3;
|
const maxItems: number = 3;
|
||||||
let collapsed: boolean = true;
|
let collapsed: boolean = true;
|
||||||
$: collapseMsg = collapsed
|
$: collapseMsg = collapsed
|
||||||
? tr.changeNotetypeExpand()
|
? tr.changeNotetypeExpand()
|
||||||
|
|
|
@ -3,15 +3,16 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import { marked } from "marked";
|
import { marked } from "marked";
|
||||||
import { ChangeNotetypeState, MapContext } from "./lib";
|
|
||||||
|
import Col from "../components/Col.svelte";
|
||||||
import Container from "../components/Container.svelte";
|
import Container from "../components/Container.svelte";
|
||||||
import Row from "../components/Row.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import Col from "../components/Col.svelte";
|
import * as tr from "../lib/ftl";
|
||||||
|
import { ChangeNotetypeState, MapContext } from "./lib";
|
||||||
|
import Mapper from "./Mapper.svelte";
|
||||||
import NotetypeSelector from "./NotetypeSelector.svelte";
|
import NotetypeSelector from "./NotetypeSelector.svelte";
|
||||||
import StickyHeader from "./StickyHeader.svelte";
|
import StickyHeader from "./StickyHeader.svelte";
|
||||||
import Mapper from "./Mapper.svelte";
|
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
$: info = state.info;
|
$: info = state.info;
|
||||||
|
|
|
@ -4,14 +4,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Container from "../components/Container.svelte";
|
import Container from "../components/Container.svelte";
|
||||||
import MapperRow from "./MapperRow.svelte";
|
|
||||||
import Spacer from "../components/Spacer.svelte";
|
import Spacer from "../components/Spacer.svelte";
|
||||||
import type { ChangeNotetypeState, MapContext } from "./lib";
|
import type { ChangeNotetypeState, MapContext } from "./lib";
|
||||||
|
import MapperRow from "./MapperRow.svelte";
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
export let ctx: MapContext;
|
export let ctx: MapContext;
|
||||||
|
|
||||||
let info = state.info;
|
const info = state.info;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Spacer --height="0.5rem" />
|
<Spacer --height="0.5rem" />
|
||||||
|
|
|
@ -3,15 +3,15 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
|
import Row from "../components/Row.svelte";
|
||||||
import type { ChangeNotetypeState, MapContext } from "./lib";
|
import type { ChangeNotetypeState, MapContext } from "./lib";
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
export let ctx: MapContext;
|
export let ctx: MapContext;
|
||||||
export let newIndex: number;
|
export let newIndex: number;
|
||||||
|
|
||||||
let info = state.info;
|
const info = state.info;
|
||||||
|
|
||||||
function onChange(evt: Event) {
|
function onChange(evt: Event) {
|
||||||
const oldIdx = parseInt((evt.target as HTMLSelectElement).value, 10);
|
const oldIdx = parseInt((evt.target as HTMLSelectElement).value, 10);
|
||||||
|
|
|
@ -3,20 +3,20 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { ChangeNotetypeState } from "./lib";
|
|
||||||
import StickyContainer from "../components/StickyContainer.svelte";
|
|
||||||
import ButtonToolbar from "../components/ButtonToolbar.svelte";
|
|
||||||
import ButtonGroup from "../components/ButtonGroup.svelte";
|
|
||||||
import LabelButton from "../components/LabelButton.svelte";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
import Badge from "../components/Badge.svelte";
|
||||||
import { arrowRightIcon, arrowLeftIcon } from "./icons";
|
import ButtonGroup from "../components/ButtonGroup.svelte";
|
||||||
|
import ButtonToolbar from "../components/ButtonToolbar.svelte";
|
||||||
|
import LabelButton from "../components/LabelButton.svelte";
|
||||||
import SelectButton from "../components/SelectButton.svelte";
|
import SelectButton from "../components/SelectButton.svelte";
|
||||||
import SelectOption from "../components/SelectOption.svelte";
|
import SelectOption from "../components/SelectOption.svelte";
|
||||||
|
import StickyContainer from "../components/StickyContainer.svelte";
|
||||||
|
import { arrowLeftIcon, arrowRightIcon } from "./icons";
|
||||||
|
import type { ChangeNotetypeState } from "./lib";
|
||||||
import SaveButton from "./SaveButton.svelte";
|
import SaveButton from "./SaveButton.svelte";
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
let notetypes = state.notetypes;
|
const notetypes = state.notetypes;
|
||||||
let info = state.info;
|
const info = state.info;
|
||||||
|
|
||||||
async function blur(event: Event): Promise<void> {
|
async function blur(event: Event): Promise<void> {
|
||||||
await state.setTargetNotetypeIndex(
|
await state.setTargetNotetypeIndex(
|
||||||
|
|
|
@ -3,13 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import type { ChangeNotetypeState } from "./lib";
|
|
||||||
import { getPlatformString } from "../lib/shortcuts";
|
|
||||||
|
|
||||||
import ButtonGroup from "../components/ButtonGroup.svelte";
|
import ButtonGroup from "../components/ButtonGroup.svelte";
|
||||||
import LabelButton from "../components/LabelButton.svelte";
|
import LabelButton from "../components/LabelButton.svelte";
|
||||||
import Shortcut from "../components/Shortcut.svelte";
|
import Shortcut from "../components/Shortcut.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { getPlatformString } from "../lib/shortcuts";
|
||||||
|
import type { ChangeNotetypeState } from "./lib";
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,22 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
import Badge from "../components/Badge.svelte";
|
||||||
import Alert from "./Alert.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import Container from "../components/Container.svelte";
|
import Container from "../components/Container.svelte";
|
||||||
import Row from "../components/Row.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import Col from "../components/Col.svelte";
|
import StickyContainer from "../components/StickyContainer.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import Alert from "./Alert.svelte";
|
||||||
import { exclamationIcon } from "./icons";
|
import { exclamationIcon } from "./icons";
|
||||||
import { ChangeNotetypeState, MapContext } from "./lib";
|
import { ChangeNotetypeState, MapContext } from "./lib";
|
||||||
import StickyContainer from "../components/StickyContainer.svelte";
|
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
export let ctx: MapContext;
|
export let ctx: MapContext;
|
||||||
|
|
||||||
$: info = state.info;
|
$: info = state.info;
|
||||||
|
|
||||||
let heading: string =
|
const heading: string =
|
||||||
ctx === MapContext.Field
|
ctx === MapContext.Field
|
||||||
? tr.changeNotetypeFields()
|
? tr.changeNotetypeFields()
|
||||||
: tr.changeNotetypeTemplates();
|
: tr.changeNotetypeTemplates();
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
/// <reference types="../lib/image-import" />
|
/// <reference types="../lib/image-import" />
|
||||||
|
|
||||||
export { default as arrowRightIcon } from "bootstrap-icons/icons/arrow-right.svg";
|
|
||||||
export { default as arrowLeftIcon } from "bootstrap-icons/icons/arrow-left.svg";
|
export { default as arrowLeftIcon } from "bootstrap-icons/icons/arrow-left.svg";
|
||||||
|
export { default as arrowRightIcon } from "bootstrap-icons/icons/arrow-right.svg";
|
||||||
|
export { default as minusIcon } from "bootstrap-icons/icons/dash-lg.svg";
|
||||||
export { default as exclamationIcon } from "bootstrap-icons/icons/exclamation-circle.svg";
|
export { default as exclamationIcon } from "bootstrap-icons/icons/exclamation-circle.svg";
|
||||||
export { default as plusIcon } from "bootstrap-icons/icons/plus-lg.svg";
|
export { default as plusIcon } from "bootstrap-icons/icons/plus-lg.svg";
|
||||||
export { default as minusIcon } from "bootstrap-icons/icons/dash-lg.svg";
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
||||||
import { notetypes, empty } from "../lib/proto";
|
|
||||||
import { checkNightMode } from "../lib/nightmode";
|
|
||||||
import { ChangeNotetypeState } from "./lib";
|
|
||||||
|
|
||||||
import ChangeNotetypePage from "./ChangeNotetypePage.svelte";
|
|
||||||
import "./change-notetype-base.css";
|
import "./change-notetype-base.css";
|
||||||
|
|
||||||
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
||||||
|
import { checkNightMode } from "../lib/nightmode";
|
||||||
|
import { empty, notetypes } from "../lib/proto";
|
||||||
|
import ChangeNotetypePage from "./ChangeNotetypePage.svelte";
|
||||||
|
import { ChangeNotetypeState } from "./lib";
|
||||||
|
|
||||||
const notetypeNames = notetypes.getNotetypeNames(empty);
|
const notetypeNames = notetypes.getNotetypeNames(empty);
|
||||||
const i18n = setupI18n({
|
const i18n = setupI18n({
|
||||||
modules: [ModuleName.ACTIONS, ModuleName.CHANGE_NOTETYPE, ModuleName.KEYBOARD],
|
modules: [ModuleName.ACTIONS, ModuleName.CHANGE_NOTETYPE, ModuleName.KEYBOARD],
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeNotetypeState, negativeOneToNull, MapContext } from "./lib";
|
|
||||||
import { Notetypes } from "../lib/proto";
|
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
|
import { Notetypes } from "../lib/proto";
|
||||||
|
import { ChangeNotetypeState, MapContext, negativeOneToNull } from "./lib";
|
||||||
|
|
||||||
const exampleNames = {
|
const exampleNames = {
|
||||||
entries: [
|
entries: [
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import { notetypes, Notetypes } from "../lib/proto";
|
|
||||||
import { readable, Readable } from "svelte/store";
|
|
||||||
import { isEqual } from "lodash-es";
|
import { isEqual } from "lodash-es";
|
||||||
|
import { Readable, readable } from "svelte/store";
|
||||||
|
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { Notetypes, notetypes } from "../lib/proto";
|
||||||
|
|
||||||
function nullToNegativeOne(list: (number | null)[]): number[] {
|
function nullToNegativeOne(list: (number | null)[]): number[] {
|
||||||
return list.map((val) => val ?? -1);
|
return list.map((val) => val ?? -1);
|
||||||
|
|
|
@ -3,10 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import IconConstrain from "./IconConstrain.svelte";
|
import { createEventDispatcher, getContext, onMount } from "svelte";
|
||||||
import type { DropdownProps } from "./dropdown";
|
|
||||||
import { dropdownKey } from "./context-keys";
|
import { dropdownKey } from "./context-keys";
|
||||||
import { onMount, createEventDispatcher, getContext } from "svelte";
|
import type { DropdownProps } from "./dropdown";
|
||||||
|
import IconConstrain from "./IconConstrain.svelte";
|
||||||
|
|
||||||
let className = "";
|
let className = "";
|
||||||
export { className as class };
|
export { className as class };
|
||||||
|
|
|
@ -4,9 +4,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { setContext } from "svelte";
|
import { setContext } from "svelte";
|
||||||
import { dropdownKey } from "./context-keys";
|
|
||||||
|
|
||||||
import ButtonToolbar from "./ButtonToolbar.svelte";
|
import ButtonToolbar from "./ButtonToolbar.svelte";
|
||||||
|
import { dropdownKey } from "./context-keys";
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
let className = "";
|
let className = "";
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
import { writable, get } from "svelte/store";
|
|
||||||
import contextProperty from "../sveltelib/context-property";
|
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
|
import { get, writable } from "svelte/store";
|
||||||
|
|
||||||
|
import contextProperty from "../sveltelib/context-property";
|
||||||
import type {
|
import type {
|
||||||
SlotHostProps,
|
|
||||||
GetSlotHostProps,
|
GetSlotHostProps,
|
||||||
|
SlotHostProps,
|
||||||
} from "../sveltelib/dynamic-slotting";
|
} from "../sveltelib/dynamic-slotting";
|
||||||
|
|
||||||
enum ButtonPosition {
|
enum ButtonPosition {
|
||||||
|
|
|
@ -3,7 +3,7 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
let inputRef: HTMLInputElement;
|
let inputRef: HTMLInputElement;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
|
|
|
@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { setContext } from "svelte";
|
import { setContext } from "svelte";
|
||||||
|
|
||||||
import { dropdownKey } from "./context-keys";
|
import { dropdownKey } from "./context-keys";
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
|
|
|
@ -3,15 +3,14 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type Item from "./Item.svelte";
|
|
||||||
import type ButtonGroupItem from "./ButtonGroupItem.svelte";
|
|
||||||
/* import type { SlotHostProps } from "../sveltelib/dynamic-slotting"; */
|
/* import type { SlotHostProps } from "../sveltelib/dynamic-slotting"; */
|
||||||
|
|
||||||
import dynamicSlotting, {
|
import dynamicSlotting, {
|
||||||
defaultProps,
|
|
||||||
defaultInterface,
|
defaultInterface,
|
||||||
|
defaultProps,
|
||||||
setSlotHostContext as defaultContext,
|
setSlotHostContext as defaultContext,
|
||||||
} from "../sveltelib/dynamic-slotting";
|
} from "../sveltelib/dynamic-slotting";
|
||||||
|
import type ButtonGroupItem from "./ButtonGroupItem.svelte";
|
||||||
|
import type Item from "./Item.svelte";
|
||||||
|
|
||||||
function id<T>(value: T): T {
|
function id<T>(value: T): T {
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -3,11 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import IconConstrain from "./IconConstrain.svelte";
|
import { createEventDispatcher, getContext, onMount } from "svelte";
|
||||||
import { getContext, onMount, createEventDispatcher } from "svelte";
|
|
||||||
import { dropdownKey } from "./context-keys";
|
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
|
import { dropdownKey } from "./context-keys";
|
||||||
import type { DropdownProps } from "./dropdown";
|
import type { DropdownProps } from "./dropdown";
|
||||||
|
import IconConstrain from "./IconConstrain.svelte";
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
let className = "";
|
let className = "";
|
||||||
|
|
|
@ -3,10 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext, onMount } from "svelte";
|
||||||
|
|
||||||
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
import { dropdownKey } from "./context-keys";
|
import { dropdownKey } from "./context-keys";
|
||||||
import type { DropdownProps } from "./dropdown";
|
import type { DropdownProps } from "./dropdown";
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
let className: string = "";
|
let className: string = "";
|
||||||
|
|
|
@ -3,9 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
let rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
|
|
||||||
|
const rtl: boolean = window.getComputedStyle(document.body).direction == "rtl";
|
||||||
|
|
||||||
export let id: string | undefined = undefined;
|
export let id: string | undefined = undefined;
|
||||||
let className = "";
|
let className = "";
|
||||||
|
|
|
@ -4,8 +4,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher, onMount } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
import { registerShortcut } from "../lib/shortcuts";
|
|
||||||
import { preventDefault } from "../lib/events";
|
import { preventDefault } from "../lib/events";
|
||||||
|
import { registerShortcut } from "../lib/shortcuts";
|
||||||
|
|
||||||
export let keyCombination: string;
|
export let keyCombination: string;
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Readable } from "svelte/store";
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
import type { Readable } from "svelte/store";
|
||||||
|
|
||||||
type T = boolean;
|
type T = boolean;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Dropdown from "bootstrap/js/dist/dropdown";
|
import Dropdown from "bootstrap/js/dist/dropdown";
|
||||||
|
import { onDestroy, setContext } from "svelte";
|
||||||
|
|
||||||
import { setContext, onDestroy } from "svelte";
|
|
||||||
import { dropdownKey } from "./context-keys";
|
import { dropdownKey } from "./context-keys";
|
||||||
|
|
||||||
export let autoOpen = false;
|
export let autoOpen = false;
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy } from "svelte";
|
|
||||||
import Tooltip from "bootstrap/js/dist/tooltip";
|
import Tooltip from "bootstrap/js/dist/tooltip";
|
||||||
|
import { onDestroy } from "svelte";
|
||||||
|
|
||||||
type TriggerType =
|
type TriggerType =
|
||||||
| "hover focus"
|
| "hover focus"
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
let previousTooltip: string = tooltip;
|
let previousTooltip: string = tooltip;
|
||||||
$: if (tooltip !== previousTooltip) {
|
$: if (tooltip !== previousTooltip) {
|
||||||
previousTooltip = tooltip;
|
previousTooltip = tooltip;
|
||||||
let element: HTMLElement = tooltipObject["_element"];
|
const element: HTMLElement = tooltipObject["_element"];
|
||||||
tooltipObject.dispose();
|
tooltipObject.dispose();
|
||||||
createTooltip(element);
|
createTooltip(element);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Container from "../components/Container.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import type { Scheduler } from "../lib/proto";
|
import Container from "../components/Container.svelte";
|
||||||
import { buildNextLearnMsg } from "./lib";
|
|
||||||
import { bridgeLink } from "../lib/bridgecommand";
|
import { bridgeLink } from "../lib/bridgecommand";
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
|
import type { Scheduler } from "../lib/proto";
|
||||||
|
import { buildNextLearnMsg } from "./lib";
|
||||||
|
|
||||||
export let info: Scheduler.CongratsInfoResponse;
|
export let info: Scheduler.CongratsInfoResponse;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { scheduler, empty } from "../lib/proto";
|
|
||||||
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
||||||
import { checkNightMode } from "../lib/nightmode";
|
|
||||||
|
|
||||||
import CongratsPage from "./CongratsPage.svelte";
|
|
||||||
import "./congrats-base.css";
|
import "./congrats-base.css";
|
||||||
|
|
||||||
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
||||||
|
import { checkNightMode } from "../lib/nightmode";
|
||||||
|
import { empty, scheduler } from "../lib/proto";
|
||||||
|
import CongratsPage from "./CongratsPage.svelte";
|
||||||
|
|
||||||
const i18n = setupI18n({ modules: [ModuleName.SCHEDULING] });
|
const i18n = setupI18n({ modules: [ModuleName.SCHEDULING] });
|
||||||
|
|
||||||
export async function setupCongrats(): Promise<CongratsPage> {
|
export async function setupCongrats(): Promise<CongratsPage> {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
import type { Scheduler } from "../lib/proto";
|
import type { Scheduler } from "../lib/proto";
|
||||||
import { naturalUnit, unitAmount, unitName } from "../lib/time";
|
import { naturalUnit, unitAmount, unitName } from "../lib/time";
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
|
|
||||||
export function buildNextLearnMsg(info: Scheduler.CongratsInfoResponse): string {
|
export function buildNextLearnMsg(info: Scheduler.CongratsInfoResponse): string {
|
||||||
const secsUntil = info.secsUntilNextLearn;
|
const secsUntil = info.secsUntilNextLearn;
|
||||||
|
|
|
@ -3,12 +3,12 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
|
|
||||||
let components = state.addonComponents;
|
const components = state.addonComponents;
|
||||||
const auxData = state.currentAuxData;
|
const auxData = state.currentAuxData;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,21 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
||||||
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import CardStateCustomizer from "./CardStateCustomizer.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import CardStateCustomizer from "./CardStateCustomizer.svelte";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
let cardStateCustomizer = state.cardStateCustomizer;
|
const cardStateCustomizer = state.cardStateCustomizer;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigAdvancedTitle()}>
|
<TitledContainer title={tr.deckConfigAdvancedTitle()}>
|
||||||
|
|
|
@ -3,18 +3,18 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import SwitchRow from "./SwitchRow.svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SwitchRow from "./SwitchRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigAudioTitle()}>
|
<TitledContainer title={tr.deckConfigAudioTitle()}>
|
||||||
|
|
|
@ -3,18 +3,18 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import SwitchRow from "./SwitchRow.svelte";
|
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SwitchRow from "./SwitchRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigBuryTitle()}>
|
<TitledContainer title={tr.deckConfigBuryTitle()}>
|
||||||
|
|
|
@ -3,11 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: string;
|
export let value: string;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,23 +3,23 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import { getContext } from "svelte";
|
|
||||||
import { modalsKey } from "../components/context-keys";
|
|
||||||
import type { DeckOptionsState, ConfigListEntry } from "./lib";
|
|
||||||
import type Modal from "bootstrap/js/dist/modal";
|
import type Modal from "bootstrap/js/dist/modal";
|
||||||
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
import TextInputModal from "./TextInputModal.svelte";
|
|
||||||
import StickyContainer from "../components/StickyContainer.svelte";
|
|
||||||
import ButtonToolbar from "../components/ButtonToolbar.svelte";
|
|
||||||
import ButtonGroup from "../components/ButtonGroup.svelte";
|
import ButtonGroup from "../components/ButtonGroup.svelte";
|
||||||
|
import ButtonToolbar from "../components/ButtonToolbar.svelte";
|
||||||
|
import { modalsKey } from "../components/context-keys";
|
||||||
import SelectButton from "../components/SelectButton.svelte";
|
import SelectButton from "../components/SelectButton.svelte";
|
||||||
import SelectOption from "../components/SelectOption.svelte";
|
import SelectOption from "../components/SelectOption.svelte";
|
||||||
|
import StickyContainer from "../components/StickyContainer.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { noop } from "../lib/functional";
|
||||||
|
import type { ConfigListEntry, DeckOptionsState } from "./lib";
|
||||||
import SaveButton from "./SaveButton.svelte";
|
import SaveButton from "./SaveButton.svelte";
|
||||||
|
import TextInputModal from "./TextInputModal.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
let configList = state.configList;
|
const configList = state.configList;
|
||||||
|
|
||||||
function configLabel(entry: ConfigListEntry): string {
|
function configLabel(entry: ConfigListEntry): string {
|
||||||
const count = tr.deckConfigUsedByDecks({ decks: entry.useCount });
|
const count = tr.deckConfigUsedByDecks({ decks: entry.useCount });
|
||||||
|
@ -53,7 +53,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let modalKey: string;
|
let modalKey: string;
|
||||||
let modalStartingValue = "";
|
let modalStartingValue = "";
|
||||||
let modalTitle = "";
|
let modalTitle = "";
|
||||||
let modalSuccess = (_text: string) => {};
|
let modalSuccess: (text: string) => void = noop;
|
||||||
|
|
||||||
function promptToAdd() {
|
function promptToAdd() {
|
||||||
modalTitle = tr.deckConfigAddGroup();
|
modalTitle = tr.deckConfigAddGroup();
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
import * as tr from "../lib/ftl";
|
||||||
import Warning from "./Warning.svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
import Warning from "./Warning.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
let parentLimits = state.parentLimits;
|
const parentLimits = state.parentLimits;
|
||||||
|
|
||||||
const v3Extra = state.v3Scheduler
|
const v3Extra = state.v3Scheduler
|
||||||
? "\n\n" +
|
? "\n\n" +
|
||||||
|
|
|
@ -3,28 +3,28 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ConfigSelector from "./ConfigSelector.svelte";
|
import type { Writable } from "svelte/store";
|
||||||
|
|
||||||
import Container from "../components/Container.svelte";
|
import Container from "../components/Container.svelte";
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import DailyLimits from "./DailyLimits.svelte";
|
|
||||||
import DisplayOrder from "./DisplayOrder.svelte";
|
|
||||||
import NewOptions from "./NewOptions.svelte";
|
|
||||||
import AdvancedOptions from "./AdvancedOptions.svelte";
|
|
||||||
import BuryOptions from "./BuryOptions.svelte";
|
|
||||||
import LapseOptions from "./LapseOptions.svelte";
|
|
||||||
import TimerOptions from "./TimerOptions.svelte";
|
|
||||||
import AudioOptions from "./AudioOptions.svelte";
|
|
||||||
import Addons from "./Addons.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
import Row from "../components/Row.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import type { Writable } from "svelte/store";
|
|
||||||
import HtmlAddon from "./HtmlAddon.svelte";
|
|
||||||
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
||||||
|
import Addons from "./Addons.svelte";
|
||||||
|
import AdvancedOptions from "./AdvancedOptions.svelte";
|
||||||
|
import AudioOptions from "./AudioOptions.svelte";
|
||||||
|
import BuryOptions from "./BuryOptions.svelte";
|
||||||
|
import ConfigSelector from "./ConfigSelector.svelte";
|
||||||
|
import DailyLimits from "./DailyLimits.svelte";
|
||||||
|
import DisplayOrder from "./DisplayOrder.svelte";
|
||||||
|
import HtmlAddon from "./HtmlAddon.svelte";
|
||||||
|
import LapseOptions from "./LapseOptions.svelte";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import NewOptions from "./NewOptions.svelte";
|
||||||
|
import TimerOptions from "./TimerOptions.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
let addons = state.addonComponents;
|
const addons = state.addonComponents;
|
||||||
|
|
||||||
export function auxData(): Writable<Record<string, unknown>> {
|
export function auxData(): Writable<Record<string, unknown>> {
|
||||||
return state.currentAuxData;
|
return state.currentAuxData;
|
||||||
|
|
|
@ -3,22 +3,21 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
import { reviewMixChoices } from "./strings";
|
import { reviewMixChoices } from "./strings";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
|
|
||||||
let currentDeck = "\n\n" + tr.deckConfigDisplayOrderWillUseCurrentDeck();
|
const currentDeck = "\n\n" + tr.deckConfigDisplayOrderWillUseCurrentDeck();
|
||||||
|
|
||||||
const newGatherPriorityChoices = [
|
const newGatherPriorityChoices = [
|
||||||
tr.deckConfigNewGatherPriorityDeck(),
|
tr.deckConfigNewGatherPriorityDeck(),
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Breakpoint } from "../components/types";
|
|
||||||
|
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
|
import type { Breakpoint } from "../components/types";
|
||||||
import EnumSelector from "./EnumSelector.svelte";
|
import EnumSelector from "./EnumSelector.svelte";
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let defaultValue: number;
|
export let defaultValue: number;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
let forId: string;
|
let forId: string;
|
||||||
export { forId as for };
|
export { forId as for };
|
||||||
|
|
|
@ -3,21 +3,21 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
import StepsInputRow from "./StepsInputRow.svelte";
|
import * as tr from "../lib/ftl";
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
||||||
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
||||||
import Warning from "./Warning.svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
|
import StepsInputRow from "./StepsInputRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
import Warning from "./Warning.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api = {};
|
export let api = {};
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
|
|
||||||
let stepsExceedMinimumInterval: string;
|
let stepsExceedMinimumInterval: string;
|
||||||
$: {
|
$: {
|
||||||
|
|
|
@ -3,22 +3,21 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import StepsInputRow from "./StepsInputRow.svelte";
|
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
||||||
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
|
||||||
import Warning from "./Warning.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
|
import StepsInputRow from "./StepsInputRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
import Warning from "./Warning.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api = {};
|
export let api = {};
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
|
|
||||||
const newInsertOrderChoices = [
|
const newInsertOrderChoices = [
|
||||||
tr.deckConfigNewInsertionOrderSequential(),
|
tr.deckConfigNewInsertionOrderSequential(),
|
||||||
|
|
|
@ -3,17 +3,18 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import type Dropdown from "bootstrap/js/dist/dropdown";
|
import type Dropdown from "bootstrap/js/dist/dropdown";
|
||||||
import WithDropdown from "../components/WithDropdown.svelte";
|
import { cloneDeep, isEqual as isEqualLodash } from "lodash-es";
|
||||||
import DropdownMenu from "../components/DropdownMenu.svelte";
|
|
||||||
import DropdownItem from "../components/DropdownItem.svelte";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
|
||||||
import { revertIcon } from "./icons";
|
|
||||||
import { isEqual as isEqualLodash, cloneDeep } from "lodash-es";
|
|
||||||
import { touchDeviceKey } from "../components/context-keys";
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
|
||||||
|
import Badge from "../components/Badge.svelte";
|
||||||
|
import { touchDeviceKey } from "../components/context-keys";
|
||||||
|
import DropdownItem from "../components/DropdownItem.svelte";
|
||||||
|
import DropdownMenu from "../components/DropdownMenu.svelte";
|
||||||
|
import WithDropdown from "../components/WithDropdown.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { revertIcon } from "./icons";
|
||||||
|
|
||||||
type T = unknown;
|
type T = unknown;
|
||||||
|
|
||||||
export let value: T;
|
export let value: T;
|
||||||
|
|
|
@ -3,20 +3,20 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
import type { DeckOptionsState } from "./lib";
|
|
||||||
import type Dropdown from "bootstrap/js/dist/dropdown";
|
import type Dropdown from "bootstrap/js/dist/dropdown";
|
||||||
import { getPlatformString } from "../lib/shortcuts";
|
import { createEventDispatcher } from "svelte";
|
||||||
import { withCollapsedWhitespace } from "../lib/i18n";
|
|
||||||
|
|
||||||
import ButtonGroup from "../components/ButtonGroup.svelte";
|
import ButtonGroup from "../components/ButtonGroup.svelte";
|
||||||
import LabelButton from "../components/LabelButton.svelte";
|
|
||||||
import DropdownMenu from "../components/DropdownMenu.svelte";
|
|
||||||
import DropdownItem from "../components/DropdownItem.svelte";
|
|
||||||
import DropdownDivider from "../components/DropdownDivider.svelte";
|
import DropdownDivider from "../components/DropdownDivider.svelte";
|
||||||
import WithDropdown from "../components/WithDropdown.svelte";
|
import DropdownItem from "../components/DropdownItem.svelte";
|
||||||
|
import DropdownMenu from "../components/DropdownMenu.svelte";
|
||||||
|
import LabelButton from "../components/LabelButton.svelte";
|
||||||
import Shortcut from "../components/Shortcut.svelte";
|
import Shortcut from "../components/Shortcut.svelte";
|
||||||
|
import WithDropdown from "../components/WithDropdown.svelte";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
|
import { withCollapsedWhitespace } from "../lib/i18n";
|
||||||
|
import { getPlatformString } from "../lib/shortcuts";
|
||||||
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
|
||||||
import { localizedNumber } from "../lib/i18n";
|
import { localizedNumber } from "../lib/i18n";
|
||||||
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
|
|
||||||
export let value: number;
|
export let value: number;
|
||||||
export let min = 1;
|
export let min = 1;
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import SpinBoxFloat from "./SpinBoxFloat.svelte";
|
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import SpinBoxFloat from "./SpinBoxFloat.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: any;
|
export let value: any;
|
||||||
export let defaultValue: any;
|
export let defaultValue: any;
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import SpinBox from "./SpinBox.svelte";
|
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import SpinBox from "./SpinBox.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: any;
|
export let value: any;
|
||||||
export let defaultValue: any;
|
export let defaultValue: any;
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import StepsInput from "./StepsInput.svelte";
|
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import StepsInput from "./StepsInput.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: any;
|
export let value: any;
|
||||||
export let defaultValue: any;
|
export let defaultValue: any;
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Row from "../components/Row.svelte";
|
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
|
import Row from "../components/Row.svelte";
|
||||||
import Label from "./Label.svelte";
|
import Label from "./Label.svelte";
|
||||||
import TooltipLabel from "./TooltipLabel.svelte";
|
|
||||||
import Switch from "./Switch.svelte";
|
|
||||||
import RevertButton from "./RevertButton.svelte";
|
import RevertButton from "./RevertButton.svelte";
|
||||||
|
import Switch from "./Switch.svelte";
|
||||||
|
import TooltipLabel from "./TooltipLabel.svelte";
|
||||||
|
|
||||||
export let value: boolean;
|
export let value: boolean;
|
||||||
export let defaultValue: boolean;
|
export let defaultValue: boolean;
|
||||||
|
|
|
@ -3,10 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy, getContext } from "svelte";
|
import Modal from "bootstrap/js/dist/modal";
|
||||||
|
import { getContext, onDestroy, onMount } from "svelte";
|
||||||
|
|
||||||
import { modalsKey } from "../components/context-keys";
|
import { modalsKey } from "../components/context-keys";
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
import Modal from "bootstrap/js/dist/modal";
|
|
||||||
|
|
||||||
export let title: string;
|
export let title: string;
|
||||||
export let prompt: string;
|
export let prompt: string;
|
||||||
|
|
|
@ -3,19 +3,19 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
import DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
||||||
import Item from "../components/Item.svelte";
|
import Item from "../components/Item.svelte";
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
||||||
import SwitchRow from "./SwitchRow.svelte";
|
|
||||||
import * as tr from "../lib/ftl";
|
import * as tr from "../lib/ftl";
|
||||||
import type { DeckOptionsState } from "./lib";
|
import type { DeckOptionsState } from "./lib";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
|
import SwitchRow from "./SwitchRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export let state: DeckOptionsState;
|
export let state: DeckOptionsState;
|
||||||
export let api: Record<string, never>;
|
export let api: Record<string, never>;
|
||||||
|
|
||||||
let config = state.currentConfig;
|
const config = state.currentConfig;
|
||||||
let defaults = state.defaults;
|
const defaults = state.defaults;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<TitledContainer title={tr.deckConfigTimerTitle()}>
|
<TitledContainer title={tr.deckConfigTimerTitle()}>
|
||||||
|
|
|
@ -4,10 +4,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { marked } from "marked";
|
import { marked } from "marked";
|
||||||
import { infoCircle } from "./icons";
|
|
||||||
import WithTooltip from "../components/WithTooltip.svelte";
|
|
||||||
import Label from "./Label.svelte";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
import Badge from "../components/Badge.svelte";
|
||||||
|
import WithTooltip from "../components/WithTooltip.svelte";
|
||||||
|
import { infoCircle } from "./icons";
|
||||||
|
import Label from "./Label.svelte";
|
||||||
|
|
||||||
export let markdownTooltip: string;
|
export let markdownTooltip: string;
|
||||||
let forId: string | undefined = undefined;
|
let forId: string | undefined = undefined;
|
||||||
|
|
|
@ -4,8 +4,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { slide } from "svelte/transition";
|
import { slide } from "svelte/transition";
|
||||||
|
|
||||||
import Row from "../components/Row.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import { withoutUnicodeIsolation } from "../lib/i18n/";
|
import { withoutUnicodeIsolation } from "../lib/i18n";
|
||||||
|
|
||||||
export let warning: string;
|
export let warning: string;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
|
|
||||||
// Import icons from bootstrap
|
// Import icons from bootstrap
|
||||||
export { default as revertIcon } from "bootstrap-icons/icons/arrow-counterclockwise.svg";
|
export { default as revertIcon } from "bootstrap-icons/icons/arrow-counterclockwise.svg";
|
||||||
export { default as infoCircle } from "bootstrap-icons/icons/info-circle.svg";
|
|
||||||
export { default as gearIcon } from "bootstrap-icons/icons/gear.svg";
|
export { default as gearIcon } from "bootstrap-icons/icons/gear.svg";
|
||||||
|
export { default as infoCircle } from "bootstrap-icons/icons/info-circle.svg";
|
||||||
|
|
|
@ -6,16 +6,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "../sveltelib/export-runtime";
|
import "../sveltelib/export-runtime";
|
||||||
|
|
||||||
import { DeckOptionsState } from "./lib";
|
|
||||||
import { setupI18n, ModuleName } from "../lib/i18n";
|
|
||||||
import { deckConfig } from "../lib/proto";
|
|
||||||
import { checkNightMode } from "../lib/nightmode";
|
|
||||||
import { touchDeviceKey, modalsKey } from "../components/context-keys";
|
|
||||||
|
|
||||||
import DeckOptionsPage from "./DeckOptionsPage.svelte";
|
|
||||||
import "./deck-options-base.css";
|
import "./deck-options-base.css";
|
||||||
|
|
||||||
|
import { modalsKey, touchDeviceKey } from "../components/context-keys";
|
||||||
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
||||||
|
import { checkNightMode } from "../lib/nightmode";
|
||||||
|
import { deckConfig } from "../lib/proto";
|
||||||
|
import DeckOptionsPage from "./DeckOptionsPage.svelte";
|
||||||
|
import { DeckOptionsState } from "./lib";
|
||||||
|
|
||||||
const i18n = setupI18n({
|
const i18n = setupI18n({
|
||||||
modules: [
|
modules: [
|
||||||
ModuleName.SCHEDULING,
|
ModuleName.SCHEDULING,
|
||||||
|
@ -45,11 +44,11 @@ export async function setupDeckOptions(did: number): Promise<DeckOptionsPage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
import TitledContainer from "./TitledContainer.svelte";
|
|
||||||
import SpinBoxRow from "./SpinBoxRow.svelte";
|
|
||||||
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
|
||||||
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
||||||
|
import SpinBoxFloatRow from "./SpinBoxFloatRow.svelte";
|
||||||
|
import SpinBoxRow from "./SpinBoxRow.svelte";
|
||||||
import SwitchRow from "./SwitchRow.svelte";
|
import SwitchRow from "./SwitchRow.svelte";
|
||||||
|
import TitledContainer from "./TitledContainer.svelte";
|
||||||
|
|
||||||
export const components = {
|
export const components = {
|
||||||
TitledContainer,
|
TitledContainer,
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
@typescript-eslint/no-explicit-any: "off",
|
@typescript-eslint/no-explicit-any: "off",
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
import { DeckConfig } from "../lib/proto";
|
import { DeckConfig } from "../lib/proto";
|
||||||
import { DeckOptionsState } from "./lib";
|
import { DeckOptionsState } from "./lib";
|
||||||
import { get } from "svelte/store";
|
|
||||||
|
|
||||||
const exampleData = {
|
const exampleData = {
|
||||||
allConfig: [
|
allConfig: [
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { DeckConfig, deckConfig } from "../lib/proto";
|
import { cloneDeep, isEqual } from "lodash-es";
|
||||||
import { Writable, writable, get, Readable, readable } from "svelte/store";
|
import { get, Readable, readable, Writable, writable } from "svelte/store";
|
||||||
import { isEqual, cloneDeep } from "lodash-es";
|
|
||||||
import { localeCompare } from "../lib/i18n";
|
import { localeCompare } from "../lib/i18n";
|
||||||
|
import { DeckConfig, deckConfig } from "../lib/proto";
|
||||||
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
import type { DynamicSvelteComponent } from "../sveltelib/dynamicComponent";
|
||||||
|
|
||||||
export type DeckOptionsId = number;
|
export type DeckOptionsId = number;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { TimespanUnit, naturalWholeUnit, unitAmount, unitSeconds } from "../lib/time";
|
import { naturalWholeUnit, TimespanUnit, unitAmount, unitSeconds } from "../lib/time";
|
||||||
|
|
||||||
function unitSuffix(unit: TimespanUnit): string {
|
function unitSuffix(unit: TimespanUnit): string {
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
export * from "./location";
|
export * from "./location";
|
||||||
export * from "./surround";
|
|
||||||
export * from "./move-nodes";
|
export * from "./move-nodes";
|
||||||
export * from "./place-caret";
|
export * from "./place-caret";
|
||||||
|
export * from "./surround";
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import { getSelection } from "../../lib/cross-browser";
|
||||||
|
import { findNodeFromCoordinates } from "./node";
|
||||||
import type { SelectionLocation, SelectionLocationContent } from "./selection";
|
import type { SelectionLocation, SelectionLocationContent } from "./selection";
|
||||||
import { getSelectionLocation } from "./selection";
|
import { getSelectionLocation } from "./selection";
|
||||||
import { findNodeFromCoordinates } from "./node";
|
|
||||||
import { getSelection } from "../../lib/cross-browser";
|
|
||||||
|
|
||||||
export function saveSelection(base: Node): SelectionLocation | null {
|
export function saveSelection(base: Node): SelectionLocation | null {
|
||||||
return getSelectionLocation(base);
|
return getSelectionLocation(base);
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { registerPackage } from "../../lib/runtime-require";
|
import { registerPackage } from "../../lib/runtime-require";
|
||||||
|
import { restoreSelection, saveSelection } from "./document";
|
||||||
import { saveSelection, restoreSelection } from "./document";
|
|
||||||
import { Position } from "./location";
|
import { Position } from "./location";
|
||||||
|
|
||||||
registerPackage("anki/location", {
|
registerPackage("anki/location", {
|
||||||
|
@ -12,5 +11,5 @@ registerPackage("anki/location", {
|
||||||
Position,
|
Position,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { saveSelection, restoreSelection, Position };
|
export { Position, restoreSelection, saveSelection };
|
||||||
export type { SelectionLocation } from "./selection";
|
export type { SelectionLocation } from "./selection";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { getNodeCoordinates } from "./node";
|
|
||||||
import type { CaretLocation } from "./location";
|
import type { CaretLocation } from "./location";
|
||||||
|
import { getNodeCoordinates } from "./node";
|
||||||
|
|
||||||
interface RangeCoordinatesCollapsed {
|
interface RangeCoordinatesCollapsed {
|
||||||
readonly start: CaretLocation;
|
readonly start: CaretLocation;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { getNodeCoordinates } from "./node";
|
import { getRange, getSelection } from "../../lib/cross-browser";
|
||||||
import type { CaretLocation } from "./location";
|
import type { CaretLocation } from "./location";
|
||||||
import { compareLocations, Position } from "./location";
|
import { compareLocations, Position } from "./location";
|
||||||
import { getSelection, getRange } from "../../lib/cross-browser";
|
import { getNodeCoordinates } from "./node";
|
||||||
|
|
||||||
export interface SelectionLocationCollapsed {
|
export interface SelectionLocationCollapsed {
|
||||||
readonly anchor: CaretLocation;
|
readonly anchor: CaretLocation;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { ascend, isOnlyChild } from "../../lib/node";
|
|
||||||
import { elementIsBlock } from "../../lib/dom";
|
import { elementIsBlock } from "../../lib/dom";
|
||||||
|
import { ascend, isOnlyChild } from "../../lib/node";
|
||||||
|
|
||||||
export function ascendWhileSingleInline(node: Node, base: Node): Node {
|
export function ascendWhileSingleInline(node: Node, base: Node): Node {
|
||||||
if (node === base) {
|
if (node === base) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import { elementIsEmpty, nodeIsElement } from "../../lib/dom";
|
||||||
import { ascend } from "../../lib/node";
|
import { ascend } from "../../lib/node";
|
||||||
import { nodeIsElement, elementIsEmpty } from "../../lib/dom";
|
|
||||||
|
|
||||||
export interface ChildNodeRange {
|
export interface ChildNodeRange {
|
||||||
parent: Node;
|
parent: Node;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { nodeIsElement } from "../../lib/dom";
|
import { nodeIsElement } from "../../lib/dom";
|
||||||
import type { FoundMatch, ElementMatcher } from "./matcher";
|
import type { ElementMatcher, FoundMatch } from "./matcher";
|
||||||
|
|
||||||
export function findClosest(
|
export function findClosest(
|
||||||
node: Node,
|
node: Node,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { findBefore, findAfter } from "./find-adjacent";
|
|
||||||
import { nodeToChildNodeRange } from "./child-node-range";
|
import { nodeToChildNodeRange } from "./child-node-range";
|
||||||
|
import { findAfter, findBefore } from "./find-adjacent";
|
||||||
import { matchTagName } from "./matcher";
|
import { matchTagName } from "./matcher";
|
||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { nodeIsElement, nodeIsText, elementIsEmpty } from "../../lib/dom";
|
import { elementIsEmpty, nodeIsElement, nodeIsText } from "../../lib/dom";
|
||||||
import { hasOnlyChild } from "../../lib/node";
|
import { hasOnlyChild } from "../../lib/node";
|
||||||
import type { ChildNodeRange } from "./child-node-range";
|
import type { ChildNodeRange } from "./child-node-range";
|
||||||
|
import type { ElementMatcher, FoundAdjacent, FoundAlong } from "./matcher";
|
||||||
import { MatchResult } from "./matcher";
|
import { MatchResult } from "./matcher";
|
||||||
import type { ElementMatcher, FoundAlong, FoundAdjacent } from "./matcher";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These functions will not ascend on the starting node, but will descend on the neighbor node
|
* These functions will not ascend on the starting node, but will descend on the neighbor node
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { nodeIsElement } from "../../lib/dom";
|
import { nodeIsElement } from "../../lib/dom";
|
||||||
import { nodeWithinRange } from "./within-range";
|
|
||||||
import type { ChildNodeRange } from "./child-node-range";
|
import type { ChildNodeRange } from "./child-node-range";
|
||||||
import type { FoundMatch, ElementMatcher } from "./matcher";
|
import type { ElementMatcher, FoundMatch } from "./matcher";
|
||||||
|
import { nodeWithinRange } from "./within-range";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elements returned should be in post-order
|
* Elements returned should be in post-order
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { registerPackage } from "../../lib/runtime-require";
|
import { registerPackage } from "../../lib/runtime-require";
|
||||||
|
|
||||||
import { surroundNoSplitting } from "./no-splitting";
|
|
||||||
import { unsurround } from "./unsurround";
|
|
||||||
import { findClosest } from "./find-above";
|
import { findClosest } from "./find-above";
|
||||||
import { MatchResult, matchTagName } from "./matcher";
|
import { MatchResult, matchTagName } from "./matcher";
|
||||||
|
import { surroundNoSplitting } from "./no-splitting";
|
||||||
|
import { unsurround } from "./unsurround";
|
||||||
|
|
||||||
registerPackage("anki/surround", {
|
registerPackage("anki/surround", {
|
||||||
surroundNoSplitting,
|
surroundNoSplitting,
|
||||||
|
@ -16,5 +15,5 @@ registerPackage("anki/surround", {
|
||||||
matchTagName,
|
matchTagName,
|
||||||
});
|
});
|
||||||
|
|
||||||
export { surroundNoSplitting, unsurround, findClosest, MatchResult, matchTagName };
|
export { findClosest, MatchResult, matchTagName, surroundNoSplitting, unsurround };
|
||||||
export type { ElementMatcher, ElementClearer } from "./matcher";
|
export type { ElementClearer, ElementMatcher } from "./matcher";
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import { ascendWhileSingleInline } from "./ascend";
|
||||||
import type { ChildNodeRange } from "./child-node-range";
|
import type { ChildNodeRange } from "./child-node-range";
|
||||||
import {
|
import {
|
||||||
nodeToChildNodeRange,
|
|
||||||
areSiblingChildNodeRanges,
|
areSiblingChildNodeRanges,
|
||||||
mergeChildNodeRanges,
|
|
||||||
coversWholeParent,
|
coversWholeParent,
|
||||||
|
mergeChildNodeRanges,
|
||||||
|
nodeToChildNodeRange,
|
||||||
} from "./child-node-range";
|
} from "./child-node-range";
|
||||||
import { ascendWhileSingleInline } from "./ascend";
|
|
||||||
|
|
||||||
interface MergeMatch {
|
interface MergeMatch {
|
||||||
mismatch: boolean;
|
mismatch: boolean;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { getRangeAnchors } from "./range-anchors";
|
|
||||||
import { nodeWithinRange } from "./within-range";
|
|
||||||
import { findTextNodesWithin } from "./text-node";
|
|
||||||
import {
|
|
||||||
surroundChildNodeRangeWithNode,
|
|
||||||
nodeToChildNodeRange,
|
|
||||||
} from "./child-node-range";
|
|
||||||
import { mergeMatchChildNodeRanges } from "./merge-match";
|
|
||||||
import { ascendWhileSingleInline } from "./ascend";
|
import { ascendWhileSingleInline } from "./ascend";
|
||||||
import { normalizeInsertionRanges } from "./normalize-insertion-ranges";
|
import {
|
||||||
|
nodeToChildNodeRange,
|
||||||
|
surroundChildNodeRangeWithNode,
|
||||||
|
} from "./child-node-range";
|
||||||
|
import type { ElementClearer, ElementMatcher } from "./matcher";
|
||||||
import { matchTagName } from "./matcher";
|
import { matchTagName } from "./matcher";
|
||||||
import type { ElementMatcher, ElementClearer } from "./matcher";
|
import { mergeMatchChildNodeRanges } from "./merge-match";
|
||||||
|
import { normalizeInsertionRanges } from "./normalize-insertion-ranges";
|
||||||
|
import { getRangeAnchors } from "./range-anchors";
|
||||||
|
import { findTextNodesWithin } from "./text-node";
|
||||||
|
import { nodeWithinRange } from "./within-range";
|
||||||
|
|
||||||
export interface NodesResult {
|
export interface NodesResult {
|
||||||
addedNodes: Node[];
|
addedNodes: Node[];
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { findBefore, findAfter } from "./find-adjacent";
|
|
||||||
import { findWithin, findWithinNode } from "./find-within";
|
|
||||||
import { MatchResult } from "./matcher";
|
|
||||||
import type {
|
|
||||||
FoundMatch,
|
|
||||||
ElementMatcher,
|
|
||||||
ElementClearer,
|
|
||||||
FoundAdjacent,
|
|
||||||
} from "./matcher";
|
|
||||||
import type { ChildNodeRange } from "./child-node-range";
|
import type { ChildNodeRange } from "./child-node-range";
|
||||||
|
import { findAfter, findBefore } from "./find-adjacent";
|
||||||
|
import { findWithin, findWithinNode } from "./find-within";
|
||||||
|
import type {
|
||||||
|
ElementClearer,
|
||||||
|
ElementMatcher,
|
||||||
|
FoundAdjacent,
|
||||||
|
FoundMatch,
|
||||||
|
} from "./matcher";
|
||||||
|
import { MatchResult } from "./matcher";
|
||||||
|
|
||||||
function countChildNodesRespectiveToParent(parent: Node, element: Element): number {
|
function countChildNodesRespectiveToParent(parent: Node, element: Element): number {
|
||||||
return element.parentNode === parent ? element.childNodes.length : 1;
|
return element.parentNode === parent ? element.childNodes.length : 1;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { getRangeAnchors } from "./range-anchors";
|
|
||||||
import type { NodesResult, SurroundNoSplittingResult } from "./no-splitting";
|
|
||||||
import { MatchResult, matchTagName } from "./matcher";
|
|
||||||
import type { FoundMatch, ElementMatcher, ElementClearer } from "./matcher";
|
|
||||||
import { findFarthest } from "./find-above";
|
import { findFarthest } from "./find-above";
|
||||||
import { findWithinRange, findWithinNode } from "./find-within";
|
import { findWithinNode, findWithinRange } from "./find-within";
|
||||||
|
import type { ElementClearer, ElementMatcher, FoundMatch } from "./matcher";
|
||||||
|
import { MatchResult, matchTagName } from "./matcher";
|
||||||
|
import type { NodesResult, SurroundNoSplittingResult } from "./no-splitting";
|
||||||
import { surround } from "./no-splitting";
|
import { surround } from "./no-splitting";
|
||||||
|
import { getRangeAnchors } from "./range-anchors";
|
||||||
|
|
||||||
function findBetween(
|
function findBetween(
|
||||||
range: Range,
|
range: Range,
|
||||||
|
|
|
@ -8,15 +8,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
|
|
||||||
import { updateAllState } from "../components/WithState.svelte";
|
import { updateAllState } from "../components/WithState.svelte";
|
||||||
import actionList from "../sveltelib/action-list";
|
import actionList from "../sveltelib/action-list";
|
||||||
|
import type { InputManagerAction } from "../sveltelib/input-manager";
|
||||||
|
import type { MirrorAction } from "../sveltelib/mirror-dom";
|
||||||
|
import type { ContentEditableAPI } from "./content-editable";
|
||||||
import {
|
import {
|
||||||
customFocusHandling,
|
customFocusHandling,
|
||||||
preventBuiltinContentEditableShortcuts,
|
preventBuiltinContentEditableShortcuts,
|
||||||
} from "./content-editable";
|
} from "./content-editable";
|
||||||
import type { ContentEditableAPI } from "./content-editable";
|
|
||||||
import type { MirrorAction } from "../sveltelib/mirror-dom";
|
|
||||||
import type { InputManagerAction } from "../sveltelib/input-manager";
|
|
||||||
|
|
||||||
export let resolve: (editable: HTMLElement) => void;
|
export let resolve: (editable: HTMLElement) => void;
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy } from "svelte";
|
import { onDestroy } from "svelte";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
|
import { randomUUID } from "../lib/uuid";
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
import { convertMathjax } from "./mathjax";
|
import { convertMathjax } from "./mathjax";
|
||||||
import { randomUUID } from "../lib/uuid";
|
|
||||||
import { writable } from "svelte/store";
|
|
||||||
|
|
||||||
export let mathjax: string;
|
export let mathjax: string;
|
||||||
export let block: boolean;
|
export let block: boolean;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { on, preventDefault } from "../lib/events";
|
|
||||||
import { registerShortcut } from "../lib/shortcuts";
|
|
||||||
import { placeCaretAfterContent } from "../domlib/place-caret";
|
|
||||||
import { saveSelection, restoreSelection } from "../domlib/location";
|
|
||||||
import { isApplePlatform } from "../lib/platform";
|
|
||||||
import { bridgeCommand } from "../lib/bridgecommand";
|
|
||||||
import type { SelectionLocation } from "../domlib/location";
|
import type { SelectionLocation } from "../domlib/location";
|
||||||
|
import { restoreSelection, saveSelection } from "../domlib/location";
|
||||||
|
import { placeCaretAfterContent } from "../domlib/place-caret";
|
||||||
|
import { bridgeCommand } from "../lib/bridgecommand";
|
||||||
|
import { on, preventDefault } from "../lib/events";
|
||||||
|
import { isApplePlatform } from "../lib/platform";
|
||||||
|
import { registerShortcut } from "../lib/shortcuts";
|
||||||
|
|
||||||
function safePlaceCaretAfterContent(editable: HTMLElement): void {
|
function safePlaceCaretAfterContent(editable: HTMLElement): void {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
|
import { moveChildOutOfElement } from "../domlib/move-nodes";
|
||||||
|
import { placeCaretAfter, placeCaretBefore } from "../domlib/place-caret";
|
||||||
|
import { getSelection, isSelectionCollapsed } from "../lib/cross-browser";
|
||||||
import {
|
import {
|
||||||
nodeIsText,
|
|
||||||
nodeIsElement,
|
|
||||||
elementIsBlock,
|
elementIsBlock,
|
||||||
hasBlockAttribute,
|
hasBlockAttribute,
|
||||||
|
nodeIsElement,
|
||||||
|
nodeIsText,
|
||||||
} from "../lib/dom";
|
} from "../lib/dom";
|
||||||
import { on } from "../lib/events";
|
import { on } from "../lib/events";
|
||||||
import { getSelection, isSelectionCollapsed } from "../lib/cross-browser";
|
|
||||||
import { moveChildOutOfElement } from "../domlib/move-nodes";
|
|
||||||
import { placeCaretBefore, placeCaretAfter } from "../domlib/place-caret";
|
|
||||||
import {
|
|
||||||
frameElementTagName,
|
|
||||||
isFrameHandle,
|
|
||||||
checkWhetherMovingIntoHandle,
|
|
||||||
FrameStart,
|
|
||||||
FrameEnd,
|
|
||||||
} from "./frame-handle";
|
|
||||||
import type { FrameHandle } from "./frame-handle";
|
import type { FrameHandle } from "./frame-handle";
|
||||||
|
import {
|
||||||
|
checkWhetherMovingIntoHandle,
|
||||||
|
frameElementTagName,
|
||||||
|
FrameEnd,
|
||||||
|
FrameStart,
|
||||||
|
isFrameHandle,
|
||||||
|
} from "./frame-handle";
|
||||||
|
|
||||||
function restoreFrameHandles(mutations: MutationRecord[]): void {
|
function restoreFrameHandles(mutations: MutationRecord[]): void {
|
||||||
let referenceNode: Node | null = null;
|
let referenceNode: Node | null = null;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import { nodeIsText, nodeIsElement, elementIsEmpty } from "../lib/dom";
|
|
||||||
import { on } from "../lib/events";
|
|
||||||
import { getSelection, isSelectionCollapsed } from "../lib/cross-browser";
|
|
||||||
import { moveChildOutOfElement } from "../domlib/move-nodes";
|
import { moveChildOutOfElement } from "../domlib/move-nodes";
|
||||||
import { placeCaretAfter } from "../domlib/place-caret";
|
import { placeCaretAfter } from "../domlib/place-caret";
|
||||||
|
import { getSelection, isSelectionCollapsed } from "../lib/cross-browser";
|
||||||
|
import { elementIsEmpty, nodeIsElement, nodeIsText } from "../lib/dom";
|
||||||
|
import { on } from "../lib/events";
|
||||||
import type { FrameElement } from "./frame-element";
|
import type { FrameElement } from "./frame-element";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import "./editable-base.css";
|
import "./editable-base.css";
|
||||||
|
|
||||||
/* only imported for the CSS */
|
/* only imported for the CSS */
|
||||||
import "./ContentEditable.svelte";
|
import "./ContentEditable.svelte";
|
||||||
import "./Mathjax.svelte";
|
import "./Mathjax.svelte";
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
|
|
||||||
import "mathjax/es5/tex-svg-full";
|
import "mathjax/es5/tex-svg-full";
|
||||||
|
|
||||||
|
import { placeCaretAfter, placeCaretBefore } from "../domlib/place-caret";
|
||||||
import { on } from "../lib/events";
|
import { on } from "../lib/events";
|
||||||
import { placeCaretBefore, placeCaretAfter } from "../domlib/place-caret";
|
|
||||||
import type { DecoratedElement, DecoratedElementConstructor } from "./decorated";
|
import type { DecoratedElement, DecoratedElementConstructor } from "./decorated";
|
||||||
import { FrameElement, frameElement } from "./frame-element";
|
import { FrameElement, frameElement } from "./frame-element";
|
||||||
|
|
||||||
import Mathjax_svelte from "./Mathjax.svelte";
|
import Mathjax_svelte from "./Mathjax.svelte";
|
||||||
|
|
||||||
const mathjaxTagPattern =
|
const mathjaxTagPattern =
|
||||||
|
|
|
@ -3,10 +3,10 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import NoteEditor from "./NoteEditor.svelte";
|
|
||||||
import ButtonGroupItem from "../components/ButtonGroupItem.svelte";
|
import ButtonGroupItem from "../components/ButtonGroupItem.svelte";
|
||||||
import PreviewButton from "./PreviewButton.svelte";
|
|
||||||
import type { NoteEditorAPI } from "./NoteEditor.svelte";
|
import type { NoteEditorAPI } from "./NoteEditor.svelte";
|
||||||
|
import NoteEditor from "./NoteEditor.svelte";
|
||||||
|
import PreviewButton from "./PreviewButton.svelte";
|
||||||
|
|
||||||
const api: Partial<NoteEditorAPI> = {};
|
const api: Partial<NoteEditorAPI> = {};
|
||||||
let noteEditor: NoteEditor;
|
let noteEditor: NoteEditor;
|
||||||
|
|
|
@ -13,12 +13,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher, getContext } from "svelte";
|
import { createEventDispatcher, getContext } from "svelte";
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
import storeSubscribe from "../sveltelib/store-subscribe";
|
|
||||||
import { directionKey } from "../lib/context-keys";
|
|
||||||
import { lightCodeMirrorTheme, darkCodeMirrorTheme } from "./code-mirror";
|
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
|
||||||
|
|
||||||
export let configuration: CodeMirror.EditorConfiguration;
|
import { directionKey } from "../lib/context-keys";
|
||||||
|
import storeSubscribe from "../sveltelib/store-subscribe";
|
||||||
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
|
import { darkCodeMirrorTheme, lightCodeMirrorTheme } from "./code-mirror";
|
||||||
|
|
||||||
|
export let configuration: CodeMirrorLib.EditorConfiguration;
|
||||||
export let code: Writable<string>;
|
export let code: Writable<string>;
|
||||||
|
|
||||||
const direction = getContext<Writable<"ltr" | "rtl">>(directionKey);
|
const direction = getContext<Writable<"ltr" | "rtl">>(directionKey);
|
||||||
|
@ -27,7 +28,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
rtlMoveVisually: true,
|
rtlMoveVisually: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
let codeMirror: CodeMirror.EditorFromTextArea;
|
let codeMirror: CodeMirrorLib.EditorFromTextArea;
|
||||||
$: codeMirror?.setOption("direction", $direction);
|
$: codeMirror?.setOption("direction", $direction);
|
||||||
|
|
||||||
function setValue(content: string): void {
|
function setValue(content: string): void {
|
||||||
|
|
|
@ -3,8 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import * as tr from "../lib/ftl";
|
|
||||||
import { bridgeCommand } from "../lib/bridgecommand";
|
import { bridgeCommand } from "../lib/bridgecommand";
|
||||||
|
import * as tr from "../lib/ftl";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
|
|
||||||
import contextProperty from "../sveltelib/context-property";
|
import contextProperty from "../sveltelib/context-property";
|
||||||
|
|
||||||
export interface EditingInputAPI {
|
export interface EditingInputAPI {
|
||||||
|
@ -28,10 +29,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import FocusTrap from "./FocusTrap.svelte";
|
|
||||||
import { writable } from "svelte/store";
|
|
||||||
import { onMount, setContext as svelteSetContext } from "svelte";
|
import { onMount, setContext as svelteSetContext } from "svelte";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
import { fontFamilyKey, fontSizeKey } from "../lib/context-keys";
|
import { fontFamilyKey, fontSizeKey } from "../lib/context-keys";
|
||||||
|
import FocusTrap from "./FocusTrap.svelte";
|
||||||
|
|
||||||
export let fontFamily: string;
|
export let fontFamily: string;
|
||||||
const fontFamilyStore = writable(fontFamily);
|
const fontFamilyStore = writable(fontFamily);
|
||||||
|
|
|
@ -3,10 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
import type { EditingAreaAPI } from "./EditingArea.svelte";
|
|
||||||
import contextProperty from "../sveltelib/context-property";
|
|
||||||
import type { Readable } from "svelte/store";
|
import type { Readable } from "svelte/store";
|
||||||
|
|
||||||
|
import contextProperty from "../sveltelib/context-property";
|
||||||
|
import type { EditingAreaAPI } from "./EditingArea.svelte";
|
||||||
|
|
||||||
export interface FieldData {
|
export interface FieldData {
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
@ -28,18 +29,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import EditingArea from "./EditingArea.svelte";
|
|
||||||
import LabelContainer from "./LabelContainer.svelte";
|
|
||||||
import LabelDescription from "./LabelDescription.svelte";
|
|
||||||
import LabelName from "./LabelName.svelte";
|
|
||||||
import FieldState from "./FieldState.svelte";
|
|
||||||
|
|
||||||
import { onDestroy, setContext } from "svelte";
|
import { onDestroy, setContext } from "svelte";
|
||||||
import { writable } from "svelte/store";
|
|
||||||
import type { Writable } from "svelte/store";
|
import type { Writable } from "svelte/store";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
import { directionKey } from "../lib/context-keys";
|
import { directionKey } from "../lib/context-keys";
|
||||||
import { promiseWithResolver } from "../lib/promise";
|
import { promiseWithResolver } from "../lib/promise";
|
||||||
import type { Destroyable } from "./destroyable";
|
import type { Destroyable } from "./destroyable";
|
||||||
|
import EditingArea from "./EditingArea.svelte";
|
||||||
|
import FieldState from "./FieldState.svelte";
|
||||||
|
import LabelContainer from "./LabelContainer.svelte";
|
||||||
|
import LabelDescription from "./LabelDescription.svelte";
|
||||||
|
import LabelName from "./LabelName.svelte";
|
||||||
|
|
||||||
export let content: Writable<string>;
|
export let content: Writable<string>;
|
||||||
export let field: FieldData;
|
export let field: FieldData;
|
||||||
|
|
|
@ -7,7 +7,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
customElements.define(FrameElement.tagName, FrameElement);
|
customElements.define(FrameElement.tagName, FrameElement);
|
||||||
|
|
||||||
import { FrameStart, FrameEnd } from "../editable/frame-handle";
|
import { FrameEnd, FrameStart } from "../editable/frame-handle";
|
||||||
|
|
||||||
customElements.define(FrameStart.tagName, FrameStart);
|
customElements.define(FrameStart.tagName, FrameStart);
|
||||||
customElements.define(FrameEnd.tagName, FrameEnd);
|
customElements.define(FrameEnd.tagName, FrameEnd);
|
||||||
|
|
|
@ -3,7 +3,7 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
|
||||||
export let tooltip: string | undefined = undefined;
|
export let tooltip: string | undefined = undefined;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
|
|
||||||
import { pageTheme } from "../sveltelib/theme";
|
import { pageTheme } from "../sveltelib/theme";
|
||||||
|
|
||||||
export let offsetX = 0;
|
export let offsetX = 0;
|
||||||
|
|
|
@ -3,10 +3,11 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Readable } from "svelte/store";
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
import { directionKey } from "../lib/context-keys";
|
|
||||||
import { afterUpdate, createEventDispatcher, onMount } from "svelte";
|
import { afterUpdate, createEventDispatcher, onMount } from "svelte";
|
||||||
|
import type { Readable } from "svelte/store";
|
||||||
|
|
||||||
|
import { directionKey } from "../lib/context-keys";
|
||||||
|
|
||||||
let dimensions: HTMLDivElement;
|
let dimensions: HTMLDivElement;
|
||||||
let overflowFix = 0;
|
let overflowFix = 0;
|
||||||
|
|
|
@ -3,7 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
|
|
||||||
export let container: HTMLElement;
|
export let container: HTMLElement;
|
||||||
export let image: HTMLImageElement;
|
export let image: HTMLImageElement;
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
let width: number;
|
let width: number;
|
||||||
let height: number;
|
let height: number;
|
||||||
|
|
||||||
function setSelection(_selection?: HTMLDivElement): void {
|
function setSelection(): void {
|
||||||
const containerRect = container.getBoundingClientRect();
|
const containerRect = container.getBoundingClientRect();
|
||||||
const imageRect = image!.getBoundingClientRect();
|
const imageRect = image!.getBoundingClientRect();
|
||||||
|
|
||||||
|
@ -41,14 +42,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
}
|
}
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
let selection: HTMLDivElement;
|
|
||||||
|
|
||||||
onMount(() => dispatch("mount", { selection }));
|
function initSelection(selection: HTMLDivElement): void {
|
||||||
|
setSelection();
|
||||||
|
dispatch("mount", { selection });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
bind:this={selection}
|
use:initSelection
|
||||||
use:setSelection
|
|
||||||
on:click={(event) =>
|
on:click={(event) =>
|
||||||
/* prevent triggering Bootstrap dropdown */ event.stopImmediatePropagation()}
|
/* prevent triggering Bootstrap dropdown */ event.stopImmediatePropagation()}
|
||||||
style="--left: {left}px; --top: {top}px; --width: {width}px; --height: {height}px; --offsetX: {offsetX}px; --offsetY: {offsetY}px;"
|
style="--left: {left}px; --top: {top}px; --width: {width}px; --height: {height}px; --offsetX: {offsetX}px; --offsetY: {offsetY}px;"
|
||||||
|
|
|
@ -3,8 +3,9 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Readable } from "svelte/store";
|
|
||||||
import { getContext } from "svelte";
|
import { getContext } from "svelte";
|
||||||
|
import type { Readable } from "svelte/store";
|
||||||
|
|
||||||
import { directionKey } from "../lib/context-keys";
|
import { directionKey } from "../lib/context-keys";
|
||||||
|
|
||||||
const direction = getContext<Readable<"ltr" | "rtl">>(directionKey);
|
const direction = getContext<Readable<"ltr" | "rtl">>(directionKey);
|
||||||
|
|
|
@ -3,9 +3,9 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { descriptionIcon } from "./icons";
|
|
||||||
import WithTooltip from "../components/WithTooltip.svelte";
|
|
||||||
import Badge from "../components/Badge.svelte";
|
import Badge from "../components/Badge.svelte";
|
||||||
|
import WithTooltip from "../components/WithTooltip.svelte";
|
||||||
|
import { descriptionIcon } from "./icons";
|
||||||
|
|
||||||
export let description: string;
|
export let description: string;
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,8 +3,8 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { context } from "./DecoratedElements.svelte";
|
|
||||||
import { Mathjax } from "../editable/mathjax-element";
|
import { Mathjax } from "../editable/mathjax-element";
|
||||||
|
import { context } from "./DecoratedElements.svelte";
|
||||||
|
|
||||||
const decoratedElements = context.get();
|
const decoratedElements = context.get();
|
||||||
decoratedElements.push(Mathjax);
|
decoratedElements.push(Mathjax);
|
||||||
|
|
|
@ -3,12 +3,13 @@ Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount, onDestroy } from "svelte";
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
|
||||||
import { bridgeCommand } from "../lib/bridgecommand";
|
import { bridgeCommand } from "../lib/bridgecommand";
|
||||||
import { registerShortcut } from "../lib/shortcuts";
|
import { registerShortcut } from "../lib/shortcuts";
|
||||||
import StickyBadge from "./StickyBadge.svelte";
|
|
||||||
import NoteEditor from "./NoteEditor.svelte";
|
|
||||||
import type { NoteEditorAPI } from "./NoteEditor.svelte";
|
import type { NoteEditorAPI } from "./NoteEditor.svelte";
|
||||||
|
import NoteEditor from "./NoteEditor.svelte";
|
||||||
|
import StickyBadge from "./StickyBadge.svelte";
|
||||||
|
|
||||||
const api: Partial<NoteEditorAPI> = {};
|
const api: Partial<NoteEditorAPI> = {};
|
||||||
let noteEditor: NoteEditor;
|
let noteEditor: NoteEditor;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue