@appkit/dek-lib 0.25.0 → 0.26.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/index.es.js CHANGED
@@ -45200,6 +45200,7 @@ const dekUiModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
45200
45200
  View: u0,
45201
45201
  formatDateTime: Yt2,
45202
45202
  formatFromNow: Gt2,
45203
+ getImageAsBase64: uG1,
45203
45204
  theme: C1,
45204
45205
  useDateTime: qt2,
45205
45206
  useInterval: Ut2
@@ -49798,8 +49799,8 @@ const Zone = (props) => {
49798
49799
  if (zones.length > 1) {
49799
49800
  const components = [];
49800
49801
  zones.forEach((zone2) => {
49801
- if (zone2.plugin && zone2.component) {
49802
- const component = api2.plugin(zone2.plugin).component(zone2.component, {
49802
+ if (zone2.integration && zone2.component) {
49803
+ const component = api2.integration(zone2.integration).component(zone2.component, {
49803
49804
  ...parsePropsForComponent(api2, zone2.props),
49804
49805
  "aria-label": `zone-${props.id}`
49805
49806
  });
@@ -49830,9 +49831,9 @@ const Zone = (props) => {
49830
49831
  const zone = api2.board.zones.find(
49831
49832
  (z) => z.key === props.id
49832
49833
  );
49833
- if (zone && zone.plugin && zone.component) {
49834
- label = `${props.id}: ${zone.plugin}/${zone.component}`;
49835
- const component = api2.plugin(zone.plugin).component(zone.component, {
49834
+ if (zone && zone.integration && zone.component) {
49835
+ label = `${props.id}: ${zone.integration}/${zone.component}`;
49836
+ const component = api2.integration(zone.integration).component(zone.component, {
49836
49837
  ...parsePropsForComponent(api2, zone.props),
49837
49838
  "aria-label": `zone-${props.id}`
49838
49839
  });
@@ -50616,10 +50617,10 @@ class Registry {
50616
50617
  }
50617
50618
  const registry = new Registry();
50618
50619
  const globals = {
50619
- boards: {},
50620
- commandGroups: {},
50620
+ boards: [],
50621
+ commandGroups: [],
50621
50622
  plugins: {},
50622
- pluginInstances: {},
50623
+ integrationInstances: {},
50623
50624
  setLocation: () => {
50624
50625
  },
50625
50626
  registry,
@@ -66257,11 +66258,11 @@ async function getClient(email, password) {
66257
66258
  cache: new InMemoryCache()
66258
66259
  });
66259
66260
  }
66260
- const UserDataDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "userData" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "currentUser" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "location" } }, { "kind": "Field", "name": { "kind": "Name", "value": "avatar" } }, { "kind": "Field", "name": { "kind": "Name", "value": "boards" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "layout" } }, { "kind": "Field", "name": { "kind": "Name", "value": "zones" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "plugin" } }, { "kind": "Field", "name": { "kind": "Name", "value": "component" } }, { "kind": "Field", "name": { "kind": "Name", "value": "props" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "containerProps" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "commandGroups" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "commands" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "plugin" } }, { "kind": "Field", "name": { "kind": "Name", "value": "component" } }, { "kind": "Field", "name": { "kind": "Name", "value": "props" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }] } }] } }] };
66261
+ const UserDataDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "userData" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "currentUser" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "location" } }, { "kind": "Field", "name": { "kind": "Name", "value": "avatar" } }, { "kind": "Field", "name": { "kind": "Name", "value": "boards" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "layout" } }, { "kind": "Field", "name": { "kind": "Name", "value": "base" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "integration" } }, { "kind": "Field", "name": { "kind": "Name", "value": "key" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "zones" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "integration" } }, { "kind": "Field", "name": { "kind": "Name", "value": "component" } }, { "kind": "Field", "name": { "kind": "Name", "value": "props" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "containerProps" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "commandGroups" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "commands" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "title" } }, { "kind": "Field", "name": { "kind": "Name", "value": "integration" } }, { "kind": "Field", "name": { "kind": "Name", "value": "component" } }, { "kind": "Field", "name": { "kind": "Name", "value": "props" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "containerProps" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }] } }] } }] };
66261
66262
  const UserPluginsAndIntegrationsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "userPluginsAndIntegrations" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "currentUser" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "plugins" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "code" } }, { "kind": "Field", "name": { "kind": "Name", "value": "version" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "integrations" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "pluginName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "pluginVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "pluginConfig" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "key" } }, { "kind": "Field", "name": { "kind": "Name", "value": "value" } }] } }] } }] } }] } }] };
66262
66263
  const UserChangeDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "userChange" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userChange" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "user" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] } }] };
