@polyipseity/obsidian-plugin-library 1.32.0 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -45
- package/dist/index.js +3 -33
- package/dist/index.js.map +2 -2
- package/dist/src/modals.d.ts +0 -4
- package/dist/src/modals.d.ts.map +1 -1
- package/dist/src/settings-tab.d.ts.map +1 -1
- package/package.json +28 -26
package/README.md
CHANGED
|
@@ -40,47 +40,7 @@ The todos here, ordered alphabetically, are things planned for the plugin. There
|
|
|
40
40
|
|
|
41
41
|
### Translating
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
To contribute translation for an existing locale, modify the files in the corresponding directory.
|
|
46
|
-
|
|
47
|
-
For a new locale, create a new directory named with its language tag and copy [`assets/locales/en/translation.json`](assets/locales/en/translation.json) into it. Then, add an entry to [`assets/locales/en/language.json`](assets/locales/en/language.json) in this format:
|
|
48
|
-
|
|
49
|
-
```JSONc
|
|
50
|
-
{
|
|
51
|
-
// ...
|
|
52
|
-
"en": "English",
|
|
53
|
-
"(your-language-tag)": "(Native name of your language)",
|
|
54
|
-
"uwu": "Uwuish",
|
|
55
|
-
// ...
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Sort the list of languages by the alphabetical order of their language tags. Then modify the files in the new directory. There will be errors in [`assets/locales.ts`](assets/locales.ts), which you can ignore and we will fix them for you. You are welcome to fix them yourself if you know TypeScript.
|
|
60
|
-
|
|
61
|
-
When translating, keep in mind the following things:
|
|
62
|
-
|
|
63
|
-
- Do not translate anything between `{{` and `}}` (`{{example}}`). They are __interpolations__ and will be replaced by localized strings at runtime.
|
|
64
|
-
- Do not translate anything between `$t(` and `)` (`$t(example)`). They refer to other localized strings. To find the localized string being referred to, follow the path of the key, which is separated by dots (`.`). For example, the key [`youtu.be./dQw4w9WgXcQ`](https://youtu.be./dQw4w9WgXcQ) refers to:
|
|
65
|
-
|
|
66
|
-
```JSONc
|
|
67
|
-
{
|
|
68
|
-
// ...
|
|
69
|
-
"youtu": {
|
|
70
|
-
// ...
|
|
71
|
-
"be": {
|
|
72
|
-
// ...
|
|
73
|
-
"/dQw4w9WgXcQ": "I am 'youtu.be./dQw4w9WgXcQ'!",
|
|
74
|
-
// ...
|
|
75
|
-
},
|
|
76
|
-
// ...
|
|
77
|
-
},
|
|
78
|
-
// ...
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
- The keys under `generic` are vocabularies. They can be referred in translation strings by `$t(generic.key)`. Refer to them as much as possible to standardize translations for vocabularies that appear in different places.
|
|
83
|
-
- It is okay to move interpolations and references to other localized strings around to make the translation natural. It is also okay to not use some references used in the original translation. However, it is NOT okay to not use all interpolations.
|
|
43
|
+
See [`assets/locales/README.md`](assets/locales/README.md).
|
|
84
44
|
|
|
85
45
|
## Security
|
|
86
46
|
|
|
@@ -88,10 +48,11 @@ We hope that there will never be any security vulnerabilities, but unfortunately
|
|
|
88
48
|
|
|
89
49
|
### Supported versions
|
|
90
50
|
|
|
91
|
-
| Version
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
-
|
|
|
51
|
+
| Version | Supported |
|
|
52
|
+
| -------- | --------- |
|
|
53
|
+
| rolling | ✅ |
|
|
54
|
+
| latest | ✅ |
|
|
55
|
+
| outdated | ❌ |
|
|
95
56
|
|
|
96
57
|
### Reporting a vulnerability
|
|
97
58
|
|
package/dist/index.js
CHANGED
|
@@ -2269,13 +2269,7 @@ function Find($$anchor, $$props) {
|
|
|
2269
2269
|
$.bind_value(input, () => stateParams.findText, ($$value) => stateParams.findText = $$value);
|
|
2270
2270
|
$.transition(3, div, () => slide);
|
|
2271
2271
|
$.append($$anchor, div);
|
|
2272
|
-
return $.pop({
|
|
2273
|
-
setI18n,
|
|
2274
|
-
getParamsRef,
|
|
2275
|
-
setResults,
|
|
2276
|
-
focus,
|
|
2277
|
-
blur
|
|
2278
|
-
});
|
|
2272
|
+
return $.pop({ setI18n, getParamsRef, setResults, focus, blur });
|
|
2279
2273
|
}
|
|
2280
2274
|
$.delegate(["click", "keydown"]);
|
|
2281
2275
|
|
|
@@ -3311,13 +3305,6 @@ function dropdownSelect(unselected, selections, callback, action2 = {}) {
|
|
|
3311
3305
|
}
|
|
3312
3306
|
|
|
3313
3307
|
// src/modals.ts
|
|
3314
|
-
function makeModalDynamicWidth(ui, element) {
|
|
3315
|
-
const { width } = element.style;
|
|
3316
|
-
element.style.width = "unset";
|
|
3317
|
-
ui.finally(() => {
|
|
3318
|
-
element.style.width = width;
|
|
3319
|
-
});
|
|
3320
|
-
}
|
|
3321
3308
|
function getDefaultSuggestModalInstructions(context) {
|
|
3322
3309
|
const { language: { value: i18n } } = context;
|
|
3323
3310
|
return [
|
|
@@ -3369,7 +3356,6 @@ var ListModal = class _ListModal extends Modal {
|
|
|
3369
3356
|
this.#descriptor = options?.descriptor ?? (() => "");
|
|
3370
3357
|
this.#presets = options?.presets;
|
|
3371
3358
|
this.#presetPlaceholder = options?.presetPlaceholder ?? (() => i18n.t("components.list.preset-placeholder"));
|
|
3372
|
-
this.#dynamicWidth = options?.dynamicWidth ?? false;
|
|
3373
3359
|
}
|
|
3374
3360
|
modalUI = new UpdatableUI();
|
|
3375
3361
|
ui = new UpdatableUI();
|
|
@@ -3383,7 +3369,6 @@ var ListModal = class _ListModal extends Modal {
|
|
|
3383
3369
|
#descriptor;
|
|
3384
3370
|
#presets;
|
|
3385
3371
|
#presetPlaceholder;
|
|
3386
|
-
#dynamicWidth;
|
|
3387
3372
|
#setupListSubUI = noop4;
|
|
3388
3373
|
static stringInputter(transformer) {
|
|
3389
3374
|
return (setting, editable, getter, setter, input = (setting0, callback) => {
|
|
@@ -3396,16 +3381,13 @@ var ListModal = class _ListModal extends Modal {
|
|
|
3396
3381
|
}
|
|
3397
3382
|
onOpen() {
|
|
3398
3383
|
super.onOpen();
|
|
3399
|
-
const { context, placeholder, data, ui, titleEl, modalUI
|
|
3384
|
+
const { context, placeholder, data, ui, titleEl, modalUI } = this, { element: listEl, remover: listElRemover } = useSettings(this.contentEl), { language } = context, { value: i18n, onChangeLanguage } = language, editables = this.#editables, title = this.#title, description = this.#description, presets = this.#presets, presetPlaceholder = this.#presetPlaceholder;
|
|
3400
3385
|
modalUI.finally(onChangeLanguage.listen(() => {
|
|
3401
3386
|
modalUI.update();
|
|
3402
3387
|
}));
|
|
3403
3388
|
ui.finally(listElRemover).finally(onChangeLanguage.listen(() => {
|
|
3404
3389
|
ui.update();
|
|
3405
3390
|
}));
|
|
3406
|
-
if (this.#dynamicWidth) {
|
|
3407
|
-
makeModalDynamicWidth(modalUI, modalEl);
|
|
3408
|
-
}
|
|
3409
3391
|
if (title) {
|
|
3410
3392
|
modalUI.new(constant3(titleEl), (ele) => {
|
|
3411
3393
|
ele.textContent = title();
|
|
@@ -3573,7 +3555,6 @@ var EditDataModal = class _EditDataModal extends Modal {
|
|
|
3573
3555
|
this.#dataText = JSON.stringify(this.data, null, JSON_STRINGIFY_SPACE);
|
|
3574
3556
|
this.#callback = options?.callback ?? (() => {
|
|
3575
3557
|
});
|
|
3576
|
-
this.#dynamicWidth = options?.dynamicWidth ?? true;
|
|
3577
3558
|
this.#elements = deepFreeze([...options?.elements ?? _EditDataModal.ELEMENTS]);
|
|
3578
3559
|
this.#title = options?.title;
|
|
3579
3560
|
this.#description = options?.description;
|
|
@@ -3583,13 +3564,12 @@ var EditDataModal = class _EditDataModal extends Modal {
|
|
|
3583
3564
|
data;
|
|
3584
3565
|
#dataText;
|
|
3585
3566
|
#callback;
|
|
3586
|
-
#dynamicWidth;
|
|
3587
3567
|
#elements;
|
|
3588
3568
|
#title;
|
|
3589
3569
|
#description;
|
|
3590
3570
|
onOpen() {
|
|
3591
3571
|
super.onOpen();
|
|
3592
|
-
const { modalUI, ui,
|
|
3572
|
+
const { modalUI, ui, contentEl, titleEl, context } = this, errorEl = statusUI(ui, (() => {
|
|
3593
3573
|
const ret = createChildElement(contentEl, "div", (ele) => {
|
|
3594
3574
|
ele.classList.add(DOMClasses.MOD_WARNING);
|
|
3595
3575
|
});
|
|
@@ -3606,9 +3586,6 @@ var EditDataModal = class _EditDataModal extends Modal {
|
|
|
3606
3586
|
})).finally(() => {
|
|
3607
3587
|
this.#resetDataText();
|
|
3608
3588
|
});
|
|
3609
|
-
if (this.#dynamicWidth) {
|
|
3610
|
-
makeModalDynamicWidth(modalUI, modalEl);
|
|
3611
|
-
}
|
|
3612
3589
|
if (title) {
|
|
3613
3590
|
modalUI.new(constant3(titleEl), (ele) => {
|
|
3614
3591
|
ele.textContent = title();
|
|
@@ -3744,7 +3721,6 @@ var DialogModal = class extends Modal {
|
|
|
3744
3721
|
this.#title = options?.title;
|
|
3745
3722
|
this.#description = options?.description;
|
|
3746
3723
|
this.#draw = options?.draw ?? noop4;
|
|
3747
|
-
this.#dynamicWidth = options?.dynamicWidth ?? false;
|
|
3748
3724
|
}
|
|
3749
3725
|
modalUI = new UpdatableUI();
|
|
3750
3726
|
ui = new UpdatableUI();
|
|
@@ -3754,7 +3730,6 @@ var DialogModal = class extends Modal {
|
|
|
3754
3730
|
#description;
|
|
3755
3731
|
#draw;
|
|
3756
3732
|
#doubleConfirmTimeout;
|
|
3757
|
-
#dynamicWidth;
|
|
3758
3733
|
onOpen() {
|
|
3759
3734
|
super.onOpen();
|
|
3760
3735
|
const { context, modalEl, scope, modalUI, titleEl, ui, contentEl } = this, { language } = context, { value: i18n, onChangeLanguage } = language, title = this.#title, description = this.#description, doubleConfirmTimeout = this.#doubleConfirmTimeout ?? 0;
|
|
@@ -3764,9 +3739,6 @@ var DialogModal = class extends Modal {
|
|
|
3764
3739
|
ui.finally(onChangeLanguage.listen(() => {
|
|
3765
3740
|
ui.update();
|
|
3766
3741
|
}));
|
|
3767
|
-
if (this.#dynamicWidth) {
|
|
3768
|
-
makeModalDynamicWidth(modalUI, modalEl);
|
|
3769
|
-
}
|
|
3770
3742
|
if (title) {
|
|
3771
3743
|
modalUI.new(constant3(titleEl), (ele) => {
|
|
3772
3744
|
ele.textContent = title();
|
|
@@ -4511,7 +4483,6 @@ var AdvancedSettingTab = class extends PluginSettingTab {
|
|
|
4511
4483
|
});
|
|
4512
4484
|
this.postMutate(true);
|
|
4513
4485
|
},
|
|
4514
|
-
dynamicWidth: true,
|
|
4515
4486
|
editables: ["remove"],
|
|
4516
4487
|
namer: (value) => value[0],
|
|
4517
4488
|
title: () => i18n.t("settings.all-settings-actions.recover")
|
|
@@ -4893,7 +4864,6 @@ export {
|
|
|
4893
4864
|
lazyProxy,
|
|
4894
4865
|
linkSetting,
|
|
4895
4866
|
logFormat,
|
|
4896
|
-
makeModalDynamicWidth,
|
|
4897
4867
|
mapFirstCodePoint,
|
|
4898
4868
|
markFixed,
|
|
4899
4869
|
mergeResources,
|