@umber-style/css 0.2.0 → 0.3.0-alpha.0

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.
@@ -10,9 +10,12 @@ const CSS_TEXT = /[:{]/;
10
10
  function isTemplate(value) {
11
11
  return Array.isArray(value) && Object.hasOwn(value, "raw");
12
12
  }
13
- /** The sheet of a cache made here: the style elements of the document, written as `hasRuleText` says, or one in memory where there is no document. */
14
- function createDefaultSheet(prefix, hasRuleText) {
15
- return typeof document === "undefined" ? (0, _umber_style_core.createMemorySheet)() : (0, _umber_style_core.createDomSheet)(prefix, void 0, { hasRuleText });
13
+ /** The sheet of a cache made here: the style elements of the document, written as `speedy` says and carrying `nonce`, or one in memory where there is no document. */
14
+ function createDefaultSheet(prefix, { speedy, nonce }) {
15
+ return typeof document === "undefined" ? (0, _umber_style_core.createMemorySheet)() : (0, _umber_style_core.createDomSheet)(prefix, void 0, {
16
+ speedy,
17
+ nonce
18
+ });
16
19
  }
17
20
  /** The items of `args`, lists flattened, without `false`, `null`, `undefined`, `''` and `true`. */
18
21
  function flatten(args, out = []) {
@@ -35,7 +38,7 @@ function createInstance(options = {}) {
35
38
  const { key, cache: given, sheet: givenSheet, hasLayers = false, ...cacheOptions } = options;
36
39
  if (given && key !== void 0 && key !== given.prefix) throw new TypeError(`createInstance(): the key "${key}" differs from the prefix "${given.prefix}" of the given cache. Leave out \`key\`, or give the same one.`);
37
40
  const prefix = key ?? "css";
38
- const sheet = givenSheet ?? (given ? given.sheet : createDefaultSheet(prefix, cacheOptions.hasRuleText));
41
+ const sheet = givenSheet ?? (given ? given.sheet : createDefaultSheet(prefix, cacheOptions));
39
42
  if (!sheet) throw new TypeError("createInstance(): the given cache has no `sheet` member: give the sheet it writes to as `sheet` too.");
40
43
  const makeCache = () => (0, _umber_style_core.createCache)({
41
44
  ...cacheOptions,
@@ -6,9 +6,12 @@ const CSS_TEXT = /[:{]/;
6
6
  function isTemplate(value) {
7
7
  return Array.isArray(value) && Object.hasOwn(value, "raw");
8
8
  }
9
- /** The sheet of a cache made here: the style elements of the document, written as `hasRuleText` says, or one in memory where there is no document. */
10
- function createDefaultSheet(prefix, hasRuleText) {
11
- return typeof document === "undefined" ? createMemorySheet() : createDomSheet(prefix, void 0, { hasRuleText });
9
+ /** The sheet of a cache made here: the style elements of the document, written as `speedy` says and carrying `nonce`, or one in memory where there is no document. */
10
+ function createDefaultSheet(prefix, { speedy, nonce }) {
11
+ return typeof document === "undefined" ? createMemorySheet() : createDomSheet(prefix, void 0, {
12
+ speedy,
13
+ nonce
14
+ });
12
15
  }
13
16
  /** The items of `args`, lists flattened, without `false`, `null`, `undefined`, `''` and `true`. */
14
17
  function flatten(args, out = []) {
@@ -31,7 +34,7 @@ function createInstance(options = {}) {
31
34
  const { key, cache: given, sheet: givenSheet, hasLayers = false, ...cacheOptions } = options;
32
35
  if (given && key !== void 0 && key !== given.prefix) throw new TypeError(`createInstance(): the key "${key}" differs from the prefix "${given.prefix}" of the given cache. Leave out \`key\`, or give the same one.`);
33
36
  const prefix = key ?? "css";
34
- const sheet = givenSheet ?? (given ? given.sheet : createDefaultSheet(prefix, cacheOptions.hasRuleText));
37
+ const sheet = givenSheet ?? (given ? given.sheet : createDefaultSheet(prefix, cacheOptions));
35
38
  if (!sheet) throw new TypeError("createInstance(): the given cache has no `sheet` member: give the sheet it writes to as `sheet` too.");
36
39
  const makeCache = () => createCache({
37
40
  ...cacheOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umber-style/css",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-alpha.0",
4
4
  "description": "UmberStyle's plain layer: a style goes to a cache and comes back as a class name. No framework, no theme.",
5
5
  "keywords": [
6
6
  "styling",
@@ -51,7 +51,7 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@umber-style/core": "^0.2.0"
54
+ "@umber-style/core": "^0.3.0-alpha.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@soroush.tech/bench": "^2.2.3",