@pptx-editor.dev/vue 0.6.1-canary.20261119032858.sha-95106bb → 0.7.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 +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.js +25 -28
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -106,7 +106,7 @@ createApp({
|
|
|
106
106
|
| --- | --- |
|
|
107
107
|
| `usePptxEditor()` | `UsePptxEditorReturn`: the editor, or null before it mounts |
|
|
108
108
|
| `useEditorState(selector, isEqual?)` | `UseEditorStateReturn<T>`: the selected slice, updated only when it changes |
|
|
109
|
-
| `useEditorCommand(slotId)` | `UseEditorCommandReturn`: `execute` (it returns `true` when the engine ran the command, `false` on a refusal), and `isEnabled`, `isActive`, `disabledReason`, `value` as computed refs. `disabledReason` is
|
|
109
|
+
| `useEditorCommand(slotId)` | `UseEditorCommandReturn`: `execute` (it returns `true` when the engine ran the command, `false` on a refusal), and `isEnabled`, `isActive`, `disabledReason`, `value` as computed refs. `disabledReason` is readable text in the locale of `PptxEditorRoot`: the composable translates catalog keys and keeps the engine's own text. `slotId` may be a ref or a getter |
|
|
110
110
|
| `useTranslation()` | `UseTranslationReturn`: `t`, with shortcut text for the platform |
|
|
111
111
|
| `useFontFormat()` | `UseFontFormatReturn`: `format` (the `FontFormatRead` of the selected text or of the selected shapes' runs, with `disagrees`), `isEnabled`, and `apply(update)`, which sends one `setFontFormat` and returns whether the engine accepted it |
|
|
112
112
|
| `useBulletFormat()` | `UseBulletFormatReturn`: `format` (the `BulletFormatRead` of the selected paragraphs: `null` when they have no list, `undefined` when they differ or no text is selected), `isEnabled`, and `apply(format)`, which sends one `setBulletFormat` and returns whether the engine accepted it |
|
package/dist/index.d.ts
CHANGED
|
@@ -5316,7 +5316,10 @@ interface UseEditorCommandReturn {
|
|
|
5316
5316
|
readonly isEnabled: ComputedRef<boolean>;
|
|
5317
5317
|
/** Whether a toggle control shows as pressed. */
|
|
5318
5318
|
readonly isActive: ComputedRef<boolean>;
|
|
5319
|
-
/**
|
|
5319
|
+
/**
|
|
5320
|
+
* Why the command cannot run, as readable text in the locale of `PptxEditorRoot`. A catalog
|
|
5321
|
+
* key is translated; the engine's own text shows as itself.
|
|
5322
|
+
*/
|
|
5320
5323
|
readonly disabledReason: ComputedRef<string | null>;
|
|
5321
5324
|
/** The value a value control shows (a font size, a family), when it has one. */
|
|
5322
5325
|
readonly value: ComputedRef<string | number | undefined>;
|
|
@@ -5392,7 +5395,7 @@ interface UseEditorValueCommandReturn<V, S = V> {
|
|
|
5392
5395
|
readonly options: ComputedRef<readonly V[]>;
|
|
5393
5396
|
/** Whether the command can run now. */
|
|
5394
5397
|
readonly isEnabled: ComputedRef<boolean>;
|
|
5395
|
-
/** Why the command cannot run
|
|
5398
|
+
/** Why the command cannot run, as readable text in the locale of `PptxEditorRoot`. */
|
|
5396
5399
|
readonly disabledReason: ComputedRef<string | null>;
|
|
5397
5400
|
}
|
|
5398
5401
|
/**
|
|
@@ -9257,8 +9260,8 @@ declare const layoutGalleryProps: {
|
|
|
9257
9260
|
readonly default: undefined;
|
|
9258
9261
|
};
|
|
9259
9262
|
/**
|
|
9260
|
-
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key
|
|
9261
|
-
* `useEditorCommand(slotId).disabledReason`)
|
|
9263
|
+
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key or text
|
|
9264
|
+
* (such as `useEditorCommand(slotId).disabledReason`). Default: the viewing reason.
|
|
9262
9265
|
*/
|
|
9263
9266
|
readonly disabledReason: {
|
|
9264
9267
|
readonly type: PropType<string | null>;
|
|
@@ -9297,8 +9300,8 @@ declare const LayoutGallery: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
9297
9300
|
readonly default: undefined;
|
|
9298
9301
|
};
|
|
9299
9302
|
/**
|
|
9300
|
-
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key
|
|
9301
|
-
* `useEditorCommand(slotId).disabledReason`)
|
|
9303
|
+
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key or text
|
|
9304
|
+
* (such as `useEditorCommand(slotId).disabledReason`). Default: the viewing reason.
|
|
9302
9305
|
*/
|
|
9303
9306
|
readonly disabledReason: {
|
|
9304
9307
|
readonly type: PropType<string | null>;
|
|
@@ -9328,8 +9331,8 @@ declare const LayoutGallery: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
9328
9331
|
readonly default: undefined;
|
|
9329
9332
|
};
|
|
9330
9333
|
/**
|
|
9331
|
-
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key
|
|
9332
|
-
* `useEditorCommand(slotId).disabledReason`)
|
|
9334
|
+
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key or text
|
|
9335
|
+
* (such as `useEditorCommand(slotId).disabledReason`). Default: the viewing reason.
|
|
9333
9336
|
*/
|
|
9334
9337
|
readonly disabledReason: {
|
|
9335
9338
|
readonly type: PropType<string | null>;
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
localeContentKey,
|
|
31
31
|
repaintSurfaceOf,
|
|
32
32
|
reportFontError,
|
|
33
|
-
translateKeyOrText as
|
|
33
|
+
translateKeyOrText as translateKeyOrText20,
|
|
34
34
|
warnModulesChanged
|
|
35
35
|
} from "@pptx-editor.dev/core/editor";
|
|
36
36
|
import { createTranslator as createTranslator2 } from "@pptx-editor.dev/i18n";
|
|
@@ -67,7 +67,8 @@ import {
|
|
|
67
67
|
warnOutsideRoot,
|
|
68
68
|
paneListenersVersion,
|
|
69
69
|
subscribePaneListeners,
|
|
70
|
-
isPaneSlot
|
|
70
|
+
isPaneSlot,
|
|
71
|
+
translateKeyOrText
|
|
71
72
|
} from "@pptx-editor.dev/core/editor";
|
|
72
73
|
|
|
73
74
|
// src/notes-target.ts
|
|
@@ -197,6 +198,7 @@ var chromeActionHostKey = /* @__PURE__ */ Symbol("pptxChromeActionHost");
|
|
|
197
198
|
function useEditorCommand(slot) {
|
|
198
199
|
const editorRef = usePptxEditor();
|
|
199
200
|
const host = inject(chromeActionHostKey, null);
|
|
201
|
+
const { t } = useTranslation();
|
|
200
202
|
const read = () => editorCommandFor(editorRef.value, toValue2(slot), host, "disabled.noRoot").state;
|
|
201
203
|
const panes = useExternalVersion(subscribePaneListeners, paneListenersVersion);
|
|
202
204
|
const state = useSlice(read, sameChromeCommandState, () => [
|
|
@@ -227,11 +229,12 @@ function useEditorCommand(slot) {
|
|
|
227
229
|
const n = notesFormat.value;
|
|
228
230
|
return n ? n.target.formats[n.format] : state.value.isActive;
|
|
229
231
|
}),
|
|
232
|
+
// Readable text in the root locale, as React's: a catalog key is translated, and the
|
|
233
|
+
// engine's own text shows as itself. The translator follows the root's `locale` prop.
|
|
230
234
|
disabledReason: computed(() => {
|
|
231
235
|
const n = notesFormat.value;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return n.target.canFormat ? null : "disabled.selectNotesText";
|
|
236
|
+
const reason = !n ? state.value.disabledReason : n.target.readOnly ? "disabled.viewing" : n.target.canFormat ? null : "disabled.selectNotesText";
|
|
237
|
+
return reason ? translateKeyOrText(t, reason) : null;
|
|
235
238
|
}),
|
|
236
239
|
value: computed(() => state.value.value)
|
|
237
240
|
};
|
|
@@ -1788,7 +1791,7 @@ import {
|
|
|
1788
1791
|
altTextDraftFrom,
|
|
1789
1792
|
commitDialogCommand as commitDialogCommand2,
|
|
1790
1793
|
translateDialogErrors as translateDialogErrors3,
|
|
1791
|
-
translateKeyOrText,
|
|
1794
|
+
translateKeyOrText as translateKeyOrText2,
|
|
1792
1795
|
validateAltTextDraft
|
|
1793
1796
|
} from "@pptx-editor.dev/core/editor";
|
|
1794
1797
|
var parts2 = createDialogParts(
|
|
@@ -1853,8 +1856,8 @@ var ImageAltTextDialogOpen = defineComponent5({
|
|
|
1853
1856
|
field: t(
|
|
1854
1857
|
bad === "description" ? "imageAltText.description" : "imageAltText.titleLabel"
|
|
1855
1858
|
),
|
|
1856
|
-
message:
|
|
1857
|
-
}) : errors.form ?
|
|
1859
|
+
message: translateKeyOrText2(t, errors[bad])
|
|
1860
|
+
}) : errors.form ? translateKeyOrText2(t, errors.form) : "";
|
|
1858
1861
|
const field = (name, extra, children) => h3(
|
|
1859
1862
|
"section",
|
|
1860
1863
|
{
|
|
@@ -2034,7 +2037,7 @@ import {
|
|
|
2034
2037
|
picturePropertiesDraftFrom,
|
|
2035
2038
|
picturePropertiesWithValue,
|
|
2036
2039
|
translateDialogErrors as translateDialogErrors4,
|
|
2037
|
-
translateKeyOrText as
|
|
2040
|
+
translateKeyOrText as translateKeyOrText3,
|
|
2038
2041
|
validatePicturePropertiesDraft
|
|
2039
2042
|
} from "@pptx-editor.dev/core/editor";
|
|
2040
2043
|
var NUMBER_FIELDS = [
|
|
@@ -2141,8 +2144,8 @@ var ImagePropertiesDialogOpen = defineComponent6({
|
|
|
2141
2144
|
const bad = NUMBER_FIELDS.find((f) => errors[f]);
|
|
2142
2145
|
const error = bad ? t("imageProperties.fieldError", {
|
|
2143
2146
|
field: t(FIELD_LABELS[bad]),
|
|
2144
|
-
message:
|
|
2145
|
-
}) : errors.form ?
|
|
2147
|
+
message: translateKeyOrText3(t, errors[bad])
|
|
2148
|
+
}) : errors.form ? translateKeyOrText3(t, errors.form) : "";
|
|
2146
2149
|
const cropLocked = picture.value?.canCrop === false;
|
|
2147
2150
|
const sizeLocked = picture.value?.canResize === false;
|
|
2148
2151
|
const rotationLocked = picture.value?.canRotate === false;
|
|
@@ -2323,7 +2326,7 @@ import {
|
|
|
2323
2326
|
equationDraftCommand,
|
|
2324
2327
|
equationDraftFrom,
|
|
2325
2328
|
translateDialogErrors as translateDialogErrors5,
|
|
2326
|
-
translateKeyOrText as
|
|
2329
|
+
translateKeyOrText as translateKeyOrText4,
|
|
2327
2330
|
validateEquationDraft
|
|
2328
2331
|
} from "@pptx-editor.dev/core/editor";
|
|
2329
2332
|
var parts4 = createDialogParts("EquationDialog");
|
|
@@ -2372,7 +2375,7 @@ var EquationDialogOpen = defineComponent7({
|
|
|
2372
2375
|
return () => {
|
|
2373
2376
|
const { linear } = draft.values.value;
|
|
2374
2377
|
const errors = draft.errors.value;
|
|
2375
|
-
const error = errors.linear ?
|
|
2378
|
+
const error = errors.linear ? translateKeyOrText4(t, errors.linear) : errors.form ? translateKeyOrText4(t, errors.form) : "";
|
|
2376
2379
|
const title = t(edits ? "equation.editTitle" : "equation.insertTitle");
|
|
2377
2380
|
const defaults = h5(Fragment6, [
|
|
2378
2381
|
h5("div", { "data-pptx-part": "header", class: "pptx-dialog__header" }, [
|
|
@@ -2972,16 +2975,13 @@ import {
|
|
|
2972
2975
|
// src/slot.ts
|
|
2973
2976
|
import { computed as computed10, toValue as toValue5 } from "vue";
|
|
2974
2977
|
import {
|
|
2975
|
-
tooltipAttributes as tooltipAttributes2
|
|
2976
|
-
translateKeyOrText as translateKeyOrText4
|
|
2978
|
+
tooltipAttributes as tooltipAttributes2
|
|
2977
2979
|
} from "@pptx-editor.dev/core/editor";
|
|
2978
2980
|
function useSlot(slot, control) {
|
|
2979
2981
|
const cmd = useEditorCommand(slot);
|
|
2980
2982
|
const { t } = useTranslation();
|
|
2981
2983
|
const label = computed10(() => t(toValue5(control).labelKey));
|
|
2982
|
-
const reason =
|
|
2983
|
-
() => cmd.disabledReason.value ? translateKeyOrText4(t, cmd.disabledReason.value) : null
|
|
2984
|
-
);
|
|
2984
|
+
const reason = cmd.disabledReason;
|
|
2985
2985
|
const tip = computed10(() => tooltipAttributes2(label.value, !cmd.isEnabled.value, reason.value));
|
|
2986
2986
|
return { cmd, label, reason, tip };
|
|
2987
2987
|
}
|
|
@@ -7321,8 +7321,8 @@ var layoutGalleryProps = {
|
|
|
7321
7321
|
/** Show the tiles but take no pick. Default: true while the deck is open for viewing. */
|
|
7322
7322
|
disabled: { type: Boolean, default: void 0 },
|
|
7323
7323
|
/**
|
|
7324
|
-
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key
|
|
7325
|
-
* `useEditorCommand(slotId).disabledReason`)
|
|
7324
|
+
* Why the gallery takes no pick, for the tiles' tooltips: a catalog key or text
|
|
7325
|
+
* (such as `useEditorCommand(slotId).disabledReason`). Default: the viewing reason.
|
|
7326
7326
|
*/
|
|
7327
7327
|
disabledReason: { type: String, default: void 0 },
|
|
7328
7328
|
/** A class name added to the gallery, as React's `className`. A host `class` also works. */
|
|
@@ -8750,7 +8750,6 @@ import {
|
|
|
8750
8750
|
slideSorterMounted,
|
|
8751
8751
|
sorterKeyDown,
|
|
8752
8752
|
trackNotesInset,
|
|
8753
|
-
translateKeyOrText as translateKeyOrText20,
|
|
8754
8753
|
warnSlideSorterUnmounted
|
|
8755
8754
|
} from "@pptx-editor.dev/core/editor";
|
|
8756
8755
|
|
|
@@ -15628,9 +15627,7 @@ var ViewSwitch = defineComponent57({
|
|
|
15628
15627
|
const cmd = useEditorCommand("view.presentationView");
|
|
15629
15628
|
const options = STATUS_BAR_VIEW_OPTIONS;
|
|
15630
15629
|
const off = computed24(() => !cmd.isEnabled.value);
|
|
15631
|
-
const reason =
|
|
15632
|
-
() => cmd.disabledReason.value ? translateKeyOrText20(t, cmd.disabledReason.value) : null
|
|
15633
|
-
);
|
|
15630
|
+
const reason = cmd.disabledReason;
|
|
15634
15631
|
const offAttrs = useAriaDisabled(off, reason);
|
|
15635
15632
|
const pick = (e, step) => {
|
|
15636
15633
|
if (off.value) return;
|
|
@@ -15889,7 +15886,7 @@ var PptxEditorRoot = defineComponent59({
|
|
|
15889
15886
|
...props.readClipboardDrawing ? { readClipboardDrawing: props.readClipboardDrawing } : {},
|
|
15890
15887
|
...props.author ? { author: props.author } : {},
|
|
15891
15888
|
onFontError,
|
|
15892
|
-
translate: (key, params) =>
|
|
15889
|
+
translate: (key, params) => translateKeyOrText20(t.value, key, params)
|
|
15893
15890
|
});
|
|
15894
15891
|
createdFonts = props.fonts;
|
|
15895
15892
|
createdFamilies = props.fontFamilies;
|
|
@@ -15992,7 +15989,7 @@ var PptxEditorViewport = defineComponent59({
|
|
|
15992
15989
|
class: ["pptx-editor", dark.value ? "dark" : null, props.className],
|
|
15993
15990
|
...props.label === false ? {} : {
|
|
15994
15991
|
role: "region",
|
|
15995
|
-
"aria-label": props.label ?
|
|
15992
|
+
"aria-label": props.label ? translateKeyOrText20(t, props.label) : t("viewport.ariaLabel")
|
|
15996
15993
|
}
|
|
15997
15994
|
},
|
|
15998
15995
|
slots.default?.()
|
|
@@ -16876,7 +16873,7 @@ import {
|
|
|
16876
16873
|
ribbonInsertTab,
|
|
16877
16874
|
ribbonShownTab,
|
|
16878
16875
|
ribbonTabs,
|
|
16879
|
-
translateKeyOrText as
|
|
16876
|
+
translateKeyOrText as translateKeyOrText21,
|
|
16880
16877
|
warnRibbonChild
|
|
16881
16878
|
} from "@pptx-editor.dev/core/editor";
|
|
16882
16879
|
var ribbonTabProps = {
|
|
@@ -17000,7 +16997,7 @@ var PptxEditorRibbon = Object.assign(
|
|
|
17000
16997
|
layout.value,
|
|
17001
16998
|
specs,
|
|
17002
16999
|
props.preset,
|
|
17003
|
-
(key) =>
|
|
17000
|
+
(key) => translateKeyOrText21(t, key),
|
|
17004
17001
|
"PptxEditorRibbon.Tab"
|
|
17005
17002
|
);
|
|
17006
17003
|
insertTab = ribbonInsertTab(tabs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pptx-editor.dev/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Vue 3 adapter for PPTX Editor: a provider, composables, and chrome components over the @pptx-editor.dev/core editor contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"api:check": "node ../../scripts/api-extractor.mjs --package @pptx-editor.dev/vue"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pptx-editor.dev/i18n": "0.
|
|
31
|
+
"@pptx-editor.dev/i18n": "^0.7.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@pptx-editor.dev/core": "0.
|
|
34
|
+
"@pptx-editor.dev/core": "~0.7.0",
|
|
35
35
|
"vue": "^3.5.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|