@udixio/theme 2.1.0 → 2.1.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 2.1.2 (2025-10-17)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **theme, plugins-tailwind:** improve container caching and enhance debugging logs ([a8f955d](https://github.com/Udixio/UI/commit/a8f955d))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Joël VIGREUX
10
+
11
+ ## 2.1.1 (2025-10-17)
12
+
13
+ ### 🩹 Fixes
14
+
15
+ - **theme, plugins-tailwind:** enhance instance management and fix subThemes processing ([0a1b42e](https://github.com/Udixio/UI/commit/0a1b42e))
16
+
17
+ ### ❤️ Thank You
18
+
19
+ - Joël VIGREUX
20
+
1
21
  ## 2.1.0 (2025-10-17)
2
22
 
3
23
  ### 🚀 Features
@@ -1,4 +1,6 @@
1
- import { Resolver } from 'awilix';
1
+ import { AwilixContainer, Resolver } from 'awilix';
2
2
  export type Module = Record<string, Resolver<any>>;
3
- export declare const AppContainer: () => import('awilix').AwilixContainer<any>;
3
+ export declare const AppContainer: (options?: {
4
+ fresh?: boolean;
5
+ }) => AwilixContainer<any>;
4
6
  //# sourceMappingURL=app.container.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.container.d.ts","sourceRoot":"","sources":["../src/app.container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOlE,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEnD,eAAO,MAAM,YAAY,6CAuBxB,CAAC"}
1
+ {"version":3,"file":"app.container.d.ts","sourceRoot":"","sources":["../src/app.container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkC,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAOnF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAInD,eAAO,MAAM,YAAY,GAAI,UAAU;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,yBA4BzD,CAAC"}
package/dist/bin.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  const commander = require("commander");
3
3
  const chokidar = require("chokidar");
4
4
  const chalk = require("chalk");
5
- const loadFromPath = require("./load-from-path-kuofMGN3.cjs");
5
+ const loadFromPath = require("./load-from-path-pZQNcEPJ.cjs");
6
6
  const program = new commander.Command();
7
7
  async function runOnce(configPath) {
8
8
  try {
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Command } from "commander";
2
2
  import chokidar from "chokidar";
3
3
  import chalk from "chalk";
4
- import { l as loadFromPath } from "./load-from-path-CBnO8ESw.js";
4
+ import { l as loadFromPath } from "./load-from-path-BPJUOVxu.js";
5
5
  const program = new Command();
6
6
  async function runOnce(configPath) {
7
7
  try {
package/dist/browser.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const loader = require("./loader-BzsrGBu-.cjs");
4
- const font_plugin = require("./font.plugin-FPU_gL1Y.cjs");
3
+ const loader = require("./loader-CQxzpARY.cjs");
4
+ const font_plugin = require("./font.plugin-DLv04PSX.cjs");
5
5
  exports.API = loader.API;
6
6
  exports.AppContainer = loader.AppContainer;
7
7
  exports.AppModule = loader.AppModule;
package/dist/browser.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A, a, b, h, i, C, j, k, e, f, o, n, q, D, P, r, s, v, u, V, z, c, d, m, F, g, w, x, l, p, G, B, t, y, E } from "./loader-CoayTlSl.js";
2
- import { F as F2, b as b2, P as P2, a as a2, d as d2 } from "./font.plugin-5Xpo-ntw.js";
1
+ import { A, a, b, h, i, C, j, k, e, f, o, n, q, D, P, r, s, v, u, V, z, c, d, m, F, g, w, x, l, p, G, B, t, y, E } from "./loader-qCj0ikgY.js";
2
+ import { F as F2, b as b2, P as P2, a as a2, d as d2 } from "./font.plugin-CDZs7YLM.js";
3
3
  export {
4
4
  A as API,
5
5
  a as AppContainer,
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAEzB;;IAUP;;;;;;;;OAQG;IACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,GAC5B;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,YAAY,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAA;KAAE;IAsBjD,GAAG,CAAC,OAAO,EAAE,cAAc;IAqBpB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC;IA4B3C,OAAO,CAAC,UAAU;IAalB,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,EAE3B;IACD,IAAI,MAAM,YAET;IAED,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,EAEtC;IACD,IAAI,aAAa,IAHgB,MAAM,CAKtC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAElC;IACD,IAAI,WAAW,IAAI,GAAG,CAMrB;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAE3B;IACD,IAAI,OAAO,IAHU,OAAO,CAK3B;IAED,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAW5D,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;CAG/D"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAEzB;;IAUP;;;;;;;;OAQG;IACH,MAAM,CAAC,iBAAiB,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,GAC5B;QAAE,MAAM,EAAE,CAAC,CAAC;QAAC,YAAY,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAA;KAAE;IAsBjD,GAAG,CAAC,OAAO,EAAE,cAAc;IAoBpB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC;IA4B3C,OAAO,CAAC,UAAU;IAalB,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,EAE3B;IACD,IAAI,MAAM,YAET;IAED,IAAI,aAAa,CAAC,aAAa,EAAE,MAAM,EAEtC;IACD,IAAI,aAAa,IAHgB,MAAM,CAKtC;IAED,IAAI,WAAW,CAAC,WAAW,EAAE,MAAM,EAElC;IACD,IAAI,WAAW,IAAI,GAAG,CAMrB;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,OAAO,EAE3B;IACD,IAAI,OAAO,IAHU,OAAO,CAK3B;IAED,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC;IAW5D,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,KAAK,IAAI,GAAG,IAAI;CAG/D"}
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import "./loader-CoayTlSl.js";
4
+ import "./loader-qCj0ikgY.js";
5
5
  class PluginAbstract {
6
6
  constructor(options) {
7
7
  __publicField(this, "options");
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- require("./loader-BzsrGBu-.cjs");
5
+ require("./loader-CQxzpARY.cjs");
6
6
  class PluginAbstract {
7
7
  constructor(options) {
8
8
  __publicField(this, "options");
@@ -1,4 +1,4 @@
1
- import { p as loader } from "./loader-CoayTlSl.js";
1
+ import { p as loader } from "./loader-qCj0ikgY.js";
2
2
  import * as fs from "node:fs";
3
3
  async function resolveConfig(configPath = "./theme.config") {
4
4
  const { createJiti } = await import("jiti");
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
22
  mod
23
23
  ));
24
- const loader = require("./loader-BzsrGBu-.cjs");
24
+ const loader = require("./loader-CQxzpARY.cjs");
25
25
  const fs = require("node:fs");
26
26
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
27
27
  function _interopNamespaceDefault(e) {
@@ -44,7 +44,7 @@ const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
44
44
  async function resolveConfig(configPath = "./theme.config") {
45
45
  const { createJiti } = await import("jiti");
46
46
  const { resolve } = await import("pathe");
47
- const jiti = createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("load-from-path-kuofMGN3.cjs", document.baseURI).href, {
47
+ const jiti = createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("load-from-path-pZQNcEPJ.cjs", document.baseURI).href, {
48
48
  debug: process.env.NODE_ENV === "development",
49
49
  fsCache: true,
50
50
  interopDefault: true
@@ -2437,11 +2437,11 @@ class ColorManager {
2437
2437
  }
2438
2438
  }
2439
2439
  const ColorModule = {
2440
- colorManager: awilix.asClass(ColorManager).singleton(),
2441
- colorApi: awilix.asClass(ColorApi).singleton()
2440
+ colorManager: awilix.asClass(ColorManager).scoped(),
2441
+ colorApi: awilix.asClass(ColorApi).scoped()
2442
2442
  };
2443
2443
  const AppModule = {
2444
- api: awilix.asClass(API).singleton()
2444
+ api: awilix.asClass(API).scoped()
2445
2445
  };
2446
2446
  class PluginApi {
2447
2447
  constructor() {
@@ -2484,7 +2484,7 @@ class PluginApi {
2484
2484
  }
2485
2485
  }
2486
2486
  const PluginModule = {
2487
- pluginApi: awilix.asClass(PluginApi).singleton()
2487
+ pluginApi: awilix.asClass(PluginApi).scoped()
2488
2488
  };
2489
2489
  class Context {
2490
2490
  constructor() {
@@ -2526,8 +2526,7 @@ class Context {
2526
2526
  }
2527
2527
  set(options) {
2528
2528
  if (this._options) {
2529
- console.error(this._options);
2530
- throw new Error("Options already set");
2529
+ return this.update(options);
2531
2530
  }
2532
2531
  if (typeof options.sourceColor === "string") {
2533
2532
  options.sourceColor = Hct.fromInt(materialColorUtilities.argbFromHex(options.sourceColor));
@@ -2618,7 +2617,7 @@ class Context {
2618
2617
  }
2619
2618
  }
2620
2619
  const ContextModule = {
2621
- context: awilix.asClass(Context).singleton()
2620
+ context: awilix.asClass(Context).scoped()
2622
2621
  };
2623
2622
  class Palette {
2624
2623
  constructor(name, callback, context) {
@@ -2794,10 +2793,17 @@ class PaletteManager {
2794
2793
  }
2795
2794
  }
2796
2795
  const PaletteModule = {
2797
- paletteApi: awilix.asClass(PaletteApi).singleton(),
2798
- paletteManager: awilix.asClass(PaletteManager).singleton()
2796
+ paletteApi: awilix.asClass(PaletteApi).scoped(),
2797
+ paletteManager: awilix.asClass(PaletteManager).scoped()
2799
2798
  };
2800
- const AppContainer = () => {
2799
+ let cachedContainer = null;
2800
+ const AppContainer = (options) => {
2801
+ if (!(options == null ? void 0 : options.fresh) && cachedContainer) {
2802
+ return cachedContainer;
2803
+ }
2804
+ const container = awilix.createContainer({
2805
+ injectionMode: awilix.InjectionMode.PROXY
2806
+ });
2801
2807
  function registerModule(...modules) {
2802
2808
  modules.forEach((module2) => {
2803
2809
  Object.entries(module2).forEach(([name, moduleClass]) => {
@@ -2806,9 +2812,6 @@ const AppContainer = () => {
2806
2812
  });
2807
2813
  return AppContainer;
2808
2814
  }
2809
- const container = awilix.createContainer({
2810
- injectionMode: awilix.InjectionMode.PROXY
2811
- });
2812
2815
  registerModule(
2813
2816
  AppModule,
2814
2817
  PluginModule,
@@ -2816,6 +2819,7 @@ const AppContainer = () => {
2816
2819
  PaletteModule,
2817
2820
  ContextModule
2818
2821
  );
2822
+ cachedContainer = container;
2819
2823
  return container;
2820
2824
  };
2821
2825
  function bootstrap() {
@@ -2436,11 +2436,11 @@ class ColorManager {
2436
2436
  }
2437
2437
  }
2438
2438
  const ColorModule = {
2439
- colorManager: asClass(ColorManager).singleton(),
2440
- colorApi: asClass(ColorApi).singleton()
2439
+ colorManager: asClass(ColorManager).scoped(),
2440
+ colorApi: asClass(ColorApi).scoped()
2441
2441
  };
2442
2442
  const AppModule = {
2443
- api: asClass(API).singleton()
2443
+ api: asClass(API).scoped()
2444
2444
  };
2445
2445
  class PluginApi {
2446
2446
  constructor() {
@@ -2483,7 +2483,7 @@ class PluginApi {
2483
2483
  }
2484
2484
  }
2485
2485
  const PluginModule = {
2486
- pluginApi: asClass(PluginApi).singleton()
2486
+ pluginApi: asClass(PluginApi).scoped()
2487
2487
  };
2488
2488
  class Context {
2489
2489
  constructor() {
@@ -2525,8 +2525,7 @@ class Context {
2525
2525
  }
2526
2526
  set(options) {
2527
2527
  if (this._options) {
2528
- console.error(this._options);
2529
- throw new Error("Options already set");
2528
+ return this.update(options);
2530
2529
  }
2531
2530
  if (typeof options.sourceColor === "string") {
2532
2531
  options.sourceColor = Hct.fromInt(argbFromHex(options.sourceColor));
@@ -2617,7 +2616,7 @@ class Context {
2617
2616
  }
2618
2617
  }
2619
2618
  const ContextModule = {
2620
- context: asClass(Context).singleton()
2619
+ context: asClass(Context).scoped()
2621
2620
  };
2622
2621
  class Palette {
2623
2622
  constructor(name, callback, context) {
@@ -2793,10 +2792,17 @@ class PaletteManager {
2793
2792
  }
2794
2793
  }
2795
2794
  const PaletteModule = {
2796
- paletteApi: asClass(PaletteApi).singleton(),
2797
- paletteManager: asClass(PaletteManager).singleton()
2795
+ paletteApi: asClass(PaletteApi).scoped(),
2796
+ paletteManager: asClass(PaletteManager).scoped()
2798
2797
  };
2799
- const AppContainer = () => {
2798
+ let cachedContainer = null;
2799
+ const AppContainer = (options) => {
2800
+ if (!(options == null ? void 0 : options.fresh) && cachedContainer) {
2801
+ return cachedContainer;
2802
+ }
2803
+ const container = createContainer({
2804
+ injectionMode: InjectionMode.PROXY
2805
+ });
2800
2806
  function registerModule(...modules) {
2801
2807
  modules.forEach((module) => {
2802
2808
  Object.entries(module).forEach(([name, moduleClass]) => {
@@ -2805,9 +2811,6 @@ const AppContainer = () => {
2805
2811
  });
2806
2812
  return AppContainer;
2807
2813
  }
2808
- const container = createContainer({
2809
- injectionMode: InjectionMode.PROXY
2810
- });
2811
2814
  registerModule(
2812
2815
  AppModule,
2813
2816
  PluginModule,
@@ -2815,6 +2818,7 @@ const AppContainer = () => {
2815
2818
  PaletteModule,
2816
2819
  ContextModule
2817
2820
  );
2821
+ cachedContainer = container;
2818
2822
  return container;
2819
2823
  };
2820
2824
  function bootstrap() {
package/dist/node.cjs CHANGED
@@ -22,9 +22,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
25
- const loader = require("./loader-BzsrGBu-.cjs");
26
- const font_plugin = require("./font.plugin-FPU_gL1Y.cjs");
27
- const loadFromPath = require("./load-from-path-kuofMGN3.cjs");
25
+ const loader = require("./loader-CQxzpARY.cjs");
26
+ const font_plugin = require("./font.plugin-DLv04PSX.cjs");
27
+ const loadFromPath = require("./load-from-path-pZQNcEPJ.cjs");
28
28
  let unpluginInstance = null;
29
29
  const createUnpluginTheme = async () => {
30
30
  if (unpluginInstance) {
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
- import { A, a, b, h, i, C, j, k, e, f, o, n, q, D, P, r, s, v, u, V, z, c, d, m, F, g, w, x, l, p, G, B, t, y, E } from "./loader-CoayTlSl.js";
2
- import { F as F2, b as b2, P as P2, a as a2, d as d2 } from "./font.plugin-5Xpo-ntw.js";
3
- import { l as loadFromPath } from "./load-from-path-CBnO8ESw.js";
4
- import { r as r2 } from "./load-from-path-CBnO8ESw.js";
1
+ import { A, a, b, h, i, C, j, k, e, f, o, n, q, D, P, r, s, v, u, V, z, c, d, m, F, g, w, x, l, p, G, B, t, y, E } from "./loader-qCj0ikgY.js";
2
+ import { F as F2, b as b2, P as P2, a as a2, d as d2 } from "./font.plugin-CDZs7YLM.js";
3
+ import { l as loadFromPath } from "./load-from-path-BPJUOVxu.js";
4
+ import { r as r2 } from "./load-from-path-BPJUOVxu.js";
5
5
  let unpluginInstance = null;
6
6
  const createUnpluginTheme = async () => {
7
7
  if (unpluginInstance) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/theme",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/node.js",
6
6
  "module": "./dist/node.js",
@@ -1,4 +1,4 @@
1
- import { createContainer, InjectionMode, Resolver } from 'awilix';
1
+ import { AwilixContainer, createContainer, InjectionMode, Resolver } from 'awilix';
2
2
  import { ColorModule } from './color';
3
3
  import { AppModule } from './app.module';
4
4
  import { PluginModule } from './plugin';
@@ -7,7 +7,17 @@ import { ContextModule } from './context';
7
7
 
8
8
  export type Module = Record<string, Resolver<any>>;
9
9
 
10
- export const AppContainer = () => {
10
+ let cachedContainer: AwilixContainer | null = null;
11
+
12
+ export const AppContainer = (options?: { fresh?: boolean }) => {
13
+ if (!options?.fresh && cachedContainer) {
14
+ return cachedContainer;
15
+ }
16
+
17
+ const container = createContainer({
18
+ injectionMode: InjectionMode.PROXY,
19
+ });
20
+
11
21
  function registerModule(...modules: Module[]) {
12
22
  modules.forEach((module) => {
13
23
  Object.entries(module).forEach(([name, moduleClass]) => {
@@ -17,10 +27,6 @@ export const AppContainer = () => {
17
27
  return AppContainer;
18
28
  }
19
29
 
20
- const container = createContainer({
21
- injectionMode: InjectionMode.PROXY,
22
- });
23
-
24
30
  registerModule(
25
31
  AppModule,
26
32
  PluginModule,
@@ -29,5 +35,6 @@ export const AppContainer = () => {
29
35
  ContextModule,
30
36
  );
31
37
 
38
+ cachedContainer = container;
32
39
  return container;
33
40
  };
package/src/app.module.ts CHANGED
@@ -3,5 +3,5 @@ import { API } from './API';
3
3
  import { Module } from './app.container';
4
4
 
5
5
  export const AppModule: Module = {
6
- api: asClass(API).singleton(),
6
+ api: asClass(API).scoped(),
7
7
  };
@@ -4,6 +4,6 @@ import { asClass } from 'awilix';
4
4
  import { Module } from '../app.container';
5
5
 
6
6
  export const ColorModule: Module = {
7
- colorManager: asClass(ColorManager).singleton(),
8
- colorApi: asClass(ColorApi).singleton(),
7
+ colorManager: asClass(ColorManager).scoped(),
8
+ colorApi: asClass(ColorApi).scoped(),
9
9
  };
@@ -3,5 +3,5 @@ import { Module } from '../app.container';
3
3
  import { Context } from './context';
4
4
 
5
5
  export const ContextModule: Module = {
6
- context: asClass(Context).singleton(),
6
+ context: asClass(Context).scoped(),
7
7
  };
@@ -60,8 +60,7 @@ export class Context {
60
60
 
61
61
  set(options: ContextOptions) {
62
62
  if (this._options) {
63
- console.error(this._options);
64
- throw new Error('Options already set');
63
+ return this.update(options);
65
64
  }
66
65
  if (typeof options.sourceColor === 'string') {
67
66
  options.sourceColor = Hct.fromInt(argbFromHex(options.sourceColor));
@@ -4,6 +4,6 @@ import { PaletteManager } from './palette.manager';
4
4
  import { PaletteApi } from './palette.api';
5
5
 
6
6
  export const PaletteModule: Module = {
7
- paletteApi: asClass(PaletteApi).singleton(),
8
- paletteManager: asClass(PaletteManager).singleton(),
7
+ paletteApi: asClass(PaletteApi).scoped(),
8
+ paletteManager: asClass(PaletteManager).scoped(),
9
9
  };
@@ -3,5 +3,5 @@ import { Module } from '../app.container';
3
3
  import { PluginApi } from './plugin.api';
4
4
 
5
5
  export const PluginModule: Module = {
6
- pluginApi: asClass(PluginApi).singleton(),
6
+ pluginApi: asClass(PluginApi).scoped(),
7
7
  };