@pure-ds/core 0.3.3 → 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.
@@ -5126,23 +5126,23 @@ export const ${name}CSS = \`${escapedCSS}\`;
5126
5126
  /**
5127
5127
  * Static method to apply styles to document
5128
5128
  * Creates a link element with BLOB URL
5129
- * @param {Generator} generator - The Generator instance with generated styles
5129
+ * @param {Generator} [generator] - Optional Generator instance (defaults to singleton)
5130
5130
  */
5131
5131
  static applyStyles(generator) {
5132
+ // Use provided generator or singleton instance
5133
+ const target = generator || Generator.instance;
5134
+
5132
5135
  // Validate parameter
5133
- if (!generator || typeof generator !== "object") {
5134
- generator?.options?.log?.(
5135
- "error",
5136
- "[Generator] applyStyles requires a generator object"
5137
- );
5136
+ if (!target || typeof target !== "object") {
5137
+ console.error("[Generator] applyStyles requires a generator object or active singleton");
5138
5138
  return;
5139
5139
  }
5140
5140
 
5141
5141
  // Preferred: apply layered CSS so tokens + primitives + components + utilities
5142
5142
  // are available in light DOM (ensures primitives like :where(button):active apply)
5143
- const cssText = generator.layeredCSS || generator.css || "";
5143
+ const cssText = target.layeredCSS || target.css || "";
5144
5144
  if (!cssText) {
5145
- generator?.options?.log?.(
5145
+ target.options?.log?.(
5146
5146
  "warn",
5147
5147
  "[Generator] No CSS available on designer to apply"
5148
5148
  );
@@ -5335,14 +5335,6 @@ export function createStylesheet(css) {
5335
5335
  return sheet;
5336
5336
  }
5337
5337
 
5338
- /**
5339
- * Check if running in live design system context
5340
- * Useful for conditional behavior
5341
- *
5342
- * @returns {boolean}
5343
- */
5344
- export function isLiveMode() {
5345
- return pdsRegistry.isLive;
5346
- }
5338
+
5347
5339
  import { enums } from "./pds-enums.js";
5348
5340
  import { ontology } from "./pds-ontology.js";
package/src/js/pds.js CHANGED
@@ -49,7 +49,6 @@ import {
49
49
  adoptLayers,
50
50
  adoptPrimitives,
51
51
  createStylesheet,
52
- isLiveMode,
53
52
  } from "./pds-core/pds-generator.js";
54
53
  import { registry } from "./pds-core/pds-registry.js";
55
54
  import ontology from "./pds-core/pds-ontology.js";
@@ -85,7 +84,7 @@ PDS.createStylesheet = createStylesheet;
85
84
 
86
85
  /** Return true when running inside a live/designer-backed environment */
87
86
  PDS.isLiveMode = isLiveMode;
88
-
87
+ () => registry.isLiv
89
88
  PDS.enums = enums;
90
89
 
91
90
  PDS.ask = ask;
@@ -1166,7 +1165,7 @@ async function live(config) {
1166
1165
 
1167
1166
  // Apply styles globally if requested (default behavior)
1168
1167
  if (applyGlobalStyles) {
1169
- await PDS.Generator.applyStyles(generator);
1168
+ await PDS.Generator.applyStyles();
1170
1169
 
1171
1170
  // Clean up critical styles after adoptedStyleSheets are applied
1172
1171
  if (typeof window !== "undefined") {
@@ -1477,10 +1476,10 @@ async function setTheme(theme, options = {}) {
1477
1476
  currentGenerator.configure(newConfig);
1478
1477
 
1479
1478
  // Reapply styles
1480
- await PDS.Generator.applyStyles(currentDesigner);
1479
+ await PDS.Generator.applyStyles();
1481
1480
  }
1482
1481
  } catch (error) {
1483
- currentDesigner?.options?.log?.("warn", "Failed to update styles for new theme:", error);
1482
+ console.warn("Failed to update styles for new theme:", error);
1484
1483
  }
1485
1484
  }
1486
1485