simplestyle-js 3.4.0 → 3.4.1

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 (70) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/createStyles.cjs +191 -0
  3. package/dist/cjs/createStyles.d.ts +30 -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/types.cjs +4 -0
  16. package/{src/types.ts → dist/cjs/types.d.ts} +1 -3
  17. package/dist/cjs/util/deepEqual.cjs +27 -0
  18. package/dist/cjs/util/deepEqual.d.ts +1 -0
  19. package/dist/cjs/util/index.cjs +18 -0
  20. package/dist/esm/createStyles.d.ts +30 -0
  21. package/dist/esm/createStyles.mjs +166 -0
  22. package/dist/esm/generateClassName.d.ts +3 -0
  23. package/dist/esm/generateClassName.mjs +36 -0
  24. package/dist/esm/index.d.ts +6 -0
  25. package/dist/esm/index.mjs +3 -0
  26. package/dist/esm/numToAlpha.d.ts +1 -0
  27. package/dist/esm/numToAlpha.mjs +4 -0
  28. package/dist/esm/package.json +1 -0
  29. package/dist/esm/plugins.d.ts +3 -0
  30. package/dist/esm/plugins.mjs +7 -0
  31. package/dist/esm/react/index.d.ts +1 -0
  32. package/dist/esm/react/index.mjs +1 -0
  33. package/dist/esm/react/useCreateStyles.d.ts +3 -0
  34. package/dist/esm/react/useCreateStyles.mjs +58 -0
  35. package/dist/esm/types.d.ts +5 -0
  36. package/dist/esm/types.mjs +1 -0
  37. package/dist/esm/util/deepEqual.d.ts +1 -0
  38. package/dist/esm/util/deepEqual.mjs +17 -0
  39. package/dist/esm/util/index.d.ts +1 -0
  40. package/dist/esm/util/index.mjs +1 -0
  41. package/package.json +4 -1
  42. package/.coveralls.yml +0 -2
  43. package/.editorconfig +0 -7
  44. package/.prettierrc +0 -7
  45. package/.tool-versions +0 -3
  46. package/.travis.yml +0 -8
  47. package/.vscode/launch.json +0 -36
  48. package/.vscode/settings.json +0 -3
  49. package/CHANGELOG.md +0 -273
  50. package/eslint.config.js +0 -3
  51. package/setup.sh +0 -4
  52. package/src/createStyles.ts +0 -251
  53. package/src/generateClassName.ts +0 -43
  54. package/src/numToAlpha.ts +0 -5
  55. package/src/plugins.ts +0 -11
  56. package/src/react/useCreateStyles.ts +0 -58
  57. package/src/util/deepEqual.ts +0 -20
  58. package/test/createStyles.spec.ts +0 -330
  59. package/test/deepEqual.spec.ts +0 -97
  60. package/test/generateClassName.spec.ts +0 -48
  61. package/test/keyframes.spec.ts +0 -19
  62. package/test/plugins.spec.ts +0 -43
  63. package/test/react/useCreateStyles.spec.tsx +0 -65
  64. package/test/updateStyles.spec.ts +0 -41
  65. package/tsconfig.build.json +0 -8
  66. package/tsconfig.json +0 -37
  67. package/vite.config.ts +0 -9
  68. /package/{src/index.ts → dist/cjs/index.d.ts} +0 -0
  69. /package/{src/react/index.ts → dist/cjs/react/index.d.ts} +0 -0
  70. /package/{src/util/index.ts → dist/cjs/util/index.d.ts} +0 -0
