@sdeck/plugin 0.4.3 → 0.5.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/dist/create.d.ts +5 -1
- package/dist/create.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -20
- package/dist/index.js.map +9 -8
- package/dist/manifest.d.ts +16 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/oauth.d.ts +46 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/plugin.d.ts +35 -4
- package/dist/plugin.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/create.ts +6 -0
- package/src/index.ts +9 -0
- package/src/manifest.ts +23 -3
- package/src/oauth.ts +52 -0
- package/src/plugin.ts +50 -16
- package/src/settings.ts +1 -1
package/dist/create.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Permission } from "./permissions.ts";
|
|
2
|
-
import { type Action, type ActionDef, type Deactivate, type Onboarding, type OptionSource, type PluginCommand, type PluginContext, type PluginDef, type StateDef, type Trigger, type TriggerDef } from "./plugin.ts";
|
|
2
|
+
import { type Action, type ActionDef, type Deactivate, type Onboarding, type OptionSource, type PluginCommand, type PluginContext, type PluginDef, type PluginLink, type StateDef, type Trigger, type TriggerDef } from "./plugin.ts";
|
|
3
3
|
import type { InferSettings, SelectOption, SettingsSchema } from "./settings.ts";
|
|
4
4
|
/** A plugin's context with its own settings typed. */
|
|
5
5
|
export interface TypedContext<S extends SettingsSchema> extends PluginContext {
|
|
@@ -20,6 +20,8 @@ export interface PluginParts<S extends SettingsSchema> {
|
|
|
20
20
|
/** What `plugin.source` made. */
|
|
21
21
|
sources?: readonly Source[];
|
|
22
22
|
commands?: readonly PluginCommand[];
|
|
23
|
+
/** What `plugin.link` made. */
|
|
24
|
+
links?: readonly PluginLink[];
|
|
23
25
|
onboarding?: Onboarding;
|
|
24
26
|
activate?(context: TypedContext<S>): void | Deactivate | Promise<void | Deactivate>;
|
|
25
27
|
}
|
|
@@ -70,6 +72,8 @@ export interface PluginBuilder<S extends SettingsSchema, P extends Permission> {
|
|
|
70
72
|
source(id: string, load: (context: TypedContext<S>, settings: Readonly<Record<string, unknown>>) => SelectOption[] | Promise<SelectOption[]>): Source;
|
|
71
73
|
/** A button in the plugin's settings. */
|
|
72
74
|
command(def: PluginCommand<TypedContext<S>, P>): PluginCommand;
|
|
75
|
+
/** Something `sdeck://plugin/<plugin>/<id>?…` runs. Any website can open one. */
|
|
76
|
+
link(def: PluginLink<TypedContext<S>, P>): PluginLink;
|
|
73
77
|
/** The finished plugin, for the module's default export. Only the parts listed are in it. */
|
|
74
78
|
define(parts: PluginParts<S>): PluginDef;
|
|
75
79
|
}
|
package/dist/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,UAAU,EAIf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,UAAU,EAIf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cA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AAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KACxC,YAAY,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,GAC5C,MAAM,CAAC;IACV,yCAAyC;IACzC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC;IAC/D,iFAAiF;IACjF,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC;IACtD,6FAA6F;IAC7F,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAC1B,KAAK,CAAC,CAAC,SAAS,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACrD,KAAK,CAAC,CAAC,SAAS,UAAU,GAAG,KAAK,EAClC,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAgE7C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export { type HostBridge, HostBridgeContext, useExpression, useHostState, useIma
|
|
|
9
9
|
export { type ConnectionOptions, type ConnectionState, type Link, ManagedConnection, PermanentError, } from "./connection.ts";
|
|
10
10
|
export { createPlugin, type PluginBase, type PluginBuilder, type PluginParts, type Source, type StateHandle, type TypedContext, } from "./create.ts";
|
|
11
11
|
export { type ChoiceField, type Choices, type SourceRef, setting } from "./fields.ts";
|
|
12
|
-
export { HOST_MODULES, type ManifestResult, manifestIcon, PLUGIN_KEYWORD, type PluginManifest, parseManifest, SUPPORTED_API_VERSIONS, } from "./manifest.ts";
|
|
12
|
+
export { HOST_MODULES, type ManifestResult, manifestIcon, manifestPermissions, PLUGIN_KEYWORD, type PluginManifest, parseManifest, SUPPORTED_API_VERSIONS, } from "./manifest.ts";
|
|
13
|
+
export { OAuthError, type OAuthService, type OAuthSignIn, type OAuthTokens, type PluginOAuth, } from "./oauth.ts";
|
|
13
14
|
export { PERMISSION_TEXTS, PERMISSIONS, type Permission, PermissionError, Permissions, type PermissionText, } from "./permissions.ts";
|
|
14
|
-
export { type Action, type ActionDef, type ActionProps, type ActionValue, BUTTON_VALUES, checkPlugin, type Deactivate, type DeckControls, defineAction, definePlugin, defineTrigger, type Onboarding, type OnboardingStep, type OptionSource, type Overlay, type OverlayProps, onSettingsChange, PLUGIN_API_VERSION, type PlacedButton, type PluginCommand, type PluginContext, type PluginDef, pluginNamespace, type RunContext, type RunFn, type RunOutcome, type RunResult, type SlotKind, type StarterPage, type StateDef, type StatusLevel, type Trigger, type TriggerContext, type TriggerDef, } from "./plugin.ts";
|
|
15
|
+
export { type Action, type ActionDef, type ActionProps, type ActionValue, BUTTON_VALUES, checkPlugin, type Deactivate, type DeckControls, defineAction, definePlugin, defineTrigger, type Onboarding, type OnboardingStep, type OptionSource, type Overlay, type OverlayProps, onSettingsChange, PLUGIN_API_VERSION, type PlacedButton, type PluginCommand, type PluginContext, type PluginDef, type PluginLink, pluginNamespace, type RunContext, type RunFn, type RunOutcome, type RunResult, type SlotKind, type StarterPage, type StateDef, type StatusLevel, type Trigger, type TriggerContext, type TriggerDef, } from "./plugin.ts";
|
|
15
16
|
export { type BooleanField, behaviorFields, type ColorField, checkSchema, defaultValue, type FieldValue, type GroupsField, type ImageField, type InferSettings, isFieldVisible, liveSettings, type NumberField, type OptionGroup, optionGroups, type PageField, resolveSettings, type SecretField, type SelectField, type SelectOption, type SettingField, type SettingsSchema, type SettingValue, type SlotsField, slotList, type TextField, } from "./settings.ts";
|
|
16
17
|
export { following, Shared, useShared } from "./shared.ts";
|
|
17
18
|
export { fitText, layoutText, type TextLayout, type TextLayoutOptions, type TextRow, } from "./text.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,KAAK,SAAS,EACd,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,UAAU,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,iBAAiB,EACjB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EACL,YAAY,EACZ,KAAK,cAAc,EACnB,YAAY,EACZ,cAAc,EACd,KAAK,cAAc,EACnB,aAAa,EACb,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,KAAK,UAAU,EACf,eAAe,EACf,WAAW,EACX,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,aAAa,EACb,WAAW,EACX,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,eAAe,EACf,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,UAAU,EACf,WAAW,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,QAAQ,EACR,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,KAAK,SAAS,EACd,SAAS,EACT,UAAU,EACV,cAAc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ClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,eAAe,EACf,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,UAAU,EACf,WAAW,EACX,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,cAAc,EACd,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,QAAQ,EACR,KAAK,SAAS,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,OAAO,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -391,7 +391,7 @@ function optionGroups(value) {
|
|
|
391
391
|
];
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
-
var SLOT = /^(window|(key|sensor):\d{1,3})$/;
|
|
394
|
+
var SLOT = /^(window|(key|sensor|dial):\d{1,3})$/;
|
|
395
395
|
function slotList(value) {
|
|
396
396
|
if (!Array.isArray(value))
|
|
397
397
|
return;
|
|
@@ -493,7 +493,7 @@ function checkSchema(schema, sources = {}) {
|
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
// src/plugin.ts
|
|
496
|
-
var PLUGIN_API_VERSION =
|
|
496
|
+
var PLUGIN_API_VERSION = 6;
|
|
497
497
|
var BUTTON_VALUES = ["on", "held", "index", "label", "running", "flash", "error"];
|
|
498
498
|
var ID = /^(@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/;
|
|
499
499
|
var NAMESPACE = /^[a-z][\w-]{0,31}$/;
|
|
@@ -573,19 +573,22 @@ function checkPlugin(value) {
|
|
|
573
573
|
problems.push(`plugin ${p}`);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
576
|
+
for (const kind of ["command", "link"]) {
|
|
577
|
+
const items = def[`${kind}s`];
|
|
578
|
+
if (items === undefined)
|
|
579
|
+
continue;
|
|
580
|
+
if (!Array.isArray(items)) {
|
|
581
|
+
problems.push(`${kind}s must be an array`);
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
checkLocalIds(kind, items, problems);
|
|
585
|
+
for (const item of items) {
|
|
586
|
+
const at = `${kind} "${typeof item?.id === "string" ? item.id : "?"}"`;
|
|
587
|
+
if (typeof item?.name !== "string")
|
|
588
|
+
problems.push(`${at}: name is required`);
|
|
589
|
+
if (typeof item?.run !== "function")
|
|
590
|
+
problems.push(`${at}: run is required`);
|
|
591
|
+
problems.push(...checkNeeds(at, item?.permissions, def.permissions));
|
|
589
592
|
}
|
|
590
593
|
}
|
|
591
594
|
if (def.onboarding !== undefined)
|
|
@@ -630,9 +633,11 @@ function checkPlugin(value) {
|
|
|
630
633
|
problems.push(`action "${name}": look must be a function`);
|
|
631
634
|
}
|
|
632
635
|
const slots = action?.slots ?? ["key"];
|
|
633
|
-
if (!Array.isArray(slots) || slots.length === 0 || slots.some((s) => !["key", "sensor", "window"].includes(s))) {
|
|
634
|
-
problems.push(`action "${name}": slots must list "key", "sensor" and/or "window"`);
|
|
636
|
+
if (!Array.isArray(slots) || slots.length === 0 || slots.some((s) => !["key", "sensor", "dial", "window"].includes(s))) {
|
|
637
|
+
problems.push(`action "${name}": slots must list "key", "sensor", "dial" and/or "window"`);
|
|
635
638
|
}
|
|
639
|
+
if (action?.turn && !hasRun)
|
|
640
|
+
problems.push(`action "${name}": turn needs run`);
|
|
636
641
|
for (const p of checkSchema(action?.settings ?? {}, sources)) {
|
|
637
642
|
problems.push(`action "${name}": ${p}`);
|
|
638
643
|
}
|
|
@@ -717,6 +722,7 @@ function checkOnboarding(def) {
|
|
|
717
722
|
const used = [
|
|
718
723
|
...Object.values(page.keys ?? {}),
|
|
719
724
|
...Object.values(page.sensors ?? {}),
|
|
725
|
+
...Object.values(page.dials ?? {}),
|
|
720
726
|
...page.window ? [page.window] : []
|
|
721
727
|
];
|
|
722
728
|
for (const { action } of used) {
|
|
@@ -768,6 +774,7 @@ function createPlugin(base) {
|
|
|
768
774
|
},
|
|
769
775
|
source: (id, load) => ({ id, load }),
|
|
770
776
|
command: (def) => def,
|
|
777
|
+
link: (def) => def,
|
|
771
778
|
define: ({ state, sources, activate, ...parts }) => definePlugin({
|
|
772
779
|
...base,
|
|
773
780
|
...parts,
|
|
@@ -853,12 +860,16 @@ var HOST_MODULES = [
|
|
|
853
860
|
"@sdeck/engine",
|
|
854
861
|
"@sdeck/schema"
|
|
855
862
|
];
|
|
856
|
-
var SUPPORTED_API_VERSIONS = [1, 2, 3, PLUGIN_API_VERSION];
|
|
863
|
+
var SUPPORTED_API_VERSIONS = [1, 2, 3, 4, 5, PLUGIN_API_VERSION];
|
|
857
864
|
var ICON = /^(?:icon:)?([a-z0-9]{1,12}\/[A-Za-z0-9-]{1,80}(?:#[0-9a-fA-F]{6})?)$/;
|
|
858
865
|
function manifestIcon(pkg) {
|
|
859
866
|
const icon = pkg?.sdeck?.icon;
|
|
860
867
|
return typeof icon === "string" ? ICON.exec(icon)?.[1] : undefined;
|
|
861
868
|
}
|
|
869
|
+
function manifestPermissions(pkg) {
|
|
870
|
+
const listed = pkg?.sdeck?.permissions;
|
|
871
|
+
return Array.isArray(listed) ? PERMISSIONS.filter((p) => listed.includes(p)) : undefined;
|
|
872
|
+
}
|
|
862
873
|
function parseManifest(pkg) {
|
|
863
874
|
if (!pkg || typeof pkg !== "object")
|
|
864
875
|
return { ok: false, error: "package.json is not an object" };
|
|
@@ -878,6 +889,7 @@ function parseManifest(pkg) {
|
|
|
878
889
|
}
|
|
879
890
|
const entry = typeof sdeck.entry === "string" ? sdeck.entry : typeof p.main === "string" ? p.main : "index.js";
|
|
880
891
|
const icon = manifestIcon(pkg);
|
|
892
|
+
const permissions = manifestPermissions(pkg);
|
|
881
893
|
return {
|
|
882
894
|
ok: true,
|
|
883
895
|
manifest: {
|
|
@@ -886,10 +898,20 @@ function parseManifest(pkg) {
|
|
|
886
898
|
...typeof p.description === "string" && { description: p.description },
|
|
887
899
|
entry,
|
|
888
900
|
apiVersion,
|
|
889
|
-
...icon && { icon }
|
|
901
|
+
...icon && { icon },
|
|
902
|
+
...permissions && { permissions }
|
|
890
903
|
}
|
|
891
904
|
};
|
|
892
905
|
}
|
|
906
|
+
// src/oauth.ts
|
|
907
|
+
class OAuthError extends Error {
|
|
908
|
+
code;
|
|
909
|
+
name = "OAuthError";
|
|
910
|
+
constructor(message, code) {
|
|
911
|
+
super(message);
|
|
912
|
+
this.code = code;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
893
915
|
// src/shared.ts
|
|
894
916
|
import { useCallback as useCallback2, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
895
917
|
|
|
@@ -1107,6 +1129,7 @@ export {
|
|
|
1107
1129
|
HOST_MODULES,
|
|
1108
1130
|
HostBridgeContext,
|
|
1109
1131
|
ManagedConnection,
|
|
1132
|
+
OAuthError,
|
|
1110
1133
|
PERMISSIONS,
|
|
1111
1134
|
PERMISSION_TEXTS,
|
|
1112
1135
|
PLUGIN_API_VERSION,
|
|
@@ -1136,6 +1159,7 @@ export {
|
|
|
1136
1159
|
layoutText,
|
|
1137
1160
|
liveSettings,
|
|
1138
1161
|
manifestIcon,
|
|
1162
|
+
manifestPermissions,
|
|
1139
1163
|
onSettingsChange,
|
|
1140
1164
|
optionGroups,
|
|
1141
1165
|
parseManifest,
|
|
@@ -1152,4 +1176,4 @@ export {
|
|
|
1152
1176
|
useVariable
|
|
1153
1177
|
};
|
|
1154
1178
|
|
|
1155
|
-
//# debugId=
|
|
1179
|
+
//# debugId=219D814E57BF9CF264756E2164756E21
|