@pure-ds/core 0.3.4 → 0.3.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pure-ds/core",
3
3
  "shortname": "pds",
4
- "version": "0.3.4",
4
+ "version": "0.3.5",
5
5
  "description": "Pure Design System - Why develop a Design System when you can generate one?",
6
6
  "repository": {
7
7
  "type": "git",
@@ -6618,19 +6618,17 @@ export const ${name}CSS = \`${escapedCSS}\`;
6618
6618
  /**
6619
6619
  * Static method to apply styles to document
6620
6620
  * Creates a link element with BLOB URL
6621
- * @param {Generator} generator - The Generator instance with generated styles
6621
+ * @param {Generator} [generator] - Optional Generator instance (defaults to singleton)
6622
6622
  */
6623
6623
  static applyStyles(generator) {
6624
- if (!generator || typeof generator !== "object") {
6625
- generator?.options?.log?.(
6626
- "error",
6627
- "[Generator] applyStyles requires a generator object"
6628
- );
6624
+ const target = generator || _Generator.instance;
6625
+ if (!target || typeof target !== "object") {
6626
+ console.error("[Generator] applyStyles requires a generator object or active singleton");
6629
6627
  return;
6630
6628
  }
6631
- const cssText = generator.layeredCSS || generator.css || "";
6629
+ const cssText = target.layeredCSS || target.css || "";
6632
6630
  if (!cssText) {
6633
- generator?.options?.log?.(
6631
+ target.options?.log?.(
6634
6632
  "warn",
6635
6633
  "[Generator] No CSS available on designer to apply"
6636
6634
  );
@@ -6732,9 +6730,6 @@ function createStylesheet(css) {
6732
6730
  sheet.replaceSync(css);
6733
6731
  return sheet;
6734
6732
  }
6735
- function isLiveMode() {
6736
- return registry.isLive;
6737
- }
6738
6733
 
6739
6734
  // src/js/pds-core/pds-config.js
6740
6735
  var presets = {
@@ -9875,7 +9870,7 @@ async function live(config3) {
9875
9870
  generatorConfig?.log?.("log", "PDS live with custom config");
9876
9871
  }
9877
9872
  if (applyGlobalStyles) {
9878
- await PDS2.Generator.applyStyles(generator);
9873
+ await PDS2.Generator.applyStyles();
9879
9874
  if (typeof window !== "undefined") {
9880
9875
  setTimeout(() => {
9881
9876
  const criticalStyle = document.head.querySelector(
@@ -10076,10 +10071,10 @@ async function setTheme(theme, options = {}) {
10076
10071
  if (currentGenerator && currentGenerator.configure) {
10077
10072
  const newConfig = { ...currentGenerator.config, theme: resolvedTheme };
10078
10073
  currentGenerator.configure(newConfig);
10079
- await PDS2.Generator.applyStyles(currentDesigner);
10074
+ await PDS2.Generator.applyStyles();
10080
10075
  }
10081
10076
  } catch (error) {
10082
- currentDesigner?.options?.log?.("warn", "Failed to update styles for new theme:", error);
10077
+ console.warn("Failed to update styles for new theme:", error);
10083
10078
  }
10084
10079
  }
10085
10080
  PDS2.dispatchEvent(
@@ -11077,7 +11072,7 @@ ${summary}`,
11077
11072
  if (storedTheme)
11078
11073
  generatorOptions.theme = storedTheme;
11079
11074
  this.generator = new Generator(generatorOptions);
11080
- Generator.applyStyles(this.generator);
11075
+ Generator.applyStyles();
11081
11076
  try {
11082
11077
  PDS2._applyResolvedTheme(PDS2.theme);
11083
11078
  PDS2._setupSystemListenerIfNeeded(PDS2.theme);