66263
66264
  const documents = {
66264
- "\n query userData {\n currentUser {\n id\n name\n email\n location\n avatar\n boards {\n id\n title\n key\n layout\n zones {\n key\n plugin\n component\n props {\n key\n value\n }\n containerProps {\n key\n value\n }\n }\n }\n commandGroups {\n title\n key\n commands {\n title\n plugin\n component\n props {\n key\n value\n }\n }\n }\n }\n }\n": UserDataDocument,
66265
+ "\n query userData {\n currentUser {\n id\n name\n email\n location\n avatar\n boards {\n id\n title\n key\n layout\n base {\n integration\n key\n }\n zones {\n key\n integration\n component\n props {\n key\n value\n }\n containerProps {\n key\n value\n }\n }\n }\n commandGroups {\n title\n key\n commands {\n title\n integration\n component\n props {\n key\n value\n }\n containerProps {\n key\n value\n }\n }\n }\n }\n }\n": UserDataDocument,
66265
66266
  "\n query userPluginsAndIntegrations {\n currentUser {\n plugins {\n name\n code\n version\n }\n integrations {\n key\n pluginName\n pluginVersion\n pluginConfig {\n key\n value\n }\n }\n }\n }\n": UserPluginsAndIntegrationsDocument,
66266
66267
  "\n subscription userChange {\n userChange {\n user {\n id\n }\n }\n }\n": UserChangeDocument
66267
66268
  };
@@ -66281,9 +66282,13 @@ const USER_DATA_QUERY = gql(`
66281
66282
  title
66282
66283
  key
66283
66284
  layout
66285
+ base {
66286
+ integration
66287
+ key
66288
+ }
66284
66289
  zones {
66285
66290
  key
66286
- plugin
66291
+ integration
66287
66292
  component
66288
66293
  props {
66289
66294
  key
@@ -66300,12 +66305,16 @@ const USER_DATA_QUERY = gql(`
66300
66305
  key
66301
66306
  commands {
66302
66307
  title
66303
- plugin
66308
+ integration
66304
66309
  component
66305
66310
  props {
66306
66311
  key
66307
66312
  value
66308
66313
  }
66314
+ containerProps {
66315
+ key
66316
+ value
66317
+ }
66309
66318
  }
66310
66319
  }
66311
66320
  }
@@ -66346,13 +66355,13 @@ const state$1 = proxy({
66346
66355
  data: null,
66347
66356
  loading: false
66348
66357
  });