package/CHANGELOG.md DELETED
@@ -1,273 +0,0 @@
1
- ## 3.4.0 (2025-12-01)
2
-
3
- ### 🔀 Miscellaneous 🔀
4
-
5
- - Merge pull request #51 from benduran/update-everything (aa20cc703cefcadd789d4039df0d35c6a5012da7)
6
-
7
- ---
8
-
9
- ## 3.3.1-beta.0 (2025-12-01)
10
-
11
- ### 🔀 Miscellaneous 🔀
12
-
13
- - chore: addressed all linting issues and updated some nullish checks (b3a7cf6d2a7f96fdc3c5bf987be5757ca053584f)
14
- - chore: updated everything (822f0820832462742d4a4c7a217b053b6174e522)
15
-
16
-
17
-
18
- ### ✨ Features ✨
19
-
20
- - feat: update to using ts-duality for building (e0b0a788d39bd63d8517ae31f35bebfc6e74a9c5)
21
-
22
-
23
-
24
- ### 📖 Docs 📖
25
-
26
- - docs: Update README.md (3d7b15ee53050ca75bac185ff12eecba68a5c3f4)
27
-
28
- ---
29
-
30
- ## 3.3.0 (2024-01-13)
31
-
32
- ### 🔀 Miscellaneous 🔀
33
-
34
- - chore: dropped jest for vitest and went back to tried-and-true npm (instead of pnpm) (c769557f350e4019fee38250e1419d9d93ee928f)
35
- - chore: update deps (most importantly, the CSS typings) (954718f9f4a889a0458eeaef513c551559fd3fbe)
36
- - Merge pull request #41 from benduran/bduran/guard-against-no-DOM (8b84dda0aca4629071496c11c6e6a1670f331ac1)
37
- - 3.2.2 (b6b9abd3944ef9cde8c394285d720f5db62a8bbb)
38
- - 3.2.2-beta.2 (6348d0fe3bb05ecdc5e96afe16f7c5c414ff2deb)
39
- - 3.2.2-beta.1 (82288e8a49de1ed71d494e790499da8f27a2bfd9)
40
- - 3.2.2-beta.0 (e4e6c9473cbc2f8e5b344ca85e24d5b176cdaf86)
41
- - 3.2.1 (2fa6992ab2ec8e2f12bb0976d46650fc479f0d17)
42
- - 3.2.0 (e7488eebaa08af10a8c6a4e4ddd54bd06b3a325b)
43
- - Merge pull request #39 from benduran/dependabot/npm_and_yarn/minimist-1.2.6 (edbe4b781e1301a4a3a94340001912f09c91b293)
44
- - Merge pull request #38 from benduran/dependabot/npm_and_yarn/nanoid-3.2.0 (f92e33013516dceab3be20263bdc1fd6055431b5)
45
- - Merge pull request #37 from benduran/dependabot/npm_and_yarn/ansi-regex-5.0.1 (29777b5a9ce21dc5254d38dc644c6531500e7836)
46
- - chore: swapped yarn for pnpm in travis (94e7264febb2b499e0b4e182d2af190fea00046a)
47
- - 3.1.4-beta.1 (1f6cf826f72b075054b90997d8a1e262d56d2240)
48
- - chore: switched to isolated modules to fix typing exports (ea3af0a39b93aafcd4cfc459f4feecf53d96ee93)
49
- - 3.1.4-beta.0 (3b5b9fcb91d17fa1d514b9e70de8e6dacd214ea1)
50
- - chore: updated build and deps and switched to pnpm (f548dae39bcc4acd6e0fe5bc68f90b1838b552df)
51
- - build(deps): bump minimist from 1.2.5 to 1.2.6 (c966b8a77b36c42f0aa89817d486eae87183f327)
52
- - build(deps): bump nanoid from 3.1.25 to 3.2.0 (22b09a626e3feffdacac5230c328cf582401f3ed)
53
- - build(deps): bump ansi-regex from 5.0.0 to 5.0.1 (26abd2b15795d817f64778de84e06ca47f53dd68)
54
- - Merge pull request #36 from benduran/dependabot/npm_and_yarn/tmpl-1.0.5 (bdd9aa7a8bdf10fd3f922f263843954db49d9703)
55
- - build(deps): bump tmpl from 1.0.4 to 1.0.5 (8a3dbd8789f322f4fee4596f20fcb97f000411ad)
56
- - 3.1.3 (0bc91b8ba61257ac4341e4eec0d507f1e8e85614)
57
- - 3.1.2 (77a918ed2100f29c0158ca49d3a8ae9d5b9379e2)
58
- - chore: updated deps (2c386ecff6a1daa354c809aa7d6c30ef48858010)
59
- - 3.1.1 (1c2fa1392c93e27cc38522c9b70ac56635b31efe)
60
- - Update README.md (39075fe79744cb4327376b0863d2b325c263d73b)
61
- - 3.1.0 (3e4fb585facc7706c4ca185c63ccb9e5bcd5619a)
62
- - chore: fixed missing readme and license on publish (978495660febd617345c1c87b4aee1241c6aee27)
63
- - Merge pull request #35 from benduran/bduran/react-libs (a40b5588bfb15c8b99b69223d11227c45862e687)
64
- - 3.0.1-3 (73a9577f5af007b3704cc5d24dc7f003c37e5b1f)
65
- - 3.0.1-2 (056a521c15b4b19eb57c67714c19210c427497d2)
66
- - 3.0.1-1 (06a229e1aa9569ec460131ddaa46b485e2e5a1f3)
67
- - 3.0.1-0 (4333a88a3bc34ab3712ce687b9f2c9fd62dc5d84)
68
- - chore: updated version number (2e6411f5ecf67682b176857562531f674e99f568)
69
- - Merge pull request #34 from benduran/bduran/change-update-function-and-typings (43999e68531f5351881a38dba8a850d2c4b0c443)
70
- - chore: updated bundle size (48cfb4f24d6faa795e84961edf8a0aaa76613467)
71
- - 3.0.0-beta.4 (162ccb0fdb003468e65f200e7739e8f025594629)
72
- - chore: added deepmerge (6fd9c39d532d4724924cbd4b5c4b61b64002b39d)
73
- - 3.0.0-beta.3 (20ff5d9a8e19cbcf88b2f21e704c5f7cdee247f8)
74
- - 3.0.0-beta.2 (c08c2ce110c5a3f4981c977f1789da02b0a582f2)
75
- - 3.0.0-beta.1 (afbe30665ec7752756cde011eb52ab07c211fa4d)
76
- - chore: updated tests to match new expected format (b6335c2ee6a4faae438c2195cf387a81893b8270)
77
- - chore: extreme bump to next major version 🙂 (25de314f04ea41402f6e12048bbcc7439dbfd666)
78
- - chore: removed the prepublish script (48863e150f8da92574e4999f7f4ec77afcfb39ee)
79
- - chore: 100% moved away from tsdx (4d2cfa5f71bc024a875729256d392be4562bfccf)
80
- - chore: updated lint config (aa4c59797664b498e9c83d172ed6b3042bc0294e)
81
- - 2.6.0 (1b683d2745f5eccdd75f3788c29f8c1b87013326)
82
- - chore: update all deps (8150990b8e9dfd5b71c7f3ed72e21fb1b6945e58)
83
- - Merge pull request #27 from benduran/bduran/update-deps (fbc1b600f115449407208e13c1ba355924e308a6)
84
- - chore: update deps (2fa86958244fcbb19df7e502f7106479c563594e)
85
- - 2.5.0 (292f9195d4b1d7be19a61047d33eddc34133d688)
86
- - Merge pull request #26 from benduran/feature/update-existing (b1e03e76750b831a949af10a8b0af54b019ba17b)
87
- - Merge pull request #25 from benduran/breaking/remove-accumulate (ddf9cf70872aecc52150ffa1003d28c054d47596)
88
- - 2.4.0 (93e352ae627c2fa04ef4f0e9a0714fa4d8ae3d26)
89
- - feature: remove accumulate because it's broken and nobody uses it (aa0a243d241d49e5f5b432edd57444944b33ad26)
90
- - 2.3.1 (8f912fc742b3b7f07119eb55bb807795257b59a4)
91
- - Merge pull request #24 from benduran/feature/dep_updates (67645e606b2374434c2d12d8d94f798f7ed74299)
92
- - chore: updated deps and added git hooks (0aff14232f714cef4a7582e7ae7eda98a1b3089e)
93
- - Merge pull request #23 from benduran/add-license-1 (d636728993997dc8a1a9445fb2c7db7eecb59c4e)
94
- - Create LICENSE (8964037f3e719657bab1528b36d30ca7a7a92079)
95
- - chore: remove files (befdbe0bfdb675237a3f7678d18c4057a278d90f)
96
- - chore: ignore webstorm files (d3d941a7c4cc33b4d1c3b7c7320a4c1f08490ea3)
97
- - Merge pull request #22 from benduran/dependabot/npm_and_yarn/lodash-4.17.19 (27a841bfb836169c3d327c6b3837b6677dad6725)
98
- - Bump lodash from 4.17.15 to 4.17.19 (ff11203adb9853a66e8490bfc39b46302e094f5e)
99
- - Release version (643e4c266b78ded758f99eeb033d07ed84802b22)
100
- - Merge pull request #21 from benduran/feature/tsdx (045fc66785d86e132d60ead74f12c977fa0f2c70)
101
- - chore: added beta version (800fc7a152601d42f00febdf0fbea5e502c57057)
102
- - 2.3.0 (9bd2a274ba56a1c7366b0b9931e1584b88eaa625)
103
- - chore: updated package.json exports (2becd46a1bd96eb49d25bd21e11c985c71a84c92)
104
- - 2.2.0 (5c0ffdbd94f864282c714be6c411eb75d52bd670)
105
- - Merge pull request #20 from benduran/feature/custom_start_seed (7155fe609810980d5d99f0afc7480faf949f2e91)
106
- - chore: added test to increase coveralls (558c6c8735bdb085953e429ca38b5cc5adac1a62)
107
- - 2.1.4 (7e73de0804a367d80175e749a2d044af5392c0e0)
108
- - Flubbed backtick in readme (a51ae30ecc219c6209a625cb876d88915bc8c75d)
109
- - Merge pull request #18 from benduran/update_readme (7dc62fbc218f4a9600c911149db03723f1bc7b58)
110
- - 2.1.3 (ee40005cdf66bb1d31e05887e0382dfa3fbc518e)
111
- - Had to breakup the advanced example into sections because the markdown syntax hilighting parser was getting all hosed (695364f872309113215e47080515b8f546c4cb6a)
112
- - Merge pull request #17 from benduran/bug/put_media_queries_last (09932942f3c65530e5afb52d3ef2a4eedb9057dc)
113
- - missed semicolon on test (30608c72464b9910375ed83c89631bab700c390c)
114
- - 2.1.2 (f4d1eec61eef0eec7d6376153d9326eeaf53d91e)
115
- - fixed logic to write media queries last (1887f8533d9358fcc998f5f4000ff4cb2bea29ab)
116
- - Merge pull request #16 from benduran/readme_updates (eb5c8fc246edb45e42768d2650d1052ad5e75b4c)
117
- - 2.1.1 (cdaed475f5fc0d14c62a1e3521bc63b143165951)
118
- - updated readme (8d7d404a0ba5a06b7abcf35bf25d52f54b0e3dc8)
119
- - build update (036ddb358933bd43cf1483ee58b15ec3c3180741)
120
- - Merge pull request #15 from benduran/feature/v3 (759bfd7685dd95db3332cb8403061753ccfc47a8)
121
- - okay, we're going live (19d736fddf6d2062409d56a990bc6139b18a6c00)
122
- - updated to beta version (53a73e4d4e127502943818088fce71cbdfc3b2fe)
123
- - super simplified how the sheet contents are generated (1986a97d3e66cbeaa279410c651536ff317073b2)
124
- - Merge pull request #14 from benduran/bug/clobbering_mediaqueries (59b0289bd54cff6fb9664dd963200d2754b8ecfe)
125
- - 2.0.1 (1dabe453abd6fbac3d9297853a447803f3794cdd)
126
- - fixed bug that caused media queries to clobber eachother (f1ee9be9671283f83a9bcfa45024dbd425c85857)
127
- - added tests for pre and post hooks (5b7ff7e43b3a4dba0d372b3e992c50ff4cb81c08)
128
- - 2.0.0 (ee43fe4d6bd1b48bba0c3108b15a4fe901048956)
129
- - updated readme and added plugin hook exports (21a0df3c9e052ea2b1448203c66347954a8b6ab8)
130
- - 1.0.5 (c0ad149050ed31be01aeb5a426f2c4337e479c73)
131
- - 1.0.4 (12c55bf51eced64162630fb5ead7af06a3f58fd8)
132
- - 2.0.0-beta.5 (5c81c1e6633d55c299c9a7628ef188d1514a40d0)
133
- - prehooks work. have tests for them (b5593fc45f0f27289cc044fa81f2ff1e4cbe3c1f)
134
- - updated jest and tsconfig (dba985f9eca7ff7e6ae30e5521b94966eeaefe0e)
135
- - 2.0.0-beta.4 (6662b6457ec39b646d099f35ed15b64002ff902b)
136
- - fixed regular expression for replacing backreferences (b97b40e0b576745e01d3fbaacf88b94611a0c9b1)
137
- - 2.0.0-beta.3 (2d0bab8724068ed9073a5f2726b3204e45ee99cb)
138
- - added keyframe generation support (7f8e4e9653573bf4d5625e23a558f518e7f3dbff)
139
- - updated readme to show coverage badge (e6d3307228f8351d749f3cc7abd596706dcdca4a)
140
- - more package.json tweaks (12fd41ad8fa7a810b8b928ba85b3e27cc835d10d)
141
- - oops (33eee1371568074c941b40d8f6883815be13a3be)
142
- - Added coveralls support (58df60f45aa26ed25ece0767f16f29e861b50891)
143
- - 2.0.0-beta.2 (f6a352d097bcdf49f7ecb20c618c87ff57a923eb)
144
- - added support for style tag accumulation (638dcad29f5b6be69369794655b8cfbf341e65b5)
145
- - 2.0.0-beta.1 (80580da3b6263aa764a6150c12c53edecf5c942c)
146
- - Removed ESM build because the types got confused (a1e302ebd55b12d498a288b314b9dc2d9ffef44d)
147
- - More build tweaks (331a752dbb586151cd9d9665c0b1159affa5f911)
148
- - remove old build (3377f3f2394eaf77a15a30f904afe7c4fd7c8fa9)
149
- - 2.0.0-beta.0 (26006d11f6eea356b2ee86631971a9267b2e30af)
150
- - added index file with proper exporting of everything (6f88bfc6b02312a338a6183259ac2858280e08a2)
151
- - added support for raw, top-level styles, and also nesting support in the top-level styles (018957bbfbc302139cdf500b04bdb2a91942eb01)
152
- - Merge pull request #12 from benduran/dependabot/npm_and_yarn/acorn-5.7.4 (34f892b44ea792709c668e947bc70eb95bc067ca)
153
- - fixed support for comma-separated values and associated media queries (bfd4a8b114fe43476a5c0aa6a474302d28a9d12d)
154
- - removed sorting of output style rules. still a bug when having comma-separated parent selectors with nested media queries (01fa715ed1ca9e9166f3c83ff8cdc2ab8de35589)
155
- - fixed broken tests (a9202852b495e3f82fb92cc654921cf44f9aedbb)
156
- - removed oopsie only (1c194abb99bd7f280e8544a2a3de4ac513a5ec20)
157
- - added media query support (290c795fd7f5b23e75362688078fe8428fcdaa0d)
158
- - added sorting to the output stylesheets (4ab166870e9175dad7e597ce5b78a8bc147bd81e)
159
- - yay, almost all the earlier features are supported but with less code (195694046aaac79f5ce2ea8a53a92ee29a020118)
160
- - generating nested css props in an object. need to convert to a flat array (35bcafa357ef1fae70ed0c69f09599b5123c1e63)
161
- - updated core logic to be simpler but with the same features (d7b3a55c510088fb0dd94243ca1fecb4fa386f59)
162
- - start of rewrites to the parsing and rendering engine (f1ecbe11bf07e8fa15bc8f3e80353d852ecb0672)
163
- - start of rewrite (b7fad9d3b09146fbc3d885509321366054275022)
164
- - updated base style interface to be easier to parse and have better code assist (9a53b4eb49c5efeaa1b2b85bba5e1cd4b5a31764)
165
- - Bump acorn from 5.7.3 to 5.7.4 (89a0f6b40a4f8b23d9b4deafde6dff2d87ef53d0)
166
- - 1.0.3 (25676faff144b921dd52cc20265bc5a0439b9502)
167
- - Updated readme (17f9def906a0d565e15f3e8c183aea3b36cfd577)
168
- - 1.0.2 (d1209933e5351bd2bab62853a128874bc4e68bc4)
169
- - Updated readme to fix weird hilight issue when rendered on NPM (cbd9f8b2c63419476143bc42c53e2dfe584b0dfb)
170
- - 1.0.1 (2264db87770bce6a293582528c796adc9a2a583b)
171
- - readme updates (4caa240c9940c3cd8aaaf21ca4f225108adf3603)
172
- - Update README.md (3c051e3577b914f4100d7f1f91c7cec553715d6a)
173
- - Merge pull request #11 from benduran/feature/6_plugin_hooks (cae71b03bc64ab8fdcca4143106fcacdcd295ae8)
174
- - 1.0.0 (2716cc2c9a4d7e7fb26e0027c37a3eddd029d1db)
175
- - Updated readme to document how to properly create plugins (da9dded44c9360eefa7b346a7d37fefbe0426ec6)
176
- - Added additional prehook and posthook tests. Added a postcss with autoprefixer example in the tests (a46300b7516bac11a46cc5d6d6478c3ef7188f0d)
177
- - Fixed which rules were being used in the plugin hooks (06ed556bbb4b93f6b01fda36d0440aa30821a4cb)
178
- - fixed the build (6a343d9ba7339de9534b47d0cd3d977aa09a815f)
179
- - Added a validate prehook that adds vendor prefixing for border-box property (fc97855fc41b833bd8422a0d9c678fb6ba863a33)
180
- - Changed pre and post hook signatures. Also added some more tests (7375000d2b3f92c17bd91bdc4235f6b754b8494b)
181
- - Started wiring in pre-hooks and added initial tests (8cdbb8311367c51a7c7ce5e6e8fc8b781fd5a97e)
182
- - Updated deps (588a3390abe25a37669d0f580026429f55dcc55e)
183
- - 0.7.0 (466328e2f08756fc5389b2a135f8521d7dc8478a)
184
- - updated exports (1088db13f06491f3c6c8331b4810b65124c51907)
185
- - 0.6.1 (a3c7be725ac69cfacdca8e839e790e41b72df225)
186
- - updated deps (7b08caa2ac20da65a9268bfd0148ee25e7eac2ef)
187
- - Merge pull request #10 from benduran/feature/module_update (6543b5a08cbc5a19426ae78226f962098593a68c)
188
- - 0.6.0 (63dd180db8b5e521556d26980fe6cbb9cd68e41c)
189
- - updated module build and export definitions (19f4bde9454320bb4166e4bca3b3bbfb90badd54)
190
- - 0.5.3 (b609b5a5573ca11b045227162da4cab11efa2fc5)
191
- - Merge pull request #9 from benduran/bug/8_comma_separated_parents (0531af9bd24ca5f2dc3604bffa60b39700b6d191)
192
- - fixed https://github.com/benduran/simplestyle/issues/8 (d69fe0647b63f436b42b760a4f070e886ab9c85b)
193
- - Updated readme to mention zero dependencies (3b1f2b5b5b075f79cf78601ea4c927f14ce883f9)
194
- - 0.5.2 (818e200e8d24aaf9280be7cfd124d7cf0ef43dc5)
195
- - 0.5.1 (30a40fbd311897a745157efb775b26aa16598b04)
196
- - updated readme with the new keyframes method (f50038d6cfd909920542121c58acf3ed82fc9f3d)
197
- - add keyframe support (9045bedc19c702bf8ce4873aec32bd94b76bf158)
198
- - 0.5.0 (78e5b86ec69bda906423926674619fa9eceeceb3)
199
- - updated classname seed to use a shared seed to prevent race conditions (fa4dd2c2d2acde270867e162dbf49b950d478d17)
200
- - 0.4.0 (0f6aa3957dc727ea522a9f3ff613df8f733d7ece)
201
- - Merge pull request #5 from benduran/feature/api_simplification (d14bf5d629dff9d7d056c799aeb0d77ea21f2372)
202
- - added ability to use media queries (e524e2a0f84da0e24731a169ae71d42ff7c14318)
203
- - removed requirement gross $nested property (bec634ba8747c6d7bb9bf12d5b7182e64c49e7b6)
204
- - 0.3.5 (3f5e6391f5d4f6fb1c6a593a40af5f72efee95ea)
205
- - added missing repository package property (b35deeb69179ef6841f0e9bbda7e249f99394ae1)
206
- - 0.3.4 (8e5e3902bb7da8bcdf012205825eec1128715ef8)
207
- - Updated readmen (65b738c88fef6fb4df56a944736f8eb3e36c3768)
208
- - 0.3.3 (caff648e90ea2abc72df7415f5a00fead7c95b68)
209
- - fixed possible undefined issue on classname generation (7d1d331bb0cc1537c8ac70e8b52c24a2cda743d0)
210
- - 0.3.2 (1896d8201fdb0e860843fccd32d109c60bbbbd9d)
211
- - fixed bug with more detailed class keys not taking precedence over smaller ones (70588208ed414142569dad968df31b0926874ddb)
212
- - 0.3.1 (afc27a2bab6d99d6c223150b8f94834522761b6e)
213
- - Added logic to allow creation of classnames even when style block is empty (f2a410c1e4e25ef986e959daa867cdc496915ff8)
214
- - 0.3.0 (837f73fccb7b53fec72da87e06ef58ad8fdefdb5)
215
- - 0.2.3 (cba21a6a4e3ff2372947fce9924fee8e968e2629)
216
- - added a raw css rule function (88f605dc84ba525ac8114c8df64a14e479cbc1c0)
217
- - another oopsie (b48304a1f33957cf7d2e14496f0ce1d65160fb8f)
218
- - 0.2.2 (5541e1d0dc93ded7c7cc7fced843080bb758670c)
219
- - added additional conditional to prevent rendering of the same sheet multiple times (6db0a3e5ed008dff5455faf2f4d79479dd050de7)
220
- - 0.2.1 (b54bd443d55a7214290c3c9524f65ad32a154808)
221
- - fixed bug with nested selectors that are the same (78565682d56b877be662e1362284cd245737dd68)
222
- - 0.2.0 (ec315ed565ec9a4970b154f3ad859bc1cc87a37c)
223
- - Fixed issue where nested child selectors were cached when we only care about top-level selectors (2f9d68abd65b44a38640fec8064cc0d7f5f11580)
224
- - 0.1.2 (b03f36f82f0633f955d8d007b1b12b8e2689ced4)
225
- - missing src directory (b6a56db87edc60d7eb2ba04be900998568e5a8cf)
226
- - 0.1.1 (0ce45a2e5c6425c0ebd3196a2fb4129e732afc65)
227
- - Added missing package.json props (4942a6046ea90fe65eedbe8b10cfc499ac0f5c4e)
228
- - oopsie on the package.json prepublish script (f9cebb2b88f7aabc984e5ebf9fd2b7e1f67d974a)
229
- - baseline everything works (cae1b37b81cc3b1ffffc648d75b1de456d6c9df5)
230
- - initial super simple feature set (doesn't currently support recursive structures) (75f86b96711ce82e7a40df5220bf924e5078dd9a)
231
- - Initial commit (a3787bd6ebc765e1720ad35bf1b03dbe6fa175f5)
232
-
233
-
234
-
235
- ### 🛠️ Fixes 🛠️
236
-
237
- - fix: fixed missing document guard in the react hook (7302ef01f0e52e68142447bbfdde109124a06886)
238
- - fix: added additional top-level document guard (4078bdc8e8031bb694c5959d759746f3f3b58221)
239
- - fix: the build pipeline (616c2058eff3d9f62b4695c81efbdcc5cc319a9c)
240
- - fix: added guards for test or execution environments that don't have a vaid DOM (27a17e7626f5ab5e215017da55f2396546bbdaab)
241
- - fix: fixed erroneous / nonexistent export from react utils (979f948cd5d878369319b172fef0842b656f6289)
242
- - fix: fixed bug with deep equal logic (0855f2ada45d509eb492e71665a8306e74e3a88b)
243
- - fix: fixed bug with deep equal. this corrected issues with the React variant (af36e7b1d72c63280b7409458d01a4ed46ae7fd2)
244
- - fix: fixed update when flush was false (fa86cb29fb54938e69a722afc72b1599b6cd4e0f)
245
- - fix: removed import helpers (ff284d21800a76be3f149bf4d047deab4c17275e)
246
- - fix: fixed the updateSheet function to, you know, actually shallow merge (c4e50febc2d927962919d8c2ee241ba5f581fa48)
247
-
248
-
249
-
250
- ### 📖 Docs 📖
251
-
252
- - docs: updated readme (ef06f5b6bf016a7ef77eea46da399e4da347ace5)
253
- - docs: updated readme (94db1b52fe703d35975b361a2ac01aa3285ff1b4)
254
- - docs: updated Readme (ca2105af5da52bd301f3505e9e02360dbf36726d)
255
- - docs: updated readme to mention new createStyles API (1e37837cc3b6e1215e9f296c744733fa94cdb092)
256
- - docs: updated the readme with a live demo (d13d4babe562112bec8daa0cf4c40cd7c57c54a3)
257
- - docs: removed accumulate docs ref in readme (a76a70885c10d85547bfd7103565849ff5406a54)
258
- - docs: updated readme with new bundle sizings (8ed767f09f89ad4a377fc47c625a37bee2710f06)
259
- - docs: addressed PR comments (cd7b83418311bdbb44b69b93f069aa9f79d076b7)
260
-
261
-
262
-
263
- ### ✨ Features ✨
264
-
265
- - feat: added react utility tests (515bc8f5c8019eab1eeb2d5100c027b04800a1be)
266
- - feat: start of react hooks (9eb58e210ceca2fda6496f30fbe5fd3e314367d8)
267
- - feat: added insertBefore and insertAfter (06fc6a4725da3bdf08e8d905a5a43887b3291f7a)
268
- - feat: added function to update an existing sheet (f22b7661ead690c7619b3dd0775fc0da3f1623f8)
269
- - feat(tsdx): introduced tsdx for easier builds (e65fa544420a902662102f4657935ced246af53c)
270
- - feat: add custom className seed capability (8699842b497be789f9d66553dbd63d56b9af3d7c)
271
-
272
- ---
273
-
package/eslint.config.js DELETED
@@ -1,3 +0,0 @@
1
- import { standalone } from 'eslint-config-react-yas';
2
-
3
- export default [...standalone];
package/setup.sh DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
-
3
- mise x -- bun install
4
- mise x -- bun husky init
@@ -1,251 +0,0 @@
1
- import { Properties } from 'csstype';
2
- import merge from 'deepmerge';
3
-
4
- import { generateClassName } from './generateClassName.js';
5
- import { getPosthooks } from './plugins.js';
6
- import { SimpleStyleRules } from './types.js';
7
-
8
- export type CreateStylesOptions = Partial<{
9
- /**
10
- * If true, automatically renders generated styles
11
- * to the DOM in an injected <style /> tag
12
- */
13
- flush: boolean;
14
-
15
- /**
16
- * If set, along with flush: true,
17
- * will render the injected <style /> after this element
18
- */
19
- insertAfter?: HTMLElement;
20
- /**
21
- * If set, along with flush: true,
22
- * will render the injects <style /> before this element
23
- */
24
- insertBefore?: HTMLElement;
25
- }>;
26
-
27
- function isNestedSelector(r: string): boolean {
28
- return /&/g.test(r);
29
- }
30
-
31
- function isMedia(r: string): boolean {
32
- return r.toLowerCase().startsWith('@media');
33
- }
34
-
35
- function formatCSSRuleName(rule: string): string {
36
- return rule.replaceAll(/([A-Z])/g, p1 => `-${p1.toLowerCase()}`);
37
- }
38
-
39
- function formatCSSRules(cssRules: Properties): string {
40
- return Object.entries(cssRules).reduce(
41
- (prev, [cssProp, cssVal]) => `${prev}${formatCSSRuleName(cssProp)}:${String(cssVal)};`,
42
- '',
43
- );
44
- }
45
-
46
- function execCreateStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(
47
- rules: T,
48
- options: CreateStylesOptions,
49
- parentSelector: string | null,
50
- noGenerateClassName = false,
51
- ): { classes: O; sheetBuffer: string; mediaQueriesBuffer: string } {
52
- const out = {} as O;
53
- let sheetBuffer = '';
54
- let mediaQueriesBuffer = '';
55
- const styleEntries = Object.entries(rules);
56
- let ruleWriteOpen = false;
57
- const guardCloseRuleWrite = () => {
58
- if (ruleWriteOpen) sheetBuffer += '}';
59
- ruleWriteOpen = false;
60
- };
61
- for (const [classNameOrCSSRule, classNameRules] of styleEntries) {
62
- // if the classNameRules is a string, we are dealing with a display: none; type rule
63
- if (isMedia(classNameOrCSSRule)) {
64
- if (typeof classNameRules !== 'object')
65
- throw new Error('Unable to map @media query because rules / props are an invalid type');
66
- guardCloseRuleWrite();
67
- mediaQueriesBuffer += `${classNameOrCSSRule}{`;
68
- const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(
69
- classNameRules as T,
70
- options,
71
- parentSelector,
72
- );
73
- mediaQueriesBuffer += regularOutput;
74
- mediaQueriesBuffer += '}';
75
- mediaQueriesBuffer += mediaQueriesOutput;
76
- } else if (isNestedSelector(classNameOrCSSRule)) {
77
- if (!parentSelector) throw new Error('Unable to generate nested rule because parentSelector is missing');
78
- guardCloseRuleWrite();
79
- // format of { '& > span': { display: 'none' } } (or further nesting)
80
- const replaced = classNameOrCSSRule.replaceAll('&', parentSelector);
81
- for (const selector of replaced.split(/,\s*/)) {
82
- const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(
83
- classNameRules as T,
84
- options,
85
- selector,
86
- );
87
- sheetBuffer += regularOutput;
88
- mediaQueriesBuffer += mediaQueriesOutput;
89
- }
90
- } else if (!parentSelector && typeof classNameRules === 'object') {
91
- guardCloseRuleWrite();
92
- const generated = noGenerateClassName ? classNameOrCSSRule : generateClassName(classNameOrCSSRule);
93
- // @ts-expect-error - yes, we can index this object here, so be quiet
94
- out[classNameOrCSSRule] = generated;
95
- const generatedSelector = `${noGenerateClassName ? '' : '.'}${generated}`;
96
- const { mediaQueriesBuffer: mediaQueriesOutput, sheetBuffer: regularOutput } = execCreateStyles(
97
- classNameRules as T,
98
- options,
99
- generatedSelector,
100
- );
101
- sheetBuffer += regularOutput;
102
- mediaQueriesBuffer += mediaQueriesOutput;
103
- } else {
104
- if (!parentSelector) throw new Error('Unable to write css props because parent selector is null');
105
- if (ruleWriteOpen) {
106
- sheetBuffer += formatCSSRules({ [classNameOrCSSRule]: classNameRules });
107
- } else {
108
- sheetBuffer += `${parentSelector}{${formatCSSRules({ [classNameOrCSSRule]: classNameRules })}`;
109
- ruleWriteOpen = true;
110
- }
111
- }
112
- }
113
- guardCloseRuleWrite();
114
- return {
115
- classes: out,
116
- sheetBuffer,
117
- mediaQueriesBuffer,
118
- };
119
- }
120
-
121
- function replaceBackReferences<O extends Record<string, string>>(out: O, sheetContents: string): string {
122
- let outputSheetContents = sheetContents;
123
- const toReplace: string[] = [];
124
- const toReplaceRegex = /\$\w([a-zA-Z0-9_-]+)?/gm;
125
- let matches = toReplaceRegex.exec(outputSheetContents);
126
- while (matches) {
127
- toReplace.push(matches[0].valueOf());
128
- matches = toReplaceRegex.exec(outputSheetContents);
129
- }
130
- for (const r of toReplace) {
131
- outputSheetContents = outputSheetContents.replace(r, `.${out[r.slice(1)] ?? ''}`);
132
- }
133
- return getPosthooks().reduce((prev, hook) => hook(prev), outputSheetContents);
134
- }
135
-
136
- function createSheet(sheetContents: string) {
137
- const doc = globalThis.document as Partial<typeof globalThis.document> | null | undefined;
138
- if (doc === undefined) return null;
139
- // eslint-disable-next-line @typescript-eslint/no-deprecated
140
- if (typeof doc?.head?.appendChild !== 'function' || typeof doc.createElement !== 'function') return null;
141
- const styleTag = doc.createElement('style');
142
- styleTag.innerHTML = sheetContents;
143
- return styleTag;
144
- }
145
-
146
- function flushSheetContents(sheetContents: string, options?: CreateStylesOptions) {
147
- // In case we're in come weird test environment that doesn't support JSDom
148
- const styleTag = createSheet(sheetContents);
149
- if (styleTag) {
150
- if (options?.insertAfter && options.insertBefore) {
151
- throw new Error('Both insertAfter and insertBefore were provided. Please choose only one.');
152
- }
153
- if (options?.insertAfter?.after) options.insertAfter.after(styleTag as Node);
154
- else if (options?.insertBefore?.before) options.insertBefore.before(styleTag as Node);
155
- else document.head.append(styleTag);
156
- }
157
- return styleTag;
158
- }
159
-
160
- function coerceCreateStylesOptions(options?: CreateStylesOptions): CreateStylesOptions {
161
- return {
162
- flush: options && typeof options.flush === 'boolean' ? options.flush : true,
163
- };
164
- }
165
-
166
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
167
- export function rawStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(
168
- rules: T,
169
- options?: Partial<CreateStylesOptions>,
170
- ) {
171
- const coerced = coerceCreateStylesOptions(options);
172
- const { sheetBuffer: sheetContents, mediaQueriesBuffer: mediaQueriesContents } = execCreateStyles(
173
- rules,
174
- coerced,
175
- null,
176
- true,
177
- );
178
-
179
- const mergedContents = `${sheetContents}${mediaQueriesContents}`;
180
-
181
- if (coerced.flush) flushSheetContents(mergedContents, options);
182
- return mergedContents;
183
- }
184
-
185
- export function keyframes<T extends Record<string, Properties>>(
186
- frames: T,
187
- options?: CreateStylesOptions,
188
- ): [string, string] {
189
- const coerced = coerceCreateStylesOptions(options);
190
- const keyframeName = generateClassName('keyframes_');
191
- const { sheetBuffer: keyframesContents } = execCreateStyles(frames, coerced, null, true);
192
- const sheetContents = `@keyframes ${keyframeName}{${keyframesContents}}`;
193
- if (coerced.flush) flushSheetContents(sheetContents);
194
- return [keyframeName, sheetContents];
195
- }
196
-
197
- export default function createStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(
198
- rules: T,
199
- options?: Partial<CreateStylesOptions>,
200
- ) {
201
- const coerced = coerceCreateStylesOptions(options);
202
- const {
203
- classes: out,
204
- sheetBuffer: sheetContents,
205
- mediaQueriesBuffer: mediaQueriesContents,
206
- } = execCreateStyles(rules, coerced, null);
207
-
208
- const mergedContents = `${sheetContents}${mediaQueriesContents}`;
209
-
210
- const replacedSheetContents = replaceBackReferences(out, mergedContents);
211
-
212
- let sheet: ReturnType<typeof flushSheetContents> = null;
213
-
214
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
215
- const updateSheet = <T2 extends SimpleStyleRules, K2 extends keyof T2, O2 extends Record<K2, string>>(
216
- updatedRules: Partial<T2>,
217
- ) => {
218
- if ((options?.flush && sheet) || !options?.flush) {
219
- // We prefer the first set, and then we shallow merge
220
- const {
221
- classes: updatedOut,
222
- sheetBuffer: updatedSheetContents,
223
- mediaQueriesBuffer: updatedMediaQueriesContents,
224
- } = execCreateStyles(merge(rules, updatedRules), { flush: false }, null);
225
-
226
- const updatedMergedContents = `${updatedSheetContents}${updatedMediaQueriesContents}`;
227
-
228
- const updatedReplacedSheetContents = replaceBackReferences(out, updatedMergedContents);
229
- if (sheet) sheet.innerHTML = updatedReplacedSheetContents;
230
- return { classes: updatedOut, stylesheet: updatedSheetContents } as {
231
- classes: typeof updatedOut;
232
- stylesheet: string;
233
- };
234
- }
235
- return null;
236
- };
237
-
238
- if (coerced.flush) sheet = flushSheetContents(replacedSheetContents, options);
239
- // Need this TS cast to get solid code assist from the consumption-side
240
- return {
241
- classes: out as unknown,
242
- stylesheet: replacedSheetContents,
243
- updateSheet,
244
- } as {
245
- classes: O;
246
- stylesheet: string;
247
- updateSheet: typeof updateSheet;
248
- };
249
- }
250
-
251
- export type CreateStylesArgs = Parameters<typeof createStyles>;
@@ -1,43 +0,0 @@
1
- import numToAlpha from './numToAlpha.js';
2
-
3
- let inc = Date.now();
4
-
5
- export function setSeed(seed: number | null): void {
6
- if (seed === null) {
7
- inc = Date.now();
8
- return;
9
- }
10
- if (typeof seed !== 'number') throw new Error('Unable to setSeed as provided seed was not a valid number');
11
- if (seed === Number.MAX_SAFE_INTEGER)
12
- throw new Error('Unable to setSeed because the seed was already the maximum safe JavaScript number allowed');
13
- if (seed === Number.POSITIVE_INFINITY || seed === Number.NEGATIVE_INFINITY)
14
- throw new Error('Unable to setSeed. Positive or negative infinity is not allowed');
15
- if (seed < 0) throw new Error('Unable to setSeed. Seed must be a number >= 0');
16
- inc = seed;
17
- }
18
-
19
- const numPairsRegex = /(\d{1,2})/g;
20
-
21
- export function getUniqueSuffix(): string {
22
- const numPairs: string[] = [];
23
- const incStr = inc.toString();
24
- let result = numPairsRegex.exec(incStr);
25
- while (result) {
26
- numPairs.push(result[0]);
27
- result = numPairsRegex.exec(incStr);
28
- }
29
- let out = '_';
30
- for (const pair of numPairs) {
31
- const val = +pair;
32
- if (val > 25) {
33
- const [first, second] = pair.split('');
34
- out += `${numToAlpha(Number(first))}${numToAlpha(Number(second))}`;
35
- } else out += numToAlpha(val);
36
- }
37
- inc += 1;
38
- return out;
39
- }
40
-
41
- export function generateClassName(c: string): string {
42
- return `${c}${getUniqueSuffix()}`;
43
- }
package/src/numToAlpha.ts DELETED
@@ -1,5 +0,0 @@
1
- const alphas = 'abcdefghijklmnopqrstuvwxyz'.split('');
2
-
3
- export default function numToAlpha(num: number): string {
4
- return String(alphas[num]);
5
- }
package/src/plugins.ts DELETED
@@ -1,11 +0,0 @@
1
- export type PosthookPlugin = (sheetContents: string) => string;
2
-
3
- const posthooks: PosthookPlugin[] = [];
4
-
5
- export function getPosthooks(): PosthookPlugin[] {
6
- return posthooks;
7
- }
8
-
9
- export function registerPosthook(posthook: PosthookPlugin) {
10
- posthooks.push(posthook);
11
- }
@@ -1,58 +0,0 @@
1
- import { useEffect, useMemo, useRef, useState } from 'react';
2
-
3
- import createStyles, { CreateStylesOptions } from '../createStyles.js';
4
- import { SimpleStyleRules } from '../types.js';
5
- import { deepEqual } from '../util/index.js';
6
-
7
- export function useCreateStyles<T extends SimpleStyleRules, K extends keyof T, O extends Record<K, string>>(
8
- rules: T,
9
- options?: Partial<Omit<CreateStylesOptions, 'flush'>>,
10
- ) {
11
- // cache rules to compare later
12
- const [cachedRules, setCachedRules] = useState(() => rules);
13
-
14
- // memoize options but keep them live
15
- const cachedOptions = useMemo(() => ({ ...options }) as Partial<Omit<CreateStylesOptions, 'flush'>>, [options]);
16
-
17
- const didFirstWriteRef = useRef(false);
18
- const styleTagRef = useRef(typeof document === 'undefined' ? null : document.createElement('style'));
19
-
20
- // initialize styles
21
- const [styleState, setStyleState] = useState(() => createStyles<T, K, O>(rules, { ...cachedOptions, flush: false }));
22
-
23
- const { classes, stylesheet, updateSheet } = styleState;
24
-
25
- // mount/unmount style tag
26
- useEffect(() => {
27
- if (!styleTagRef.current) return;
28
- const { current: s } = styleTagRef;
29
- document.head.append(s);
30
- return () => {
31
- s.remove();
32
- };
33
- }, []);
34
-
35
- // update stylesheet when rules change
36
- useEffect(() => {
37
- if (!styleTagRef.current) return;
38
-
39
- if (!didFirstWriteRef.current) {
40
- didFirstWriteRef.current = true;
41
- styleTagRef.current.innerHTML = stylesheet;
42
- return;
43
- }
44
-
45
- if (!deepEqual(rules, cachedRules)) {
46
- setCachedRules(rules);
47
- const updated = updateSheet(rules);
48
- if (updated) {
49
- styleTagRef.current.innerHTML = updated.stylesheet;
50
- // use the fresh updateSheet from updated
51
- // @ts-expect-error - this cast is safe and is only for us, internally, anyways
52
- setStyleState({ ...updated, updateSheet });
53
- }
54
- }
55
- }, [cachedRules, rules, stylesheet, updateSheet]); // only depend on rules + updater
56
-
57
- return classes;
58
- }