Skip to content

Manifest reference: identity, values, versions ​

Define identity, capabilities and typed options in the manifest. The value kind controls validation and persistence; the selected editor controls presentation.

Version scope: these source-level examples target v2.0.0.alpha.14. Use the Plugin SDK for current Wasm plugin authoring.

The manifest is an input contract. Field names are case-sensitive. Unknown/duplicate fields, mismatched JSON types, and invalid defaults reject admission; behavior fields are not silently ignored.

Every root field ​

FieldRequiredMeaning/limits
formatYesExactly NTP/1
idYes1–128 ASCII characters, starts alphanumeric, then alphanumeric/./_/-
versionYesIndependent dotted theme version, e.g. 1.0.0; optional dotted prerelease suffix, not arbitrary hyphen SemVer
nameYesNonempty localized object, at most 64 keys of length 1–64
styleApiYesInteger 1
nssYesExactly NSS/1
stylesYes1–64 ordered relative .nss paths, unique ignoring case
requiredCapabilitiesNoUp to 128 exact names; every required capability must exist
optionalCapabilitiesNoUp to 128 {name,fallback} objects; no duplicates across both lists
optionsVersionNo1–65535, default 1; option schema, not content revision
optionsNoUp to 256 unique definitions
appearanceNoFinite appearance fields

Manifest budget: 64 KiB, JSON depth 16. General text is limited to 4096 characters and excludes NUL. Relative paths reject roots, traversal, links, and platform-ambiguous names. See package budgets.

Common option fields ​

json
{
  "id": "title-size", "kind": "Range", "control": "Slider",
  "default": 26, "min": 20, "max": 32, "step": 1,
  "label": {"zh-CN":"标题字号", "en-US":"Title size"},
  "description": {"zh-CN":"释放滑块后应用。", "en-US":"Applies after release."},
  "group": "style"
}
FieldContract
idStable unique ID, same character grammar as root ID; renaming creates a new option
kindPersisted type, independent of editor
defaultMust satisfy type, bounds, step, choices, and color grammar
labelRequired nonempty localized object; provide zh-CN/en-US for both languages
descriptionOptional localized explanation, not executable content
groupOptional group label, not a layout/editor factory
visibleWhenEditor visibility only; syntax
controlAutomatic/Switch/CheckBox/Slider/Segmented/Input, compatible kinds only
min, max, stepFinite Number/Range validation
choicesUp to 256 unique value plus localized label pairs
resourceKindRequired for file kinds: Image/Icon/Font/Audio/Video

All nine kinds ​

KindJSON defaultStored valueUse/constraint
BooleantrueBooleanToggles; not the string "true"
Number26Finite numberSize, etc.; Slider needs explicit bounds
Range25Finite numberOne stepped value, not an endpoint array
Text"sans-serif"StringFont family/declarative text, not automatically page content
Color"#68a5ff"Color string#RRGGBB/#RRGGBBAA; no CSS names in an option default
Select"compact"Choice valueNever localized label/index
File""Single path stringRequires source-bound authorization when selected
Files[]String arrayUp to 256 entries, not joined paths
Directory""Directory stringBounded enumeration, not arbitrary recursive access

File kinds require resourceKind; extensions do not infer permission. See complete valid definitions in workshop/theme.json.

Stepping is part of validity ​

A number must satisfy bounds and an integral (value - min) / step; Number uses zero as the step origin without min. Range defaults to 0–100, but explicit limits are clearer.

Range/numeric Slider require increasing bounds, positive step within the span, absolute bounds at most 1e12, and at most 1e9 increments. Do not use inferred defaults instead of designing a range.

For min 0, max 10, step 3, valid values are 0/3/6/9. Right edge, End, and increment stop at 9. A default of 10 rejects admission rather than being silently snapped and persisted.

Source identity and schema versions ​

version identifies a content release; optionsVersion identifies option schema. A color fix need not bump the schema. Type, choice-value, and step changes require thinking about previously saved values and testing the new source.

Options are keyed by source identity and schema. Another package with the same theme ID inherits no external grants. Export/import carries values, not read authority. Missing grants stay missing; NTP does not execute migration scripts.

Rejection examples ​

InputProblemCorrection
Boolean default "false"Wrong JSON typefalse
Default 10 with min 0/step 3Off step9 or a genuinely different step
File without resourceKindUnknown resource authorityDeclare Image/Font/etc.
Select default is translated labelNot a choice valuePersist stable value
appearance.scriptUnknown behavior fieldKeep themes declarative; use an admitted extension

Implementation references ​

Check your result ​

Check defaults, bounds and type mismatches, then reopen the theme to verify committed values.

Site documentation: CC BY-SA 4.0. Imported SDK documents: Apache-2.0 as marked.