simplestyle-js 3.4.0 → 3.4.2-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.
Files changed (74) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/createStyles.cjs +202 -0
  3. package/dist/cjs/createStyles.d.ts +47 -0
  4. package/dist/cjs/generateClassName.cjs +62 -0
  5. package/dist/cjs/generateClassName.d.ts +3 -0
  6. package/dist/cjs/index.cjs +71 -0
  7. package/dist/cjs/numToAlpha.cjs +14 -0
  8. package/dist/cjs/numToAlpha.d.ts +1 -0
  9. package/dist/cjs/package.json +1 -0
  10. package/dist/cjs/plugins.cjs +25 -0
  11. package/dist/cjs/plugins.d.ts +3 -0
  12. package/dist/cjs/react/index.cjs +18 -0
  13. package/dist/cjs/react/useCreateStyles.cjs +73 -0
  14. package/dist/cjs/react/useCreateStyles.d.ts +3 -0
  15. package/dist/cjs/simpleStyleRegistry.cjs +25 -0
  16. package/dist/cjs/simpleStyleRegistry.d.ts +11 -0
  17. package/dist/cjs/types.cjs +4 -0
  18. package/{src/types.ts → dist/cjs/types.d.ts} +1 -3
  19. package/dist/cjs/util/deepEqual.cjs +27 -0
  20. package/dist/cjs/util/deepEqual.d.ts +1 -0
  21. package/dist/cjs/util/index.cjs +18 -0
  22. package/dist/esm/createStyles.d.ts +47 -0
  23. package/dist/esm/createStyles.mjs +174 -0
  24. package/dist/esm/generateClassName.d.ts +3 -0
  25. package/dist/esm/generateClassName.mjs +36 -0
  26. package/dist/esm/index.d.ts +6 -0
  27. package/dist/esm/index.mjs +3 -0
  28. package/dist/esm/numToAlpha.d.ts +1 -0
  29. package/dist/esm/numToAlpha.mjs +4 -0
  30. package/dist/esm/package.json +1 -0
  31. package/dist/esm/plugins.d.ts +3 -0
  32. package/dist/esm/plugins.mjs +7 -0
  33. package/dist/esm/react/index.d.ts +1 -0
  34. package/dist/esm/react/index.mjs +1 -0
  35. package/dist/esm/react/useCreateStyles.d.ts +3 -0
  36. package/dist/esm/react/useCreateStyles.mjs +58 -0
  37. package/dist/esm/simpleStyleRegistry.d.ts +11 -0
  38. package/dist/esm/simpleStyleRegistry.mjs +15 -0
  39. package/dist/esm/types.d.ts +5 -0
  40. package/dist/esm/types.mjs +1 -0
  41. package/dist/esm/util/deepEqual.d.ts +1 -0
  42. package/dist/esm/util/deepEqual.mjs +17 -0
  43. package/dist/esm/util/index.d.ts +1 -0
  44. package/dist/esm/util/index.mjs +1 -0
  45. package/package.json +14 -1
  46. package/.coveralls.yml +0 -2
  47. package/.editorconfig +0 -7
  48. package/.prettierrc +0 -7
  49. package/.tool-versions +0 -3
  50. package/.travis.yml +0 -8
  51. package/.vscode/launch.json +0 -36
  52. package/.vscode/settings.json +0 -3
  53. package/CHANGELOG.md +0 -273
  54. package/eslint.config.js +0 -3
  55. package/setup.sh +0 -4
  56. package/src/createStyles.ts +0 -251
  57. package/src/generateClassName.ts +0 -43
  58. package/src/numToAlpha.ts +0 -5
  59. package/src/plugins.ts +0 -11
  60. package/src/react/useCreateStyles.ts +0 -58
  61. package/src/util/deepEqual.ts +0 -20
  62. package/test/createStyles.spec.ts +0 -330
  63. package/test/deepEqual.spec.ts +0 -97
  64. package/test/generateClassName.spec.ts +0 -48
  65. package/test/keyframes.spec.ts +0 -19
  66. package/test/plugins.spec.ts +0 -43
  67. package/test/react/useCreateStyles.spec.tsx +0 -65
  68. package/test/updateStyles.spec.ts +0 -41
  69. package/tsconfig.build.json +0 -8
  70. package/tsconfig.json +0 -37
  71. package/vite.config.ts +0 -9
  72. /package/{src/index.ts → dist/cjs/index.d.ts} +0 -0
  73. /package/{src/react/index.ts → dist/cjs/react/index.d.ts} +0 -0
  74. /package/{src/util/index.ts → dist/cjs/util/index.d.ts} +0 -0
