typewritingclass 0.2.6 → 0.2.7

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.
package/dist/index.cjs CHANGED
@@ -126,6 +126,7 @@ function cx(...args) {
126
126
  }
127
127
  return args.map((arg) => {
128
128
  if (typeof arg === "string") return arg;
129
+ if (typeof arg === "function") return String(arg);
129
130
  const layerNum = _nullishCoalesce(arg._layer, () => ( nextLayer()));
130
131
  const className = generateHash(arg, layerNum);
131
132
  _chunkM34ZK4IVcjs.register.call(void 0, className, arg, layerNum);
@@ -136,7 +137,7 @@ function warnConflicts(args) {
136
137
  const seen = /* @__PURE__ */ new Map();
137
138
  for (let i = 0; i < args.length; i++) {
138
139
  const arg = args[i];
139
- if (typeof arg === "string") continue;
140
+ if (typeof arg === "string" || typeof arg === "function") continue;
140
141
  for (const prop of Object.keys(arg.declarations)) {
141
142
  if (seen.has(prop)) {
142
143
  console.warn(
@@ -157,6 +158,10 @@ function dcx(...args) {
157
158
  classNames.push(arg);
158
159
  continue;
159
160
  }
161
+ if (typeof arg === "function") {
162
+ classNames.push(String(arg));
163
+ continue;
164
+ }
160
165
  const layerNum = _nullishCoalesce(arg._layer, () => ( nextLayer()));
161
166
  const className = generateHash(arg, layerNum);
162
167
  _chunkM34ZK4IVcjs.register.call(void 0, className, arg, layerNum);
@@ -2427,7 +2432,7 @@ function createChain(rules, pendingMods) {
2427
2432
  get(_target, prop) {
2428
2433
  if (prop === TW_BRAND) return true;
2429
2434
  if (prop === "_rules") return rules;
2430
- if (prop === Symbol.toPrimitive || prop === "toString" || prop === "valueOf") {
2435
+ if (prop === Symbol.toPrimitive || prop === "toString" || prop === "valueOf" || prop === "toJSON") {
2431
2436
  return () => cx(...rules);
2432
2437
  }
2433
2438
  if (prop === Symbol.toStringTag) return "TwChain";
package/dist/index.js CHANGED
@@ -126,6 +126,7 @@ function cx(...args) {
126
126
  }
127
127
  return args.map((arg) => {
128
128
  if (typeof arg === "string") return arg;
129
+ if (typeof arg === "function") return String(arg);
129
130
  const layerNum = arg._layer ?? nextLayer();
130
131
  const className = generateHash(arg, layerNum);
131
132
  register(className, arg, layerNum);
@@ -136,7 +137,7 @@ function warnConflicts(args) {
136
137
  const seen = /* @__PURE__ */ new Map();
137
138
  for (let i = 0; i < args.length; i++) {
138
139
  const arg = args[i];
139
- if (typeof arg === "string") continue;
140
+ if (typeof arg === "string" || typeof arg === "function") continue;
140
141
  for (const prop of Object.keys(arg.declarations)) {
141
142
  if (seen.has(prop)) {
142
143
  console.warn(
@@ -157,6 +158,10 @@ function dcx(...args) {
157
158
  classNames.push(arg);
158
159
  continue;
159
160
  }
161
+ if (typeof arg === "function") {
162
+ classNames.push(String(arg));
163
+ continue;
164
+ }
160
165
  const layerNum = arg._layer ?? nextLayer();
161
166
  const className = generateHash(arg, layerNum);
162
167
  register(className, arg, layerNum);
@@ -2427,7 +2432,7 @@ function createChain(rules, pendingMods) {
2427
2432
  get(_target, prop) {
2428
2433
  if (prop === TW_BRAND) return true;
2429
2434
  if (prop === "_rules") return rules;
2430
- if (prop === Symbol.toPrimitive || prop === "toString" || prop === "valueOf") {
2435
+ if (prop === Symbol.toPrimitive || prop === "toString" || prop === "valueOf" || prop === "toJSON") {
2431
2436
  return () => cx(...rules);
2432
2437
  }
2433
2438
  if (prop === Symbol.toStringTag) return "TwChain";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typewritingclass",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",