66349
- let pluginInstances = {};
66350
- function getPluginInstances() {
66351
- return pluginInstances;
66358
+ let globalIntegrationInstances = {};
66359
+ function getIntegrationInstances() {
66360
+ return globalIntegrationInstances;
66352
66361
  }
66353
- function updateStatePlugins(plugins, instances) {
66354
- pluginInstances = instances;
66355
- state$1.plugins = plugins;
66362
+ function updateStatePlugins(pluginFactories, integrationInstances2) {
66363
+ globalIntegrationInstances = integrationInstances2;
66364
+ state$1.plugins = pluginFactories;
66356
66365
  }
66357
66366
  function updateStateData(data) {
66358
66367
  state$1.data = data;
@@ -66382,7 +66391,7 @@ async function updateData(email, password, plugin) {
66382
66391
  key: "dev",
66383
66392
  title: "Test Board",
66384
66393
  base: {
66385
- plugin: "base",
66394
+ integration: "base",
66386
66395
  key: "dev"
66387
66396
  },
66388
66397
  zones: []
@@ -66533,8 +66542,8 @@ class Api {
66533
66542
  messages() {
66534
66543
  return this.internal.messages();
66535
66544
  }
66536
- plugin(name) {
66537
- return this.internal.plugin(name);
66545
+ integration(key) {
66546
+ return this.internal.integration(key);
66538
66547
  }
66539
66548
  get registry() {
66540
66549
  return this.internal.registry;
@@ -66566,26 +66575,26 @@ class Api {
66566
66575
  open(boardKey) {
66567
66576
  this.internal.open(boardKey);
66568
66577
  }
66569
- get plugins() {
66570
- return this.internal.plugins;
66578
+ get integrations() {
66579
+ return this.internal.integrations;
66571
66580
  }
66572
66581
  get api() {
66573
- return this.plugin(this.integrationKey).api;
66582
+ return this.integration(this.integrationKey).api;
66574
66583
  }
66575
66584
  get state() {
66576
- return this.plugin(this.integrationKey).state;
66585
+ return this.integration(this.integrationKey).state;
66577
66586
  }
66578
66587
  get info() {
66579
- return this.plugin(this.integrationKey).info;
66588
+ return this.integration(this.integrationKey).info;
66580
66589
  }
66581
66590
  component(key, props) {
66582
- return this.plugin(this.integrationKey).component(key, props);
66591
+ return this.integration(this.integrationKey).component(key, props);
66583
66592
  }
66584
66593
  componentSchema(key) {
66585
- return this.plugin(this.integrationKey).componentSchema(key);
66594
+ return this.integration(this.integrationKey).componentSchema(key);
66586
66595
  }
66587
66596
  screen(path) {
66588
- return this.plugin(this.integrationKey).screen(path);
66597
+ return this.integration(this.integrationKey).screen(path);
66589
66598
  }
66590
66599
  }
66591
66600
  class ApiInternal {
@@ -66619,8 +66628,8 @@ class ApiInternal {
66619
66628
  messages() {
66620
66629
  return this.globals.messages;
66621
66630
  }
66622
- plugin(name) {
66623
- return this.createPluginWrapper(name);
66631
+ integration(key) {
66632
+ return this.createIntegrationWrapper(key);
66624
66633
  }
66625
66634
  get registry() {
66626
66635
  return this.globals.registry;
@@ -66633,6 +66642,8 @@ class ApiInternal {
66633
66642
  }
66634
66643
  get board() {
66635
66644
  return this.boards.find((board) => board.key === this.boardKey) || {
66645
+ title: "Missing board",
66646
+ key: "#error",
66636
66647
  zones: []
66637
66648
  };
66638
66649
  }
@@ -66654,20 +66665,20 @@ class ApiInternal {
66654
66665
  open(boardKey) {
66655
66666
  this.globals.setLocation(`/${boardKey}`);
66656
66667
  }
66657
- createPluginWrapper(integrationKey) {
66658
- const plugin = this.getPluginInstance(integrationKey);
66659
- const available = !!plugin;
66668
+ createIntegrationWrapper(integrationKey) {
66669
+ const integration = this.getIntegrationInstance(integrationKey);
66670
+ const available = !!integration;
66660
66671
  return {
66661
66672
  available,
66662
66673
  info: {
66663
- components: (plugin == null ? void 0 : plugin.components) ? plugin.components.map((component) => component.key) : [],
66664
- screens: (plugin == null ? void 0 : plugin.screens) ? plugin.screens.map((screen) => screen.path) : []
66674
+ components: (integration == null ? void 0 : integration.components) ? integration.components.map((component) => component.key) : [],
66675
+ screens: (integration == null ? void 0 : integration.screens) ? integration.screens.map((screen) => screen.path) : []
66665
66676
  },
66666
66677
  component: (key, props) => this.getComponent(integrationKey, key, props),
66667
66678
  componentSchema: (key) => this.getComponentSchema(integrationKey, key),
66668
66679
  screen: (path) => this.getScreen(integrationKey, path),
66669
66680
  board: (key) => this.getBoard(integrationKey, key),
66670
- api: (plugin == null ? void 0 : plugin.api) || {},
66681
+ api: (integration == null ? void 0 : integration.api) || {},
66671
66682
  state: {
66672
66683
  get: (key, defaultValue) => {
66673
66684
  if (!available) {
@@ -66687,20 +66698,20 @@ class ApiInternal {
66687
66698
  get globals() {
66688
66699
  return window.__dek_globals;
66689
66700
  }
66690
- get plugins() {
66691
- const plugins = {};
66692
- Object.keys(this.globals.pluginInstances).forEach((key) => {
66693
- plugins[key] = this.createPluginWrapper(key);
66701
+ get integrations() {
66702
+ const integrations = {};
66703
+ Object.keys(this.globals.integrationInstances).forEach((key) => {
66704
+ integrations[key] = this.createIntegrationWrapper(key);
66694
66705
  });
66695
- return plugins;
66706
+ return integrations;
66696
66707
  }
66697
- getPluginInstance(integrationKey) {
66698
- return this.globals.pluginInstances[integrationKey];
66708
+ getIntegrationInstance(integrationKey) {
66709
+ return this.globals.integrationInstances[integrationKey];
66699
66710
  }
66700
66711
  getComponent(integrationKey, componentKey, props) {
66701
- const plugin = this.getPluginInstance(integrationKey);
66702
- if (plugin) {
66703
- const component = plugin.components && plugin.components.find(
66712
+ const integration = this.getIntegrationInstance(integrationKey);
66713
+ if (integration) {
66714
+ const component = integration.components && integration.components.find(
66704
66715
  (c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
66705
66716
  );
66706
66717
  if (!component) {
@@ -66708,15 +66719,15 @@ class ApiInternal {
66708
66719
  }
66709
66720
  return component.element({
66710
66721
  ...props,
66711
- plugin,
66722
+ plugin: integration,
66712
66723
  api: new Api(integrationKey)
66713
66724
  });
66714
66725
  }
66715
66726
  }
66716
66727
  getComponentSchema(integrationKey, componentKey) {
66717
- const plugin = this.getPluginInstance(integrationKey);
66718
- if (plugin) {
66719
- const component = plugin.components && plugin.components.find(
66728
+ const integration = this.getIntegrationInstance(integrationKey);
66729
+ if (integration) {
66730
+ const component = integration.components && integration.components.find(
66720
66731
  (c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
66721
66732
  );
66722
66733
  if (component) {
@@ -66727,29 +66738,35 @@ class ApiInternal {
66727
66738
  }
66728
66739
  getScreen(integrationKey, screenPath) {
66729
66740
  if (integrationKey) {
66730
- const plugin = this.getPluginInstance(integrationKey);
66731
- if (plugin) {
66732
- const component = plugin.screens && plugin.screens.find(
66741
+ const integration = this.getIntegrationInstance(integrationKey);
66742
+ if (integration) {
66743
+ const component = integration.screens && integration.screens.find(
66733
66744
  (s4) => s4.path.toLowerCase() === screenPath.toLowerCase()
66734
66745
  );
66735
66746
  if (!component) {
66736
66747
  return;
66737
66748
  }
66738
- return component.element({ plugin, api: new Api(integrationKey) });
66749
+ return component.element({
66750
+ plugin: integration,
66751
+ api: new Api(integrationKey)
66752
+ });
66739
66753
  }
66740
66754
  }
66741
66755
  }
66742
66756
  getBoard(integrationKey, boardKey) {
66743
66757
  if (integrationKey) {
66744
- const plugin = this.getPluginInstance(integrationKey);
66745
- if (plugin) {
66746
- const component = plugin.boards && plugin.boards.find(
66758
+ const integration = this.getIntegrationInstance(integrationKey);
66759
+ if (integration) {
66760
+ const component = integration.boards && integration.boards.find(
66747
66761
  (c2) => c2.key.toLowerCase() === boardKey.toLowerCase()
66748
66762
  );
66749
66763
  if (!component) {
66750
66764
  return;
66751
66765
  }
66752
- return component.element({ plugin, api: new Api(integrationKey) });
66766
+ return component.element({
66767
+ plugin: integration,
66768
+ api: new Api(integrationKey)
66769
+ });
66753
66770
  }
66754
66771
  }
66755
66772
  }
@@ -66832,7 +66849,7 @@ async function fetchUserPlugins(email, password) {
66832
66849
  result.integrations.push({
66833
66850
  key: "base",
66834
66851
  pluginName: "base",
66835
- pluginVersion: "0.25.0",
66852
+ pluginVersion: "0.26.0",
66836
66853
  pluginConfig: []
66837
66854
  });
66838
66855
  return result;
@@ -67007,7 +67024,7 @@ const Header = ({ height = 70 }) => {
67007
67024
  };
67008
67025
  const About = () => {
67009
67026
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(u0, { padding: 20, direction: "vert", children: [
67010
- /* @__PURE__ */ jsxRuntimeExports.jsx(PU1, { children: `Dek ${"0.25.0"}` }),
67027
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PU1, { children: `Dek ${"0.26.0"}` }),
67011
67028
  /* @__PURE__ */ jsxRuntimeExports.jsx(h4, { children: "From Appkit" })
67012
67029
  ] });
67013
67030
  };
@@ -67022,7 +67039,7 @@ const Backgrounds = ({ api: api2 }) => {
67022
67039
  const handleSelection = (key) => {
67023
67040
  setSelectedKey(key);
67024
67041
  console.log("handleSelection", { key });
67025
- api2.plugin("base").state.set("backgroundKey", key);
67042
+ api2.integration("base").state.set("backgroundKey", key);
67026
67043
  };
67027
67044
  const menuItems = Object.keys(backgroundItems).map((key) => {
67028
67045
  const item = backgroundItems[key];
@@ -67057,7 +67074,7 @@ const Backgrounds = ({ api: api2 }) => {
67057
67074
  value: backgroundProps[key] || prop.default,
67058
67075
  onChange: (value) => {
67059
67076
  backgroundProps[key] = value;
67060
- api2.plugin("base").state.set(propsKey, JSON.stringify(backgroundProps));
67077
+ api2.integration("base").state.set(propsKey, JSON.stringify(backgroundProps));
67061
67078
  }
67062
67079
  }
67063
67080
  ) });
@@ -67074,7 +67091,7 @@ const Backgrounds = ({ api: api2 }) => {
67074
67091
  value: backgroundProps[key],
67075
67092
  onChange: (option) => {
67076
67093
  backgroundProps[key] = option.value;
67077
- api2.plugin("base").state.set(propsKey, JSON.stringify(backgroundProps));
67094
+ api2.integration("base").state.set(propsKey, JSON.stringify(backgroundProps));
67078
67095
  }
67079
67096
  }
67080
67097
  ) });
@@ -67089,7 +67106,7 @@ const Backgrounds = ({ api: api2 }) => {
67089
67106
  color: backgroundProps[key] || prop.default,
67090
67107
  onChange: (color) => {
67091
67108
  backgroundProps[key] = color;
67092
- api2.plugin("base").state.set(propsKey, JSON.stringify(backgroundProps));
67109
+ api2.integration("base").state.set(propsKey, JSON.stringify(backgroundProps));
67093
67110
  }
67094
67111
  }
67095
67112
  );
@@ -67143,11 +67160,11 @@ const Messages = ({ api: api2 }) => {
67143
67160
  )) });
67144
67161
  };
67145
67162
  const PluginDev = ({ api: api2 }) => {
67146
- const plugin = api2.plugin("plugin");
67163
+ const integration = api2.integration("plugin");
67147
67164
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(u0, { children: [
67148
67165
  /* @__PURE__ */ jsxRuntimeExports.jsxs(u0, { padding: 20, collapse: true, direction: "vert", children: [
67149
67166
  /* @__PURE__ */ jsxRuntimeExports.jsx(PU1, { paddingBottom: 15, children: "Components" }),
67150
- /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { direction: "horz", collapse: true, children: plugin && plugin.info.components.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
67167
+ /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { direction: "horz", collapse: true, children: integration && integration.info.components.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
67151
67168
  yt2,
67152
67169
  {
67153
67170
  title: component,
@@ -67156,7 +67173,7 @@ const PluginDev = ({ api: api2 }) => {
67156
67173
  }
67157
67174
  ) }, component)) }),
67158
67175
  /* @__PURE__ */ jsxRuntimeExports.jsx(PU1, { paddingBottom: 15, paddingTop: 50, children: "Screens" }),
67159
- /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { direction: "horz", collapse: true, children: plugin && plugin.info.screens.map((screen) => /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
67176
+ /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { direction: "horz", collapse: true, children: integration && integration.info.screens.map((screen) => /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
67160
67177
  yt2,
67161
67178
  {
67162
67179
  title: screen,
@@ -67408,7 +67425,7 @@ const Theme = ({ api: api2 }) => {
67408
67425
  ] });
67409
67426
  };
67410
67427
  const SettingsScreen = ({ api: api2, isPluginDev }) => {
67411
- const isPrivatePluginDev = !isPluginDev && api2.plugin("plugin").available;
67428
+ const isPrivatePluginDev = !isPluginDev && api2.integration("plugin").available;
67412
67429
  const [selectedKey, setSelectedKey] = usePluginState(
67413
67430
  api2,
67414
67431
  "settings-screen-key",
@@ -71453,7 +71470,7 @@ const greetings = {
71453
71470
  ]
71454
71471
  };
71455
71472
  const Greeting = ({ api: api2 }) => {
71456
- const calendarPlugin = api2.plugin("calendar");
71473
+ const calendarPlugin = api2.integration("calendar");
71457
71474
  const events2 = calendarPlugin.api.useEvents();
71458
71475
  const getGreeting = () => {
71459
71476
  const d = /* @__PURE__ */ new Date();
@@ -98470,7 +98487,7 @@ const ComponentScreen = ({ api: api2 }) => {
98470
98487
  const [error2, setError] = useState$1(void 0);
98471
98488
  useEffect$1(() => {
98472
98489
  if (propsString === "") {
98473
- const plugin = api2.plugin("plugin");
98490
+ const plugin = api2.integration("plugin");
98474
98491
  setPropsString(
98475
98492
  JSON.stringify(
98476
98493
  schemaToProps(plugin.componentSchema(params.componentKey)),
@@ -98512,7 +98529,7 @@ const ComponentScreen = ({ api: api2 }) => {
98512
98529
  }
98513
98530
  };
98514
98531
  const handleReset = () => {
98515
- const plugin = api2.plugin("plugin");
98532
+ const plugin = api2.integration("plugin");
98516
98533
  setPropsString(
98517
98534
  JSON.stringify(
98518
98535
  schemaToProps(plugin.componentSchema(params.componentKey)),
@@ -98575,7 +98592,7 @@ const ComponentScreen = ({ api: api2 }) => {
98575
98592
  ) }),
98576
98593
  error2 && /* @__PURE__ */ jsxRuntimeExports.jsx(h4, { color: "red", paddingLeft: 15, paddingTop: 10, children: error2 })
98577
98594
  ] }) }),
98578
- /* @__PURE__ */ jsxRuntimeExports.jsx(St2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { halign: "left", valign: "center", children: propsString && api2.plugin("plugin").component(
98595
+ /* @__PURE__ */ jsxRuntimeExports.jsx(St2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(u0, { halign: "left", valign: "center", children: propsString && api2.integration("plugin").component(
98579
98596
  params.componentKey,
98580
98597
  parsePropsForComponent(api2, propsArray)
98581
98598
  ) }) })
@@ -102555,16 +102572,16 @@ class Plugin3 {
102555
102572
  ];
102556
102573
  }
102557
102574
  }
102558
- const builtinPlugins = {
102575
+ const builtinPluginFactories = {
102559
102576
  base: Plugin$2,
102560
102577
  calendar: Plugin$1,
102561
102578
  "home-assistant": Plugin3
102562
102579
  };
102563
102580
  const pluginVersions = {};
102564
- const loadedDekPlugins = {};
102565
- const loadedDekPluginInstances = {};
102566
- let loadedLocalPlugin;
102567
- let loadedLocalPluginInstance;
102581
+ const userPluginFactories = {};
102582
+ const integrationInstances = {};
102583
+ let localPluginFactory;
102584
+ let localIntegrationInstance;
102568
102585
  async function loadUserPlugin(name, version2, code) {
102569
102586
  try {
102570
102587
  const module2 = {};
@@ -102595,7 +102612,7 @@ async function loadUserPlugin(name, version2, code) {
102595
102612
  return null;
102596
102613
  }
102597
102614
  }
102598
- function constructPluginInstance(integration, plugin, pluginConfig = {}) {
102615
+ function constructIntegrationInstance(integration, plugin, pluginConfig = {}) {
102599
102616
  const pluginConfigMerged = {
102600
102617
  plugin: integration.pluginName,
102601
102618
  version: integration.pluginVersion || pluginVersions[integration.pluginName] || "latest",
@@ -102607,14 +102624,14 @@ function constructPluginInstance(integration, plugin, pluginConfig = {}) {
102607
102624
  }
102608
102625
  return new plugin(pluginConfigMerged, registry);
102609
102626
  }
102610
- async function initializePluginInstance(pluginInstance, integrationKey) {
102611
- if (pluginInstance && pluginInstance.load) {
102612
- await pluginInstance.load(getPluginApi(integrationKey));
102627
+ async function initializeIntegrationInstance(integrationInstance, integrationKey) {
102628
+ if (integrationInstance && integrationInstance.load) {
102629
+ await integrationInstance.load(getPluginApi(integrationKey));
102613
102630
  }
102614
102631
  }
102615
- async function initializePluginInstances() {
102616
- for (const key of Object.keys(loadedDekPluginInstances)) {
102617
- await initializePluginInstance(loadedDekPluginInstances[key], key);
102632
+ async function initializeIntegrationInstances() {
102633
+ for (const key of Object.keys(integrationInstances)) {
102634
+ await initializeIntegrationInstance(integrationInstances[key], key);
102618
102635
  }
102619
102636
  }
102620
102637
  async function loadPlugins({
@@ -102623,59 +102640,62 @@ async function loadPlugins({
102623
102640
  }) {
102624
102641
  if (plugins) {
102625
102642
  for (const plugin of plugins) {
102626
- const userPlugin = await loadUserPlugin(
102643
+ const userPluginFactory = await loadUserPlugin(
102627
102644
  plugin.name,
102628
102645
  plugin.version,
102629
102646
  plugin.code
102630
102647
  );
102631
- if (userPlugin) {
102632
- loadedDekPlugins[plugin.name] = userPlugin;
102648
+ if (userPluginFactory) {
102649
+ userPluginFactories[plugin.name] = userPluginFactory;
102633
102650
  }
102634
102651
  }
102635
102652
  }
102636
102653
  if (integrations) {
102637
102654
  for (const integration of integrations) {
102638
- const Plugin4 = builtinPlugins[integration.pluginName] || loadedDekPlugins[integration.pluginName];
102639
- if (Plugin4) {
102640
- const pluginInstance = constructPluginInstance(integration, Plugin4);
102641
- loadedDekPluginInstances[integration.key] = pluginInstance;
102655
+ const plugin = builtinPluginFactories[integration.pluginName] || userPluginFactories[integration.pluginName];
102656
+ if (plugin) {
102657
+ const integrationInstance = constructIntegrationInstance(
102658
+ integration,
102659
+ plugin
102660
+ );
102661
+ integrationInstances[integration.key] = integrationInstance;
102642
102662
  }
102643
102663
  }
102644
- await initializePluginInstances();
102664
+ await initializeIntegrationInstances();
102645
102665
  }
102646
102666
  }
102647
102667
  async function unloadAllPlugins() {
102648
- while (Object.keys(loadedDekPluginInstances).length > 0) {
102649
- const key = Object.keys(loadedDekPluginInstances)[0];
102650
- const plugin = loadedDekPluginInstances[key];
102668
+ while (Object.keys(integrationInstances).length > 0) {
102669
+ const key = Object.keys(integrationInstances)[0];
102670
+ const plugin = integrationInstances[key];
102651
102671
  if (plugin && plugin.unload) {
102652
102672
  await plugin.unload();
102653
102673
  }
102654
- delete loadedDekPluginInstances[key];
102674
+ delete integrationInstances[key];
102655
102675
  }
102656
- while (Object.keys(loadedDekPlugins).length > 0) {
102657
- const key = Object.keys(loadedDekPlugins)[0];
102658
- delete loadedDekPlugins[key];
102676
+ while (Object.keys(userPluginFactories).length > 0) {
102677
+ const key = Object.keys(userPluginFactories)[0];
102678
+ delete userPluginFactories[key];
102659
102679
  }
102660
102680
  }
102661
- function getAllPlugins() {
102662
- const allPlugins = {
102663
- ...builtinPlugins,
102664
- ...loadedDekPlugins
102681
+ function getAllPluginFactories() {
102682
+ const results = {
102683
+ ...builtinPluginFactories,
102684
+ ...userPluginFactories
102665
102685
  };
102666
- if (loadedLocalPlugin) {
102667
- allPlugins.plugin = loadedLocalPlugin;
102686
+ if (localPluginFactory) {
102687
+ results.plugin = localPluginFactory;
102668
102688
  }
102669
- return allPlugins;
102689
+ return results;
102670
102690
  }
102671
- function getAllPluginInstances() {
102672
- const allPluginInstances = {
102673
- ...loadedDekPluginInstances
102691
+ function getAllIntegrationInstances() {
102692
+ const results = {
102693
+ ...integrationInstances
102674
102694
  };
102675
- if (loadedLocalPluginInstance) {
102676
- allPluginInstances.plugin = loadedLocalPluginInstance;
102695
+ if (localIntegrationInstance) {
102696
+ results.plugin = localIntegrationInstance;
102677
102697
  }
102678
- return allPluginInstances;
102698
+ return results;
102679
102699
  }
102680
102700
  async function updatePlugins(email, password) {
102681
102701
  updateStateLoading(true);
@@ -102689,7 +102709,7 @@ async function updatePlugins(email, password) {
102689
102709
  {
102690
102710
  key: "base",
102691
102711
  pluginName: "base",
102692
- pluginVersion: "0.25.0",
102712
+ pluginVersion: "0.26.0",
102693
102713
  pluginConfig: []
102694
102714
  }
102695
102715
  ],
@@ -102700,12 +102720,12 @@ async function updatePlugins(email, password) {
102700
102720
  pluginVersions[plugin.name] = plugin.version;
102701
102721
  });
102702
102722
  await loadPlugins(integrationsAndPlugins);
102703
- updateStatePlugins(getAllPlugins(), getAllPluginInstances());
102723
+ updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
102704
102724
  updateStateLoading(false);
102705
102725
  }
102706
102726
  async function unloadPlugins() {
102707
102727
  await unloadAllPlugins();
102708
- updateStatePlugins(getAllPlugins(), getAllPluginInstances());
102728
+ updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
102709
102729
  }
102710
102730
  async function updateLocalPlugin(plugin, pluginConfig) {
102711
102731
  updateStateLoading(true);
@@ -102715,25 +102735,25 @@ async function updateLocalPlugin(plugin, pluginConfig) {
102715
102735
  key: "plugin",
102716
102736
  pluginConfig: []
102717
102737
  };
102718
- loadedLocalPlugin = plugin;
102719
- loadedLocalPluginInstance = constructPluginInstance(
102738
+ localPluginFactory = plugin;
102739
+ localIntegrationInstance = constructIntegrationInstance(
102720
102740
  integration,
102721
102741
  plugin,
102722
102742
  pluginConfig
102723
102743
  );
102724
- if (loadedLocalPluginInstance && loadedLocalPluginInstance.load) {
102725
- await loadedLocalPluginInstance.load(getPluginApi("plugin"));
102744
+ if (localIntegrationInstance && localIntegrationInstance.load) {
102745
+ await localIntegrationInstance.load(getPluginApi("plugin"));
102726
102746
  }
102727
- updateStatePlugins(getAllPlugins(), getAllPluginInstances());
102747
+ updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
102728
102748
  updateStateLoading(false);
102729
102749
  }
102730
102750
  async function unloadLocalPlugin() {
102731
- if (loadedLocalPluginInstance && loadedLocalPluginInstance.unload) {
102732
- await loadedLocalPluginInstance.unload();
102751
+ if (localIntegrationInstance && localIntegrationInstance.unload) {
102752
+ await localIntegrationInstance.unload();
102733
102753
  }
102734
- loadedLocalPluginInstance = void 0;
102735
- loadedLocalPlugin = void 0;
102736
- updateStatePlugins(getAllPlugins(), getAllPluginInstances());
102754
+ localIntegrationInstance = void 0;
102755
+ localPluginFactory = void 0;
102756
+ updateStatePlugins(getAllPluginFactories(), getAllIntegrationInstances());
102737
102757
  }
102738
102758
  function useUserConfig(email, password, plugin, pluginConfig) {
102739
102759
  const userConfig = useSnapshot(state$1);
@@ -102762,7 +102782,7 @@ function useUserConfig(email, password, plugin, pluginConfig) {
102762
102782
  globals.commandGroups = userConfig.data.commandGroups;
102763
102783
  }
102764
102784
  globals.plugins = userConfig.plugins;
102765
- globals.pluginInstances = getPluginInstances();
102785
+ globals.integrationInstances = getIntegrationInstances();
102766
102786
  return userConfig;
102767
102787
  }
102768
102788
  const Background = () => {
@@ -103715,10 +103735,10 @@ const RouteResolver = ({ route }) => {
103715
103735
  const api2 = getPluginApi();
103716
103736
  const resolveRouteElement = (route2) => {
103717
103737
  if (route2.type === "screen") {
103718
- return api2.plugin(route2.plugin).screen(route2.path);
103738
+ return api2.integration(route2.plugin).screen(route2.path);
103719
103739
  } else {
103720
103740
  const defaultBase = {
103721
- plugin: "base",
103741
+ integration: "base",
103722
103742
  key: "main"
103723
103743
  };
103724
103744
  const board = api2.boards.find(
@@ -103726,19 +103746,19 @@ const RouteResolver = ({ route }) => {
103726
103746
  );
103727
103747
  if (board) {
103728
103748
  if (board.base) {
103729
- const boardElement = api2.plugin(board.base.plugin).board(board.base.key);
103749
+ const boardElement = api2.integration(board.base.integration).board(board.base.key);
103730
103750
  if (boardElement) {
103731
103751
  return boardElement;
103732
103752
  }
103733
103753
  } else {
103734
- return api2.plugin(defaultBase.plugin).board(defaultBase.key);
103754
+ return api2.integration(defaultBase.integration).board(defaultBase.key);
103735
103755
  }
103736
103756
  }
103737
- const devBoard = api2.plugin("plugin").board(api2.boardKey);
103757
+ const devBoard = api2.integration("plugin").board(api2.boardKey);
103738
103758
  if (devBoard) {
103739
103759
  return devBoard;
103740
103760
  }
103741
- return api2.plugin(defaultBase.plugin).board(api2.boardKey);
103761
+ return api2.integration(defaultBase.integration).board(api2.boardKey);
103742
103762
  }
103743
103763
  };
103744
103764
  console.log("### ROUTE", route);
@@ -103762,15 +103782,15 @@ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
103762
103782
  const [container, setContainer] = useState$1(null);
103763
103783
  const [containerNodeRef, setContainerNodeRef] = useState$1(null);
103764
103784
  const { data } = userConfig;
103765
- const pluginInstances2 = getPluginInstances();
103785
+ const pluginInstances = getIntegrationInstances();
103766
103786
  useEffect$1(() => {
103767
103787
  const loadRoutes = async () => {
103768
103788
  var _a2, _b2;
103769
103789
  const newRoutes = [];
103770
103790
  const newBoardKeys = [];
103771
- if (pluginInstances2) {
103772
- for (const key in pluginInstances2) {
103773
- (_a2 = pluginInstances2[key].screens) == null ? void 0 : _a2.forEach((screen) => {
103791
+ if (pluginInstances) {
103792
+ for (const key in pluginInstances) {
103793
+ (_a2 = pluginInstances[key].screens) == null ? void 0 : _a2.forEach((screen) => {
103774
103794
  newRoutes.push({
103775
103795
  type: "screen",
103776
103796
  plugin: key,
@@ -103779,7 +103799,7 @@ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
103779
103799
  nodeRef: createRef()
103780
103800
  });
103781
103801
  });
103782
- (_b2 = pluginInstances2[key].boards) == null ? void 0 : _b2.forEach((board) => {
103802
+ (_b2 = pluginInstances[key].boards) == null ? void 0 : _b2.forEach((board) => {
103783
103803
  newBoardKeys.push("/" + board.key);
103784
103804
  });
103785
103805
  }
@@ -103797,7 +103817,7 @@ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
103797
103817
  setBoardKeys(newBoardKeys);
103798
103818
  };
103799
103819
  loadRoutes();
103800
- }, [pluginInstances2, data == null ? void 0 : data.boards]);
103820
+ }, [pluginInstances, data == null ? void 0 : data.boards]);
103801
103821
  useEffect$1(() => {
103802
103822
  const { nodeRef } = routes.find((route) => {
103803
103823
  let path = "/:boardKey";
@@ -103893,10 +103913,10 @@ const CommandGroup = ({ groupKey }) => {
103893
103913
  if (!group) {
103894
103914
  return null;
103895
103915
  }
103896
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { children: group.commands.map((component, idx) => {
103897
- const instance = api2.plugin(component.plugin).component(
103898
- component.component,
103899
- parsePropsForComponent(api2, component.props)
103916
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { children: group.commands.map((command, idx) => {
103917
+ const instance = api2.integration(command.integration).component(
103918
+ command.component,
103919
+ parsePropsForComponent(api2, command.props)
103900
103920
  );
103901
103921
  return /* @__PURE__ */ jsxRuntimeExports.jsx(CommandItem, { children: instance }, idx);
103902
103922
  }) });