@salty-css/core 0.1.0-alpha.4 → 0.1.0-alpha.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.
@@ -15,8 +15,8 @@ const dashCase = require("../dash-case-DIwKaYgE.cjs");
15
15
  const toHash = require("../to-hash-C05Y906F.cjs");
16
16
  const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
17
17
  const css_merge = require("../css/merge.cjs");
18
- const compiler_getFiles = require("./get-files.cjs");
19
18
  const parsers_index = require("../parsers/index.cjs");
19
+ const compiler_getFiles = require("./get-files.cjs");
20
20
  const console = require("console");
21
21
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
22
22
  function _interopNamespaceDefault(e) {
@@ -13,8 +13,8 @@ import { d as dashCase } from "../dash-case-DblXvymC.js";
13
13
  import { t as toHash } from "../to-hash-DAN2LcHK.js";
14
14
  import { p as parseAndJoinStyles, b as parseVariableTokens } from "../parse-styles-BTIoYnBr.js";
15
15
  import { mergeObjects, mergeFactories } from "../css/merge.js";
16
- import { getPackageJson } from "./get-files.js";
17
16
  import { parseTemplates, getTemplateTypes } from "../parsers/index.js";
17
+ import { getPackageJson } from "./get-files.js";
18
18
  import console from "console";
19
19
  const logger = createLogger({
20
20
  level: "debug",
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const parseStyles = require("../parse-styles-CA3TP5n1.cjs");
4
+ const toHash = require("../to-hash-C05Y906F.cjs");
5
+ const cache_resolveDynamicConfigCache = require("../cache/resolve-dynamic-config-cache.cjs");
6
+ const getDynamicStylesClassName = (styles) => {
7
+ return toHash.toHash(styles);
8
+ };
9
+ const getDynamicStylesCss = async (styles, scope) => {
10
+ const config = await cache_resolveDynamicConfigCache.resolveDynamicConfigCache();
11
+ const parsed = await parseStyles.parseStyles(styles, scope, config);
12
+ return parsed.join("\n");
13
+ };
14
+ exports.getDynamicStylesClassName = getDynamicStylesClassName;
15
+ exports.getDynamicStylesCss = getDynamicStylesCss;
@@ -0,0 +1,10 @@
1
+ import { BaseStyles } from '../types';
2
+ /**
3
+ * Create a hash of the dynamic styles that then can be used as scope.
4
+ */
5
+ export declare const getDynamicStylesClassName: (styles: BaseStyles) => string;
6
+ /**
7
+ * Add any dynamic styles to your app with a custom scope.
8
+ * Note: this works only with server components.
9
+ */
10
+ export declare const getDynamicStylesCss: (styles: BaseStyles, scope?: string) => Promise<string>;
@@ -0,0 +1,15 @@
1
+ import { a as parseStyles } from "../parse-styles-BTIoYnBr.js";
2
+ import { t as toHash } from "../to-hash-DAN2LcHK.js";
3
+ import { resolveDynamicConfigCache } from "../cache/resolve-dynamic-config-cache.js";
4
+ const getDynamicStylesClassName = (styles) => {
5
+ return toHash(styles);
6
+ };
7
+ const getDynamicStylesCss = async (styles, scope) => {
8
+ const config = await resolveDynamicConfigCache();
9
+ const parsed = await parseStyles(styles, scope, config);
10
+ return parsed.join("\n");
11
+ };
12
+ export {
13
+ getDynamicStylesClassName,
14
+ getDynamicStylesCss
15
+ };
package/css/index.cjs CHANGED
@@ -4,9 +4,12 @@ const css_keyframes = require("./keyframes.cjs");
4
4
  const css_media = require("./media.cjs");
5
5
  const css_token = require("./token.cjs");
6
6
  const css_merge = require("./merge.cjs");
7
+ const css_dynamicStyles = require("./dynamic-styles.cjs");
7
8
  exports.keyframes = css_keyframes.keyframes;
8
9
  exports.MediaQueryFactory = css_media.MediaQueryFactory;
9
10
  exports.media = css_media.media;
10
11
  exports.token = css_token.token;
11
12
  exports.mergeFactories = css_merge.mergeFactories;
12
13
  exports.mergeObjects = css_merge.mergeObjects;
14
+ exports.getDynamicStylesClassName = css_dynamicStyles.getDynamicStylesClassName;
15
+ exports.getDynamicStylesCss = css_dynamicStyles.getDynamicStylesCss;
package/css/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './keyframes';
2
2
  export * from './media';
3
3
  export * from './token';
4
4
  export * from './merge';
5
+ export * from './dynamic-styles';
package/css/index.js CHANGED
@@ -2,8 +2,11 @@ import { keyframes } from "./keyframes.js";
2
2
  import { MediaQueryFactory, media } from "./media.js";
3
3
  import { token } from "./token.js";
4
4
  import { mergeFactories, mergeObjects } from "./merge.js";
5
+ import { getDynamicStylesClassName, getDynamicStylesCss } from "./dynamic-styles.js";
5
6
  export {
6
7
  MediaQueryFactory,
8
+ getDynamicStylesClassName,
9
+ getDynamicStylesCss,
7
10
  keyframes,
8
11
  media,
9
12
  mergeFactories,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -87,6 +87,10 @@
87
87
  "import": "./css/merge.js",
88
88
  "require": "./css/merge.cjs"
89
89
  },
90
+ "./css/dynamic-styles": {
91
+ "import": "./css/dynamic-styles.js",
92
+ "require": "./css/dynamic-styles.cjs"
93
+ },
90
94
  "./helpers": {
91
95
  "import": "./helpers/index.js",
92
96
  "require": "./helpers/index.cjs"