zss-engine 0.2.26 → 0.2.28

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.
@@ -14,7 +14,7 @@ const build = async (styleSheet, filePath, global) => {
14
14
  const cssData = fs.readFileSync(filePath, 'utf-8');
15
15
  if (!cssData.includes(styleSheet)) {
16
16
  fs.appendFileSync(filePath, styleSheet, 'utf-8');
17
- if (process.argv.includes('--log'))
17
+ if (process.argv.includes('--view'))
18
18
  console.log(message + styleSheet);
19
19
  }
20
20
  }
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.injectClientGlobalCSS = injectClientGlobalCSS;
4
4
  const index_js_1 = require("../index.js");
5
- function injectClientGlobalCSS(sheet, scoped) {
5
+ function injectClientGlobalCSS(sheet) {
6
6
  if (index_js_1.isServer)
7
7
  return;
8
- const existingStyleElement = document.querySelector(`[data-scope="${scoped}"]`);
8
+ const existingStyleElement = document.querySelector(`[data-scope="global"]`);
9
9
  if (existingStyleElement instanceof HTMLStyleElement) {
10
10
  existingStyleElement.textContent += sheet;
11
11
  return;
12
12
  }
13
13
  const styleElement = document.createElement('style');
14
- styleElement.setAttribute('data-scope', scoped);
14
+ styleElement.setAttribute('data-scope', 'global');
15
15
  styleElement.setAttribute('type', 'text/css');
16
16
  styleElement.textContent = sheet;
17
17
  document.head.appendChild(styleElement);
@@ -11,7 +11,7 @@ export const build = async (styleSheet, filePath, global) => {
11
11
  const cssData = fs.readFileSync(filePath, 'utf-8');
12
12
  if (!cssData.includes(styleSheet)) {
13
13
  fs.appendFileSync(filePath, styleSheet, 'utf-8');
14
- if (process.argv.includes('--log'))
14
+ if (process.argv.includes('--view'))
15
15
  console.log(message + styleSheet);
16
16
  }
17
17
  }
@@ -1,14 +1,14 @@
1
1
  import { isServer } from '../index.js';
2
- export function injectClientGlobalCSS(sheet, scoped) {
2
+ export function injectClientGlobalCSS(sheet) {
3
3
  if (isServer)
4
4
  return;
5
- const existingStyleElement = document.querySelector(`[data-scope="${scoped}"]`);
5
+ const existingStyleElement = document.querySelector(`[data-scope="global"]`);
6
6
  if (existingStyleElement instanceof HTMLStyleElement) {
7
7
  existingStyleElement.textContent += sheet;
8
8
  return;
9
9
  }
10
10
  const styleElement = document.createElement('style');
11
- styleElement.setAttribute('data-scope', scoped);
11
+ styleElement.setAttribute('data-scope', 'global');
12
12
  styleElement.setAttribute('type', 'text/css');
13
13
  styleElement.textContent = sheet;
14
14
  document.head.appendChild(styleElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "keywords": [
6
6
  "zero-runtime",
@@ -1 +1 @@
1
- export declare function injectClientGlobalCSS(sheet: string, scoped: string): void;
1
+ export declare function injectClientGlobalCSS(sheet: string): void;