@@ -0,0 +1,47 @@
1
+ import { Properties } from 'csstype';
2
+ import { SimpleStyleRegistry } from './simpleStyleRegistry.js';
3
+ import { SimpleStyleRules } from './types.js';
4
+ export type CreateStylesOptions = Partial<{
5
+ /**
6
+ * If true, automatically renders generated styles
7
+ * to the DOM in an injected <style /> tag
8
+ */
9
+ flush: boolean;
10
+ /**
11
+ * If set, along with flush: true,
12
+ * will render the injected <style /> after this element
13
+ */
14
+ insertAfter?: HTMLElement;
15
+ /**
16
+ * If set, along with flush: true,
17
+ * will render the injects <style /> before this element
18
+ */
19
+ insertBefore?: HTMLElement;
20
+ /**
21
+ * if set, will automatically prevent any styles from
22
+ * being flushed to the DOM or inserted at all.
23
+ * All styles will be accumulated in the registry
24
+ * and it will be up to you to determine how they should
25
+ * be flushed.
26
+ */
27
+ registry?: SimpleStyleRegistry;
28
+ }>;
29
+ export declare function rawStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(rules: T, options?: Partial<CreateStylesOptions>): string;
30
+ export declare function keyframes<T extends Record<string, Properties>>(frames: T, options?: CreateStylesOptions): [string, string];
31
+ export declare function makeCreateStyle(registry: SimpleStyleRegistry): <T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(rules: T) => {
32
+ classes: O;
33
+ stylesheet: string;
34
+ updateSheet: <T2 extends SimpleStyleRules, K2 extends keyof T2, O2 extends Record<K2, string>>(updatedRules: Partial<T2>) => {
35
+ classes: Record<string | number | keyof T2, string>;
36
+ stylesheet: string;
37
+ } | null;
38
+ };
39
+ export default function createStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(rules: T, options?: Partial<CreateStylesOptions>): {
40
+ classes: O;
41
+ stylesheet: string;
42
+ updateSheet: <T2 extends SimpleStyleRules, K2 extends keyof T2, O2 extends Record<K2, string>>(updatedRules: Partial<T2>) => {
43
+ classes: Record<string | number | keyof T2, string>;
44
+ stylesheet: string;
45
+ } | null;
46
+ };
47
+ export type CreateStylesArgs = Parameters<typeof createStyles>;
@@ -0,0 +1,174 @@
1
+ import merge from 'deepmerge';
2
+ import { generateClassName } from './generateClassName.mjs';
3
+ import { getPosthooks } from './plugins.mjs';
4
+ function isNestedSelector(r) {
5
+ return /&/g.test(r);
6
+ }
7
+ function isMedia(r) {
8
+ return r.toLowerCase().startsWith('@media');
9
+ }
10
+ function formatCSSRuleName(rule) {
11
+ return rule.replaceAll(/([A-Z])/g, (p1)=>`-${p1.toLowerCase()}`);
12
+ }
13
+ function formatCSSRules(cssRules) {
14
+ return Object.entries(cssRules).reduce((prev, [cssProp, cssVal])=>`${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)};`, '');
15
+ }
16
+ function execCreateStyles(rules, options, parentSelector, noGenerateClassName = false) {
17
+ const out = {};
18
+ let sheetBuffer = '';
19
+ let mediaQueriesBuffer = '';
20
+ const styleEntries = Object.entries(rules);
21
+ let ruleWriteOpen = false;
22
+ const guardCloseRuleWrite = ()=>{
23
+ if (ruleWriteOpen) sheetBuffer += '}';
24
+ ruleWriteOpen = false;
25
+ };
26
+ for (const [classNameOrCSSRule, classNameRules] of styleEntries){
27
+ // if the classNameRules is a string, we are dealing with a display: none; type rule
28
+ if (isMedia(classNameOrCSSRule)) {
29
+ if (typeof classNameRules !== 'object') throw new Error('Unable to map @media query because rules / props are an invalid type');
30
+ guardCloseRuleWrite();
31
+ mediaQueriesBuffer += `${classNameOrCSSRule}{`;
32
+ const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(classNameRules, options, parentSelector);
33
+ mediaQueriesBuffer += regularOutput;
34
+ mediaQueriesBuffer += '}';
35
+ mediaQueriesBuffer += mediaQueriesOutput;
36
+ } else if (isNestedSelector(classNameOrCSSRule)) {
37
+ if (!parentSelector) throw new Error('Unable to generate nested rule because parentSelector is missing');
38
+ guardCloseRuleWrite();
39
+ // format of { '& > span': { display: 'none' } } (or further nesting)
40
+ const replaced = classNameOrCSSRule.replaceAll('&', parentSelector);
41
+ for (const selector of replaced.split(/,\s*/)){
42
+ const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(classNameRules, options, selector);
43
+ sheetBuffer += regularOutput;
44
+ mediaQueriesBuffer += mediaQueriesOutput;
45
+ }
46
+ } else if (!parentSelector && typeof classNameRules === 'object') {
47
+ guardCloseRuleWrite();
48
+ const generated = noGenerateClassName ? classNameOrCSSRule : generateClassName(classNameOrCSSRule);
49
+ // @ts-expect-error - yes, we can index this object here, so be quiet
50
+ out[classNameOrCSSRule] = generated;
51
+ const generatedSelector = `${noGenerateClassName ? '' : '.'}${generated}`;
52
+ const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(classNameRules, options, generatedSelector);
53
+ sheetBuffer += regularOutput;
54
+ mediaQueriesBuffer += mediaQueriesOutput;
55
+ } else {
56
+ if (!parentSelector) throw new Error('Unable to write css props because parent selector is null');
57
+ if (ruleWriteOpen) {
58
+ sheetBuffer += formatCSSRules({
59
+ [classNameOrCSSRule]: classNameRules
60
+ });
61
+ } else {
62
+ sheetBuffer += `${parentSelector}{${formatCSSRules({
63
+ [classNameOrCSSRule]: classNameRules
64
+ })}`;
65
+ ruleWriteOpen = true;
66
+ }
67
+ }
68
+ }
69
+ guardCloseRuleWrite();
70
+ return {
71
+ classes: out,
72
+ sheetBuffer,
73
+ mediaQueriesBuffer
74
+ };
75
+ }
76
+ function replaceBackReferences(out, sheetContents) {
77
+ let outputSheetContents = sheetContents;
78
+ const toReplace = [];
79
+ const toReplaceRegex = /\$\w([a-zA-Z0-9_-]+)?/gm;
80
+ let matches = toReplaceRegex.exec(outputSheetContents);
81
+ while(matches){
82
+ toReplace.push(matches[0].valueOf());
83
+ matches = toReplaceRegex.exec(outputSheetContents);
84
+ }
85
+ for (const r of toReplace){
86
+ outputSheetContents = outputSheetContents.replace(r, `.${out[r.slice(1)] ?? ''}`);
87
+ }
88
+ return getPosthooks().reduce((prev, hook)=>hook(prev), outputSheetContents);
89
+ }
90
+ function createSheet(sheetContents) {
91
+ const doc = globalThis.document;
92
+ if (doc === undefined) return null;
93
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
94
+ if (typeof doc?.head?.appendChild !== 'function' || typeof doc.createElement !== 'function') return null;
95
+ const styleTag = doc.createElement('style');
96
+ styleTag.innerHTML = sheetContents;
97
+ return styleTag;
98
+ }
99
+ function flushSheetContents(sheetContents, options) {
100
+ // In case we're in come weird test environment that doesn't support JSDom
101
+ const styleTag = createSheet(sheetContents);
102
+ if (styleTag) {
103
+ if (options?.insertAfter && options.insertBefore) {
104
+ throw new Error('Both insertAfter and insertBefore were provided. Please choose only one.');
105
+ }
106
+ if (options?.insertAfter?.after) options.insertAfter.after(styleTag);
107
+ else if (options?.insertBefore?.before) options.insertBefore.before(styleTag);
108
+ else document.head.append(styleTag);
109
+ }
110
+ return styleTag;
111
+ }
112
+ function coerceCreateStylesOptions(options) {
113
+ return {
114
+ flush: options && typeof options.flush === 'boolean' ? options.flush : true
115
+ };
116
+ }
117
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
118
+ export function rawStyles(rules, options) {
119
+ const coerced = coerceCreateStylesOptions(options);
120
+ const { sheetBuffer: sheetContents, mediaQueriesBuffer: mediaQueriesContents } = execCreateStyles(rules, coerced, null, true);
121
+ const mergedContents = `${sheetContents}${mediaQueriesContents}`;
122
+ if (coerced.flush) flushSheetContents(mergedContents, options);
123
+ return mergedContents;
124
+ }
125
+ export function keyframes(frames, options) {
126
+ const coerced = coerceCreateStylesOptions(options);
127
+ const keyframeName = generateClassName('keyframes_');
128
+ const { sheetBuffer: keyframesContents } = execCreateStyles(frames, coerced, null, true);
129
+ const sheetContents = `@keyframes ${keyframeName}{${keyframesContents}}`;
130
+ if (coerced.flush) flushSheetContents(sheetContents);
131
+ return [
132
+ keyframeName,
133
+ sheetContents
134
+ ];
135
+ }
136
+ export function makeCreateStyle(registry) {
137
+ return function wrappedCreateStyles(rules) {
138
+ return createStyles(rules, {
139
+ registry
140
+ });
141
+ };
142
+ }
143
+ export default function createStyles(rules, options) {
144
+ const coerced = coerceCreateStylesOptions(options);
145
+ const { classes: out, sheetBuffer: sheetContents, mediaQueriesBuffer: mediaQueriesContents } = execCreateStyles(rules, coerced, null);
146
+ const mergedContents = `${sheetContents}${mediaQueriesContents}`;
147
+ const replacedSheetContents = replaceBackReferences(out, mergedContents);
148
+ let sheet = null;
149
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
150
+ const updateSheet = (updatedRules)=>{
151
+ if ((options?.flush || options?.registry) && sheet || !options?.flush) {
152
+ // We prefer the first set, and then we shallow merge
153
+ const { classes: updatedOut, sheetBuffer: updatedSheetContents, mediaQueriesBuffer: updatedMediaQueriesContents } = execCreateStyles(merge(rules, updatedRules), {
154
+ flush: false
155
+ }, null);
156
+ const updatedMergedContents = `${updatedSheetContents}${updatedMediaQueriesContents}`;
157
+ const updatedReplacedSheetContents = replaceBackReferences(out, updatedMergedContents);
158
+ if (sheet) sheet.innerHTML = updatedReplacedSheetContents;
159
+ return {
160
+ classes: updatedOut,
161
+ stylesheet: updatedSheetContents
162
+ };
163
+ }
164
+ return null;
165
+ };
166
+ if (!options?.registry && coerced.flush) sheet = flushSheetContents(replacedSheetContents, options);
167
+ else if (options?.registry) options.registry.add(replacedSheetContents);
168
+ // Need this TS cast to get solid code assist from the consumption-side
169
+ return {
170
+ classes: out,
171
+ stylesheet: replacedSheetContents,
172
+ updateSheet
173
+ };
174
+ }
@@ -0,0 +1,3 @@
1
+ export declare function setSeed(seed: number | null): void;
2
+ export declare function getUniqueSuffix(): string;
3
+ export declare function generateClassName(c: string): string;
@@ -0,0 +1,36 @@
1
+ import numToAlpha from './numToAlpha.mjs';
2
+ let inc = Date.now();
3
+ export function setSeed(seed) {
4
+ if (seed === null) {
5
+ inc = Date.now();
6
+ return;
7
+ }
8
+ if (typeof seed !== 'number') throw new Error('Unable to setSeed as provided seed was not a valid number');
9
+ if (seed === Number.MAX_SAFE_INTEGER) throw new Error('Unable to setSeed because the seed was already the maximum safe JavaScript number allowed');
10
+ if (seed === Number.POSITIVE_INFINITY || seed === Number.NEGATIVE_INFINITY) throw new Error('Unable to setSeed. Positive or negative infinity is not allowed');
11
+ if (seed < 0) throw new Error('Unable to setSeed. Seed must be a number >= 0');
12
+ inc = seed;
13
+ }
14
+ const numPairsRegex = /(\d{1,2})/g;
15
+ export function getUniqueSuffix() {
16
+ const numPairs = [];
17
+ const incStr = inc.toString();
18
+ let result = numPairsRegex.exec(incStr);
19
+ while(result){
20
+ numPairs.push(result[0]);
21
+ result = numPairsRegex.exec(incStr);
22
+ }
23
+ let out = '_';
24
+ for (const pair of numPairs){
25
+ const val = +pair;
26
+ if (val > 25) {
27
+ const [first, second] = pair.split('');
28
+ out += `${numToAlpha(Number(first))}${numToAlpha(Number(second))}`;
29
+ } else out += numToAlpha(val);
30
+ }
31
+ inc += 1;
32
+ return out;
33
+ }
34
+ export function generateClassName(c) {
35
+ return `${c}${getUniqueSuffix()}`;
36
+ }
@@ -0,0 +1,6 @@
1
+ export type { CreateStylesArgs, CreateStylesOptions } from './createStyles.js';
2
+ export { default as createStyles, keyframes, rawStyles } from './createStyles.js';
3
+ export { setSeed } from './generateClassName.js';
4
+ export type { PosthookPlugin } from './plugins.js';
5
+ export { registerPosthook } from './plugins.js';
6
+ export type { SimpleStyleRules } from './types.js';
@@ -0,0 +1,3 @@
1
+ export { default as createStyles, keyframes, rawStyles } from './createStyles.mjs';
2
+ export { setSeed } from './generateClassName.mjs';
3
+ export { registerPosthook } from './plugins.mjs';
@@ -0,0 +1 @@
1
+ export default function numToAlpha(num: number): string;
@@ -0,0 +1,4 @@
1
+ const alphas = 'abcdefghijklmnopqrstuvwxyz'.split('');
2
+ export default function numToAlpha(num) {
3
+ return String(alphas[num]);
4
+ }
@@ -0,0 +1 @@
1
+ { "type": "module" }
@@ -0,0 +1,3 @@
1
+ export type PosthookPlugin = (sheetContents: string) => string;
2
+ export declare function getPosthooks(): PosthookPlugin[];
3
+ export declare function registerPosthook(posthook: PosthookPlugin): void;
@@ -0,0 +1,7 @@
1
+ const posthooks = [];
2
+ export function getPosthooks() {
3
+ return posthooks;
4
+ }
5
+ export function registerPosthook(posthook) {
6
+ posthooks.push(posthook);
7
+ }
@@ -0,0 +1 @@
1
+ export * from './useCreateStyles.js';
@@ -0,0 +1 @@
1
+ export * from './useCreateStyles.mjs';
@@ -0,0 +1,3 @@
1
+ import { CreateStylesOptions } from '../createStyles.js';
2
+ import { SimpleStyleRules } from '../types.js';
3
+ export declare function useCreateStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(rules: T, options?: Partial<Omit<CreateStylesOptions, 'flush'>>): O;
@@ -0,0 +1,58 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import createStyles from '../createStyles.mjs';
3
+ import { deepEqual } from '../util/index.mjs';
4
+ export function useCreateStyles(rules, options) {
5
+ // cache rules to compare later
6
+ const [cachedRules, setCachedRules] = useState(()=>rules);
7
+ // memoize options but keep them live
8
+ const cachedOptions = useMemo(()=>({
9
+ ...options
10
+ }), [
11
+ options
12
+ ]);
13
+ const didFirstWriteRef = useRef(false);
14
+ const styleTagRef = useRef(typeof document === 'undefined' ? null : document.createElement('style'));
15
+ // initialize styles
16
+ const [styleState, setStyleState] = useState(()=>createStyles(rules, {
17
+ ...cachedOptions,
18
+ flush: false
19
+ }));
20
+ const { classes, stylesheet, updateSheet } = styleState;
21
+ // mount/unmount style tag
22
+ useEffect(()=>{
23
+ if (!styleTagRef.current) return;
24
+ const { current: s } = styleTagRef;
25
+ document.head.append(s);
26
+ return ()=>{
27
+ s.remove();
28
+ };
29
+ }, []);
30
+ // update stylesheet when rules change
31
+ useEffect(()=>{
32
+ if (!styleTagRef.current) return;
33
+ if (!didFirstWriteRef.current) {
34
+ didFirstWriteRef.current = true;
35
+ styleTagRef.current.innerHTML = stylesheet;
36
+ return;
37
+ }
38
+ if (!deepEqual(rules, cachedRules)) {
39
+ setCachedRules(rules);
40
+ const updated = updateSheet(rules);
41
+ if (updated) {
42
+ styleTagRef.current.innerHTML = updated.stylesheet;
43
+ // use the fresh updateSheet from updated
44
+ // @ts-expect-error - this cast is safe and is only for us, internally, anyways
45
+ setStyleState({
46
+ ...updated,
47
+ updateSheet
48
+ });
49
+ }
50
+ }
51
+ }, [
52
+ cachedRules,
53
+ rules,
54
+ stylesheet,
55
+ updateSheet
56
+ ]); // only depend on rules + updater
57
+ return classes;
58
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Acts as an accumulator for all
3
+ * generated css that occurs via createStyles().
4
+ *
5
+ * React variant of this will come after the baseline one is created
6
+ */
7
+ export declare class SimpleStyleRegistry {
8
+ private sheets;
9
+ add(contents: string): void;
10
+ getCSS(): string;
11
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Acts as an accumulator for all
3
+ * generated css that occurs via createStyles().
4
+ *
5
+ * React variant of this will come after the baseline one is created
6
+ */ export class SimpleStyleRegistry {
7
+ sheets = [];
8
+ add(contents) {
9
+ this.sheets.push(contents);
10
+ }
11
+ getCSS() {
12
+ return this.sheets.reduce((prev, contents)=>`${prev}
13
+ ${contents}`, '');
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ import { Properties } from 'csstype';
2
+ export type SimpleStyleRules = {
3
+ [key: string]: Properties | SimpleStyleRules;
4
+ };
5
+ export type RenderableSimpleStyleRules = SimpleStyleRules & Record<string, Properties[]>;
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export declare function deepEqual<O1 extends Record<string | number | symbol, any>, O2 extends Record<string | number | symbol, any>>(o1: O1, o2: O2): boolean;
@@ -0,0 +1,17 @@
1
+ export function deepEqual(o1, o2) {
2
+ // We'll sort the keys, just in case the user kept things the same but the object is all wonky, order-wise
3
+ const o1Keys = Object.keys(o1).sort();
4
+ const o2Keys = Object.keys(o2).sort();
5
+ if (o1Keys.length !== o2Keys.length) return false;
6
+ if (o1Keys.some((key, i)=>o2Keys[i] !== key)) return false;
7
+ // Okay, the keys SHOULD be the same
8
+ // so we need to test their values, recursively, to verify equality
9
+ return o1Keys.reduce((prev, key)=>{
10
+ if (!prev) return prev; // we've already failed equality checks here
11
+ if (!(key in o2)) return false;
12
+ if (typeof o1[key] !== 'object') {
13
+ return o1[key] === o2[key];
14
+ }
15
+ return deepEqual(o1[key], o2[key]);
16
+ }, true);
17
+ }
@@ -0,0 +1 @@
1
+ export * from './deepEqual.js';
@@ -0,0 +1 @@
1
+ export * from './deepEqual.mjs';
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "simplestyle-js",
3
- "version": "3.4.0",
3
+ "version": "3.4.2-alpha.0",
4
4
  "description": "An incredibly straightforward and simple CSS-in-JS solution with zero runtime dependencies, and out-of-the-box TypeScript support",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/benduran/simplestyle.git"
9
9
  },
10
+ "files": [
11
+ "dist/**"
12
+ ],
10
13
  "scripts": {
11
14
  "build": "bun run clean && bun run build:package",
12
15
  "build:package": "ts-duality --clean",
@@ -126,6 +129,16 @@
126
129
  "default": "./dist/esm/react/useCreateStyles.mjs"
127
130
  }
128
131
  },
132
+ "./simpleStyleRegistry": {
133
+ "require": {
134
+ "types": "./dist/cjs/simpleStyleRegistry.d.ts",
135
+ "default": "./dist/cjs/simpleStyleRegistry.cjs"
136
+ },
137
+ "import": {
138
+ "types": "./dist/esm/simpleStyleRegistry.d.ts",
139
+ "default": "./dist/esm/simpleStyleRegistry.mjs"
140
+ }
141
+ },
129
142
  "./types": {
130
143
  "require": {
131
144
  "types": "./dist/cjs/types.d.ts",
package/.coveralls.yml DELETED
@@ -1,2 +0,0 @@
1
-
2
- repo_token: uY6uUzkf19sVsimk8VD7MbdoaBexQiuCJ
package/.editorconfig DELETED
@@ -1,7 +0,0 @@
1
- [*]
2
- root = true
3
- charset = utf-8
4
- end_of_line = lf
5
- indent_size = 2
6
- indent_style = space
7
- insert_final_newline = true
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "endOfLine": "lf",
3
- "printWidth": 180,
4
- "semi": true,
5
- "trailingComma": "all",
6
- "singleQuote": true
7
- }
package/.tool-versions DELETED
@@ -1,3 +0,0 @@
1
- bun 1.3.3
2
- node 22.21.0
3
- npm 11.6.2
package/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 20
4
- script:
5
- - npm i -g bun@1.3.3
6
- - bun run ci
7
- - bun run test
8
- - bun run coveralls
@@ -1,36 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "name": "Attach",
9
- "port": 9229,
10
- "request": "attach",
11
- "skipFiles": [
12
- "<node_internals>/**"
13
- ],
14
- "type": "pwa-node"
15
- },
16
- {
17
- "type": "node",
18
- "request": "launch",
19
- "name": "Jest Current File",
20
- "program": "${workspaceFolder}/node_modules/.bin/jest",
21
- "args": [
22
- "${fileBasenameNoExtension}",
23
- "--config",
24
- "jest.config.js",
25
- "--env",
26
- "jsdom"
27
- ],
28
- "console": "integratedTerminal",
29
- "internalConsoleOptions": "neverOpen",
30
- "disableOptimisticBPs": true,
31
- "windows": {
32
- "program": "${workspaceFolder}/node_modules/jest/bin/jest",
33
- }
34
- }
35
- ]
36
- }
@@ -1,3 +0,0 @@
1
- {
2
- "editor.formatOnSave": false
3
- }