Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(attributes): pick a system attribute's value from the set it allows
Elian Doran19546b86bcfd
diff --git a/apps/client/src/services/attributes.spec.ts b/apps/client/src/services/attributes.spec.tsindex 69c27e1fd8..950b5468b7 100644--- a/apps/client/src/services/attributes.spec.ts+++ b/apps/client/src/services/attributes.spec.ts@@ -1,7 +1,10 @@import { beforeEach, describe, expect, it, vi } from "vitest";import { buildNote } from "../test/easy-froca";-import attributeService, { getBuiltinLabelValueType, isBuiltinAttribute, removeOwnedAttributesByNameOrType, setAttribute, setBooleanWithInheritance, setLabel, setRelation } from "./attributes";+import { allViewTypes } from "../widgets/collections/interface";+import { getPresentationThemes } from "../widgets/collections/presentation/themes";+import { MEDIA_PLAY_MODES } from "../widgets/type_widgets/file/media_play_mode";+import attributeService, { getBuiltinLabelSelectOptions, getBuiltinLabelValueType, isBuiltinAttribute, removeOwnedAttributesByNameOrType, setAttribute, setBooleanWithInheritance, setLabel, setRelation } from "./attributes";import froca from "./froca";import server from "./server.js";@@ -432,6 +435,27 @@ describe("isBuiltinAttribute", () => {expect(getBuiltinLabelValueType("myOwnLabel")).toBeUndefined();});+ it("reports the choices of a built-in closed set, and nothing for anything else", () => {+ expect(getBuiltinLabelValueType("sortDirection")).toBe("select");+ expect(getBuiltinLabelSelectOptions("sortDirection")).toEqual([ "asc", "desc" ]);+ // A built-in label of any other type has no choices to offer, nor has a name Trilium+ // attaches no meaning to.+ expect(getBuiltinLabelSelectOptions("color")).toBeUndefined();+ expect(getBuiltinLabelSelectOptions("myOwnLabel")).toBeUndefined();+ });++ it("offers the same choices the widgets reading those labels act on", () => {+ // The lists live in two places by necessity — the vocabulary is shared, the widgets are the+ // client's — so drift between them is caught here rather than by an unexplained blank field.+ expect(getBuiltinLabelSelectOptions("viewType")).toEqual([ ...allViewTypes ]);+ // "Play once" is the absence of the label, so it is the one mode not offered as a value.+ expect(getBuiltinLabelSelectOptions("mediaNotesPlayMode"))+ .toEqual(MEDIA_PLAY_MODES.filter((mode) => mode !== "once"));+ // The stored value is the theme's id, not the name the collection properties show.+ expect(getBuiltinLabelSelectOptions("presentation:theme"))+ .toEqual(getPresentationThemes().map((theme) => theme.id));+ });+it("matches exactly, so prefixed names are not built-ins", () => {// A definition describes a built-in without being one, and a disabled one is inert.expect(isBuiltinAttribute("label", "label:archived")).toBe(false);diff --git a/apps/client/src/services/attributes.ts b/apps/client/src/services/attributes.tsindex 8949b87264..3f110627a1 100644--- a/apps/client/src/services/attributes.ts+++ b/apps/client/src/services/attributes.ts@@ -1,4 +1,4 @@-import { AttributeType, BUILTIN_ATTRIBUTES, type LabelType } from "@triliumnext/commons";+import { AttributeType, BUILTIN_ATTRIBUTES, type BuiltinLabel, type LabelType } from "@triliumnext/commons";import type FNote from "../entities/fnote.js";import froca from "./froca.js";@@ -235,11 +235,22 @@ const BUILTIN_ATTRIBUTE_KEYS = new Set(BUILTIN_ATTRIBUTES.map(({ type, name }) =* carries a definition string rather than a value of the type it describes.*/export function getBuiltinLabelValueType(name: string): LabelType | undefined {- return BUILTIN_LABEL_VALUE_TYPES.get(name);+ return BUILTIN_LABELS.get(name)?.valueType;}-const BUILTIN_LABEL_VALUE_TYPES = new Map<string, LabelType>(- BUILTIN_ATTRIBUTES.flatMap((attr) => attr.type === "label" ? [ [ attr.name, attr.valueType ] as const ] : [])+/**+ * The values a built-in label of the `select` type accepts, or `undefined` for every other name —+ * whether it is a label of another type or none of Trilium's at all.+ *+ * The list is what to *offer*, not what to allow: a value outside it is kept and shown, since the sets+ * grow between versions and a note may have been written by a newer one.+ */+export function getBuiltinLabelSelectOptions(name: string): readonly string[] | undefined {+ return BUILTIN_LABELS.get(name)?.selectOptions;+}++const BUILTIN_LABELS = new Map<string, BuiltinLabel>(+ BUILTIN_ATTRIBUTES.flatMap((attr) => attr.type === "label" ? [ [ attr.name, attr ] as const ] : []));export default {diff --git a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsxindex c33f547849..b50b6b3a9c 100644--- a/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx+++ b/apps/client/src/widgets/attribute_widgets/attribute_detail.tsx@@ -8,7 +8,7 @@ import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, uimport appContext from "../../components/app_context.js";import { isDefinitionName } from "../../entities/fattribute.js";import type { Attribute } from "../../services/attribute_parser.js";-import { getBuiltinLabelValueType, isBuiltinAttribute } from "../../services/attributes.js";+import { getBuiltinLabelSelectOptions, getBuiltinLabelValueType, isBuiltinAttribute } from "../../services/attributes.js";import { isExperimentalFeatureEnabled } from "../../services/experimental_features.js";import { focusSavedElement, saveFocusedElement } from "../../services/focus.js";import froca from "../../services/froca.js";@@ -374,12 +374,19 @@ export function AttributeForm({ opts, attrType: initialAttrType, currentNoteId,const nameRef = useRef<HTMLInputElement>(null);/*** A system label whose value has a kind of its own is typed into the field that fits it — a palette- * for `#color`, a date picker for `#startDate`. The rest keep the autocomplete, which is worth more- * to them than a plain box would be: it offers the values the name has been given before.+ * for `#color`, a date picker for `#startDate`, a dropdown of the choices for `#sortDirection`. The+ * rest keep the autocomplete, which is worth more to them than a plain box would be: it offers the+ * values the name has been given before.*/- const typedInput = useMemo(- () => attrType === "label" ? getTypedInputForLabel(getBuiltinLabelValueType(name)) : undefined,- [ attrType, name ]);+ const typedInput = useMemo(() => {+ if (attrType !== "label") {+ return undefined;+ }+ const labelType = getTypedInputForLabel(getBuiltinLabelValueType(name));+ // The options belong to the name, not to a definition the user wrote, so they are read from the+ // same place the type came from rather than passed in.+ return labelType && { labelType, selectOptions: getBuiltinLabelSelectOptions(name) };+ }, [ attrType, name ]);// The values known for a label name never change while the popup is open, so they are fetched// once per name and filtered locally afterwards.const knownValues = useRef<{ name: string; values: string[] }>();@@ -542,10 +549,21 @@ export function AttributeForm({ opts, attrType: initialAttrType, currentNoteId,{typedInput ? (<div className="input-group"><LabelValueInput- labelType={typedInput}+ labelType={typedInput.labelType}+ selectOptions={typedInput.selectOptions}value={value}onCommit={commitValue}- inputProps={{ className: "form-control attr-input-value", readOnly: !isOwned }}+ inputProps={{+ className: "form-control attr-input-value",+ readOnly: !isOwned,+ // Names the dropdown's empty entry, which would otherwise be a+ // blank row one has to guess the meaning of. Only for a select:+ // for the typed boxes it would override the placeholder the+ // field sets for itself.+ ...(typedInput.labelType === "select" && {+ placeholder: t("promoted_attributes.unset-field-placeholder")+ })+ }}/></div>) : (diff --git a/apps/client/src/widgets/attribute_widgets/label_value_input.spec.tsx b/apps/client/src/widgets/attribute_widgets/label_value_input.spec.tsxindex afc49a8d02..ca3e146431 100644--- a/apps/client/src/widgets/attribute_widgets/label_value_input.spec.tsx+++ b/apps/client/src/widgets/attribute_widgets/label_value_input.spec.tsx@@ -27,6 +27,9 @@ describe("getTypedInputForLabel", () => {expect(getTypedInputForLabel(getBuiltinLabelValueType("startTime"))).toBe("time");expect(getTypedInputForLabel(getBuiltinLabelValueType("docUrl"))).toBe("url");expect(getTypedInputForLabel(getBuiltinLabelValueType("pageSize"))).toBe("number");+ // A system label that is a closed set is picked from rather than typed into.+ expect(getTypedInputForLabel(getBuiltinLabelValueType("sortDirection"))).toBe("select");+ expect(getTypedInputForLabel(getBuiltinLabelValueType("viewType"))).toBe("select");// `#calendar:startDate` names the label a date is read from, so it is a name, not a date.expect(getTypedInputForLabel(getBuiltinLabelValueType("calendar:startDate"))).toBeUndefined();@@ -150,6 +153,16 @@ describe("LabelValueInput", () => {expect(onCommit).toHaveBeenCalledWith("Done");});+ it("locks a select a host marked read-only, which a browser would otherwise let through", async () => {+ await mount({+ labelType: "select", value: "Todo", selectOptions: [ "Todo", "Done" ],+ onCommit: vi.fn(), inputProps: { readOnly: true }+ });++ // `readonly` is inert on a dropdown, so it has to arrive as `disabled` instead.+ expect(container.querySelector("select")?.disabled).toBe(true);+ });+describe("creatable select combobox", () => {/** Lets the debounced suggestion fetch run; the dropdown is portaled to the body. */async function settleDropdown() {diff --git a/apps/client/src/widgets/attribute_widgets/label_value_input.tsx b/apps/client/src/widgets/attribute_widgets/label_value_input.tsxindex f8e6e59afa..fc82ebeffd 100644--- a/apps/client/src/widgets/attribute_widgets/label_value_input.tsx+++ b/apps/client/src/widgets/attribute_widgets/label_value_input.tsx@@ -79,8 +79,11 @@ interface LabelValueInputProps {commitOn?: "input" | "blur";/** How many decimals a number field steps by, from the definition that declared it. */numberPrecision?: number;- /** The values a select field offers, from the definition that declared it. */- selectOptions?: string[];+ /**+ * The values a select field offers: from the definition that declared it, or — for a system label+ * that is a closed set of its own — from the built-in vocabulary.+ */+ selectOptions?: readonly string[];/*** Called when the user asks a select field for a choice its definition does not offer yet;* expected to add it to the definition, while the value itself still arrives via `onCommit`.@@ -155,8 +158,13 @@ export default function LabelValueInput({...extraProps,...inputProps,// Bootstrap draws the chevron for `form-select`, which the host — handing the class of a- // field one types into — has no reason to know to pass.- ...(isSelect && { className: clsx(inputProps?.className, "form-select") }),+ // field one types into — has no reason to know to pass. `readOnly` is likewise translated:+ // a host marks a field it does not own with it, but a browser only honours it on a box one+ // types into, so a read-only dropdown would be freely changeable.+ ...(isSelect && {+ className: clsx(inputProps?.className, "form-select"),+ disabled: inputProps?.disabled || inputProps?.readOnly+ }),// After the host's props, so that a host cannot leave the value uncommitted by supplying// its own. A select commits as it is picked even for a host that commits on blur: there is// nothing to type into it, so waiting for the blur would only hold a made choice back.@@ -231,7 +239,7 @@ const CREATE_OPTION_SENTINEL = "\u0000";* the empty value: clearing is a choice of its own, and cannot pollute the definition.*/function SelectComboBox({ options, value, onCommit, onCreateOption, inputProps }: {- options: string[];+ options: readonly string[];value: string;onCommit: (value: string) => void;onCreateOption: (option: string) => void | Promise<void>;@@ -350,7 +358,7 @@ function highlightMatch(text: string, filter: string) {* options, then the stored value if the options no longer name it (renamed or removed since it was* picked), so that what the note holds is shown rather than silently blanked.*/-function selectOptionElements(options: string[], value: string, placeholder?: string) {+function selectOptionElements(options: readonly string[], value: string, placeholder?: string) {const entries = [ ...options ];if (value && !options.includes(value)) {entries.push(value);diff --git a/apps/client/src/widgets/dialogs/print_preview.tsx b/apps/client/src/widgets/dialogs/print_preview.tsxindex 2a92c8a7b5..76a1f5007f 100644--- a/apps/client/src/widgets/dialogs/print_preview.tsx+++ b/apps/client/src/widgets/dialogs/print_preview.tsx@@ -3,6 +3,7 @@ import "./print_preview.css";import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";import FNote from "../../entities/fnote";+import { getBuiltinLabelSelectOptions } from "../../services/attributes";import { t } from "../../services/i18n";import toast from "../../services/toast";import Button, { ButtonGroup } from "../react/Button";@@ -17,7 +18,11 @@ import PdfViewer from "../type_widgets/file/PdfViewer";import OptionsRow from "../type_widgets/options/components/OptionsRow";import OptionsSection from "../type_widgets/options/components/OptionsSection";-const PAGE_SIZES = ["A0", "A1", "A2", "A3", "A4", "A5", "A6", "Legal", "Letter", "Tabloid", "Ledger"] as const;+/**+ * Read from the `#printPageSize` label's own vocabulary rather than listed again here: the dialog+ * stores what it picks in that label, and the attribute editor offers the same list back.+ */+const PAGE_SIZES = getBuiltinLabelSelectOptions("printPageSize") ?? [];/** Pseudo-printer name used to route the Print button to the PDF export flow. */const DESTINATION_PDF = "__pdf__";diff --git a/packages/commons/src/lib/builtin_attributes.spec.ts b/packages/commons/src/lib/builtin_attributes.spec.tsindex 8b2d5e9701..dc00e2ff2c 100644--- a/packages/commons/src/lib/builtin_attributes.spec.ts+++ b/packages/commons/src/lib/builtin_attributes.spec.ts@@ -19,6 +19,29 @@ describe("BUILTIN_ATTRIBUTES", () => {}});+ it("gives every closed set its choices, and nothing else choices to offer", () => {+ const selectNames: string[] = [];++ for (const attr of BUILTIN_ATTRIBUTES) {+ if (attr.type !== "label") continue;++ if (attr.valueType !== "select") {+ expect(attr.selectOptions, `${attr.name} offers choices but is not a select`).toBeUndefined();+ continue;+ }++ selectNames.push(attr.name);+ const options = attr.selectOptions ?? [];+ expect(options.length, `${attr.name} offers nothing to pick`).toBeGreaterThan(0);+ // A blank is what an empty field already says, and a duplicate is two identical rows.+ expect(new Set(options).size, `${attr.name} repeats an option`).toBe(options.length);+ expect(options.filter((option) => option.trim() === ""), `${attr.name} offers a blank`).toEqual([]);+ }++ // Guards against the whole set being dropped, which would leave the loop above vacuous.+ expect(selectNames).toContain("sortDirection");+ });+it("marks a value as user-authored only where a value exists to author", () => {// Relations always point at a note ID, so `hasUserValue` would be meaningless on one.const flaggedRelations = BUILTIN_ATTRIBUTESdiff --git a/packages/commons/src/lib/builtin_attributes.ts b/packages/commons/src/lib/builtin_attributes.tsindex 4850917df3..a9bbc3ed5d 100644--- a/packages/commons/src/lib/builtin_attributes.ts+++ b/packages/commons/src/lib/builtin_attributes.ts@@ -10,20 +10,12 @@ import { type LabelType } from "./promoted_attribute_definition_parser.js";*//**- * A label, i.e. an attribute carrying a value.+ * What every label carries regardless of the kind of value it holds; see {@link BuiltinLabel}, which+ * pairs this with the value type and whatever that type needs alongside it.*/-export interface BuiltinLabel {+interface BuiltinLabelCommon {type: "label";name: string;- /**- * What kind of value the label holds. Not enforced at runtime — attribute values are always stored- * as strings — but it types the `useNoteLabel*` hooks via {@link FilterLabelsByType}, and tells the- * attribute editor which field to offer.- *- * Deliberately the same vocabulary a promoted attribute definition declares, rather than one of its- * own: a system label and a user's promoted field describe the same thing when they say `color`.- */- valueType: LabelType;/*** Whether the attribute executes or embeds content, and so must be neutralised on import.* Dangerous attributes can be deactivated by prefixing them with `disabled:`, which is where the@@ -38,6 +30,40 @@ export interface BuiltinLabel {hasUserValue?: boolean;}+/**+ * A label, i.e. an attribute carrying a value.+ *+ * The `valueType` says what kind of value it holds. Not enforced at runtime — attribute values are+ * always stored as strings — but it types the `useNoteLabel*` hooks via {@link FilterLabelsByType},+ * and tells the attribute editor which field to offer.+ *+ * Deliberately the same vocabulary a promoted attribute definition declares, rather than one of its+ * own: a system label and a user's promoted field describe the same thing when they say `color`.+ *+ * Written as a union rather than as one shape with an optional list, so that the two halves of a+ * `select` cannot come apart: a closed set must name its choices, and a label of any other type+ * cannot carry choices that nothing would ever offer.+ */+export type BuiltinLabel = BuiltinLabelCommon & (+ | {+ valueType: "select";+ /**+ * The values the label accepts, in the order they are offered — the *stored* spellings, not+ * display names, since that is what the attribute editor writes and what the code reading+ * the label compares against.+ *+ * A value outside this list is still shown rather than dropped: the editor appends whatever+ * the note holds to the list it offers, so a label written by a newer version, by a script or+ * by hand survives being looked at.+ */+ selectOptions: readonly string[];+ }+ | {+ valueType: Exclude<LabelType, "select">;+ selectOptions?: never;+ }+);+/*** A relation, i.e. an attribute pointing at a note. Its value is always a note ID, so it needs neither* a value type nor a {@link BuiltinLabel.hasUserValue} marker.@@ -59,7 +85,10 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "disableInclusion", valueType: "boolean" },{ type: "label", name: "appCss", valueType: "boolean" },{ type: "label", name: "appTheme", valueType: "text" },- { type: "label", name: "appThemeBase", valueType: "text" },+ // The stock theme a custom one is layered over; `next` follows the colour scheme in use.+ { type: "label", name: "appThemeBase", valueType: "select", selectOptions: [+ "next", "next-light", "next-dark"+ ] },{ type: "label", name: "hidePromotedAttributes", valueType: "boolean" },{ type: "label", name: "readOnly", valueType: "boolean" },{ type: "label", name: "autoReadOnlyDisabled", valueType: "boolean" },@@ -98,7 +127,9 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "quarterNote", valueType: "text", hasUserValue: true },{ type: "label", name: "yearNote", valueType: "text", hasUserValue: true },{ type: "label", name: "pageSize", valueType: "number" },- { type: "label", name: "viewType", valueType: "text" },+ { type: "label", name: "viewType", valueType: "select", selectOptions: [+ "list", "grid", "calendar", "table", "geoMap", "board", "presentation", "dashboard"+ ] },{ type: "label", name: "mapRootNoteId", valueType: "text" },{ type: "label", name: "mapExcludeRelation", valueType: "text" },{ type: "label", name: "mapIncludeRelation", valueType: "text" },@@ -106,7 +137,7 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "excludeFromNoteMap", valueType: "boolean" },{ type: "label", name: "bookmarkFolder", valueType: "boolean" },{ type: "label", name: "sorted", valueType: "boolean" },- { type: "label", name: "sortDirection", valueType: "text" },+ { type: "label", name: "sortDirection", valueType: "select", selectOptions: [ "asc", "desc" ] },{ type: "label", name: "sortFoldersFirst", valueType: "boolean" },{ type: "label", name: "sortNatural", valueType: "boolean" },{ type: "label", name: "sortLocale", valueType: "text" },@@ -137,7 +168,11 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "shareDisallowRobotIndexing", valueType: "boolean" },{ type: "label", name: "shareCredentials", valueType: "text", hasUserValue: true },{ type: "label", name: "shareIndex", valueType: "boolean" },- { type: "label", name: "shareHtmlLocation", valueType: "text" },+ // Where a `~shareHtml` snippet is injected into the shared page. A bare `head`/`body`/`content` is+ // read as its `:end`, but the full spellings are what the theme documents and what is offered.+ { type: "label", name: "shareHtmlLocation", valueType: "select", selectOptions: [+ "head:start", "head:end", "body:start", "body:end", "content:start", "content:end"+ ] },// Attributes & scripting{ type: "label", name: "displayRelations", valueType: "text" },@@ -148,7 +183,8 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "snippetDescription", valueType: "text", hasUserValue: true },{ type: "label", name: "textSnippet", valueType: "boolean" },{ type: "label", name: "textSnippetDescription", valueType: "text", hasUserValue: true },- { type: "label", name: "toc", valueType: "text" },+ // Forces the table of contents open or shut; without the label the heading count decides.+ { type: "label", name: "toc", valueType: "select", selectOptions: [ "show", "hide" ] },{ type: "label", name: "color", valueType: "color" },{ type: "label", name: "keepCurrentHoisting", valueType: "boolean" },{ type: "label", name: "executeButton", valueType: "boolean" },@@ -156,10 +192,15 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "executeTitle", valueType: "text", hasUserValue: true },{ type: "label", name: "newNotesOnTop", valueType: "boolean" },{ type: "label", name: "clipperInbox", valueType: "boolean" },- { type: "label", name: "clipType", valueType: "text" },+ // Stamped by the web clipper on what it saves, recording which of its actions produced the note.+ { type: "label", name: "clipType", valueType: "select", selectOptions: [+ "clippings", "page", "note", "tabs"+ ] },{ type: "label", name: "sentFromSender", valueType: "boolean" },{ type: "label", name: "hideChildrenOverview", valueType: "boolean" },- { type: "label", name: "mediaNotesPlayMode", valueType: "text" },+ // Set on the folder, for its media children. "Play once" is the absence of the label, so it is not+ // among the choices: leaving the field empty is what says it.+ { type: "label", name: "mediaNotesPlayMode", valueType: "select", selectOptions: [ "loop", "next" ] },{ type: "label", name: "collection", valueType: "boolean" },{ type: "label", name: "webViewSrc", valueType: "url", isDangerous: true },{ type: "label", name: "hideHighlightWidget", valueType: "boolean" },@@ -170,21 +211,34 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "originalFileName", valueType: "text", hasUserValue: true },{ type: "label", name: "pageUrl", valueType: "url", hasUserValue: true },{ type: "label", name: "command", valueType: "text", hasUserValue: true },- { type: "label", name: "displayMode", valueType: "text", hasUserValue: true },+ // Which half of the split editor a code-like note opens on; without it the read-only state decides.+ { type: "label", name: "displayMode", valueType: "select", hasUserValue: true, selectOptions: [+ "source", "split", "preview"+ ] },// Search{ type: "label", name: "searchString", valueType: "text", hasUserValue: true },{ type: "label", name: "ancestorDepth", valueType: "text", hasUserValue: true },{ type: "label", name: "orderBy", valueType: "text", hasUserValue: true },- { type: "label", name: "orderDirection", valueType: "text", hasUserValue: true },+ { type: "label", name: "orderDirection", valueType: "select", hasUserValue: true, selectOptions: [+ "asc", "desc"+ ] },{ type: "label", name: "limit", valueType: "text", hasUserValue: true },{ type: "label", name: "fastSearch", valueType: "boolean" },{ type: "label", name: "includeArchivedNotes", valueType: "boolean" },{ type: "label", name: "debug", valueType: "boolean" },// Launch bar, and the hidden subtree items that back it- { type: "label", name: "launcherType", valueType: "text" },- { type: "label", name: "builtinWidget", valueType: "text" },+ { type: "label", name: "launcherType", valueType: "select", selectOptions: [+ "command", "note", "script", "builtinWidget", "customWidget"+ ] },+ // Only read when the launcher is of the `builtinWidget` type above; each names a widget the+ // launch bar knows how to build.+ { type: "label", name: "builtinWidget", valueType: "select", selectOptions: [+ "calendar", "spacer", "bookmarks", "protectedSession", "syncStatus", "backInHistoryButton",+ "forwardInHistoryButton", "todayInJournal", "quickSearch", "mobileTabSwitcher", "sidebarChat",+ "colorSchemeSwitcher"+ ] },// Dangerous together with `~script` below: it makes the launcher run its own content instead, so// neutralising only the relation would leave this as a way around it.{ type: "label", name: "scriptInLauncherContent", valueType: "boolean", isDangerous: true },@@ -210,7 +264,10 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "isHidden", valueType: "boolean" },{ type: "label", name: "maxNestingDepth", valueType: "number", hasUserValue: true },{ type: "label", name: "includeArchived", valueType: "boolean", hasUserValue: true },- { type: "label", name: "calendar:view", valueType: "text", hasUserValue: true },+ // FullCalendar's own view names, which is what the calendar hands back when the view is switched.+ { type: "label", name: "calendar:view", valueType: "select", hasUserValue: true, selectOptions: [+ "timeGridDay", "timeGridWeek", "dayGridMonth", "multiMonthYear", "listMonth"+ ] },{ type: "label", name: "calendar:initialDate", valueType: "date", hasUserValue: true },{ type: "label", name: "calendar:hideWeekends", valueType: "boolean", hasUserValue: true },{ type: "label", name: "calendar:weekNumbers", valueType: "boolean", hasUserValue: true },@@ -230,11 +287,18 @@ const BUILTIN_ATTRIBUTES = [{ type: "label", name: "endTime", valueType: "time", hasUserValue: true },{ type: "label", name: "recurrence", valueType: "text", hasUserValue: true },{ type: "label", name: "geolocation", valueType: "text", hasUserValue: true },- { type: "label", name: "mapType", valueType: "text", hasUserValue: true },+ // Which note map a note map note draws; anything but `tree` is read as `link`.+ { type: "label", name: "mapType", valueType: "select", hasUserValue: true, selectOptions: [+ "link", "tree"+ ] },{ type: "label", name: "map:style", valueType: "text", hasUserValue: true },{ type: "label", name: "map:scale", valueType: "boolean", hasUserValue: true },{ type: "label", name: "map:hideLabels", valueType: "boolean", hasUserValue: true },- { type: "label", name: "presentation:theme", valueType: "text", hasUserValue: true },+ // Reveal.js' own stock themes, which is what the presentation bundles; anything else falls back+ // to `white`.+ { type: "label", name: "presentation:theme", valueType: "select", hasUserValue: true, selectOptions: [+ "black", "white", "beige", "serif", "simple", "solarized", "moon", "dracula", "sky", "blood"+ ] },{ type: "label", name: "slide:background", valueType: "text", hasUserValue: true },// Code notes@@ -244,7 +308,9 @@ const BUILTIN_ATTRIBUTES = [// Printing{ type: "label", name: "printLandscape", valueType: "boolean" },- { type: "label", name: "printPageSize", valueType: "text" },+ { type: "label", name: "printPageSize", valueType: "select", selectOptions: [+ "A0", "A1", "A2", "A3", "A4", "A5", "A6", "Legal", "Letter", "Tabloid", "Ledger"+ ] },{ type: "label", name: "printScale", valueType: "text" },{ type: "label", name: "printMargins", valueType: "text" },{ type: "label", name: "internalBookmark", valueType: "boolean" },