react-native-web-tailwind-compat 1.1.0 → 1.1.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.
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
const require_utils = require('./utils.cjs');
|
|
4
2
|
|
|
5
3
|
//#region src/createCSSStyleSheet.ts
|
|
6
4
|
let proxy = null;
|
|
7
5
|
function createCSSStyleSheet(id, rootNode, textContent) {
|
|
8
|
-
console.log("Hit da proxy");
|
|
9
6
|
return proxy ??= buildRNWProxy(textContent);
|
|
10
7
|
}
|
|
11
8
|
function buildRNWProxy(initialTextContent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCSSStyleSheet.d.cts","names":[],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"createCSSStyleSheet.d.cts","names":[],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":[],"mappings":";iBAIgB,mBAAA,oDAIb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCSSStyleSheet.d.mts","names":[],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"createCSSStyleSheet.d.mts","names":[],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":[],"mappings":";iBAIgB,mBAAA,oDAIb"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import { NEW_SHEET_ID, layerBoundaryRegex } from "./utils.mjs";
|
|
4
2
|
|
|
5
3
|
//#region src/createCSSStyleSheet.ts
|
|
6
4
|
let proxy = null;
|
|
7
5
|
function createCSSStyleSheet(id, rootNode, textContent) {
|
|
8
|
-
console.log("Hit da proxy");
|
|
9
6
|
return proxy ??= buildRNWProxy(textContent);
|
|
10
7
|
}
|
|
11
8
|
function buildRNWProxy(initialTextContent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCSSStyleSheet.mjs","names":["proxy: CSSStyleSheet | null"],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"createCSSStyleSheet.mjs","names":["proxy: CSSStyleSheet | null"],"sources":["../src/createCSSStyleSheet.ts"],"sourcesContent":["import { layerBoundaryRegex, NEW_SHEET_ID } from \"./utils\";\n\nlet proxy: CSSStyleSheet | null = null;\n\nexport function createCSSStyleSheet(\n id: string,\n rootNode?: any,\n textContent?: string,\n): CSSStyleSheet | null {\n return (proxy ??= buildRNWProxy(textContent));\n}\n\nfunction buildRNWProxy(initialTextContent?: string) {\n if (typeof window === \"undefined\") {\n return null;\n }\n const flattenedSheet = new CSSStyleSheet();\n if (initialTextContent) {\n flattenedSheet.replaceSync(initialTextContent);\n }\n let layeredSheet = (document.getElementById(NEW_SHEET_ID) as HTMLStyleElement)\n ?.sheet;\n\n if (!layeredSheet) {\n const styleElem = document.createElement(\"style\");\n styleElem.id = NEW_SHEET_ID;\n document.head.prepend(styleElem);\n layeredSheet = styleElem.sheet;\n }\n if (!layeredSheet) return flattenedSheet;\n // ensure that the first rule in the layered sheet is a layer\n if (!(layeredSheet.cssRules[0] instanceof CSSLayerBlockRule)) {\n layeredSheet.insertRule(\"@layer rnw {}\", 0);\n }\n // Traverse the layered sheet to build the flattened sheet\n flattenRules(layeredSheet.cssRules, flattenedSheet);\n\n return new Proxy(flattenedSheet, {\n get(target, prop) {\n if (prop === \"insertRule\") {\n return function insertRule(text: string, index: number) {\n flattenedSheet.insertRule(text, index);\n // find the index of the groups\n const cutoffIndex = [...flattenedSheet.cssRules].findIndex((rule) =>\n layerBoundaryRegex.exec(rule.cssText),\n );\n if (cutoffIndex === -1 || index <= cutoffIndex) {\n // insert into the layer\n const layerRule = layeredSheet.cssRules[0] as CSSLayerBlockRule;\n layerRule.insertRule(text, layerRule.cssRules.length);\n } else {\n // insert into the sheet normally\n layeredSheet.insertRule(text, layeredSheet.cssRules.length);\n }\n };\n }\n const value = (target as any)[prop];\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\nfunction flattenRules(\n rules: CSSRuleList | CSSRule[],\n targetSheet: CSSStyleSheet,\n) {\n for (const rule of rules) {\n if (rule instanceof CSSLayerBlockRule) {\n flattenRules(rule.cssRules, targetSheet);\n } else {\n targetSheet.insertRule(rule.cssText, targetSheet.cssRules.length);\n }\n }\n}\n"],"mappings":";;;AAEA,IAAIA,QAA8B;AAElC,SAAgB,oBACd,IACA,UACA,aACsB;AACtB,QAAQ,UAAU,cAAc,YAAY;;AAG9C,SAAS,cAAc,oBAA6B;AAClD,KAAI,OAAO,WAAW,YACpB,QAAO;CAET,MAAM,iBAAiB,IAAI,eAAe;AAC1C,KAAI,mBACF,gBAAe,YAAY,mBAAmB;CAEhD,IAAI,eAAgB,SAAS,eAAe,aAAa,EACrD;AAEJ,KAAI,CAAC,cAAc;EACjB,MAAM,YAAY,SAAS,cAAc,QAAQ;AACjD,YAAU,KAAK;AACf,WAAS,KAAK,QAAQ,UAAU;AAChC,iBAAe,UAAU;;AAE3B,KAAI,CAAC,aAAc,QAAO;AAE1B,KAAI,EAAE,aAAa,SAAS,cAAc,mBACxC,cAAa,WAAW,iBAAiB,EAAE;AAG7C,cAAa,aAAa,UAAU,eAAe;AAEnD,QAAO,IAAI,MAAM,gBAAgB,EAC/B,IAAI,QAAQ,MAAM;AAChB,MAAI,SAAS,aACX,QAAO,SAAS,WAAW,MAAc,OAAe;AACtD,kBAAe,WAAW,MAAM,MAAM;GAEtC,MAAM,cAAc,CAAC,GAAG,eAAe,SAAS,CAAC,WAAW,SAC1D,mBAAmB,KAAK,KAAK,QAAQ,CACtC;AACD,OAAI,gBAAgB,MAAM,SAAS,aAAa;IAE9C,MAAM,YAAY,aAAa,SAAS;AACxC,cAAU,WAAW,MAAM,UAAU,SAAS,OAAO;SAGrD,cAAa,WAAW,MAAM,aAAa,SAAS,OAAO;;EAIjE,MAAM,QAAS,OAAe;AAC9B,SAAO,OAAO,UAAU,aAAa,MAAM,KAAK,OAAO,GAAG;IAE7D,CAAC;;AAGJ,SAAS,aACP,OACA,aACA;AACA,MAAK,MAAM,QAAQ,MACjB,KAAI,gBAAgB,kBAClB,cAAa,KAAK,UAAU,YAAY;KAExC,aAAY,WAAW,KAAK,SAAS,YAAY,SAAS,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-web-tailwind-compat",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"author": "Alexander Nicholson",
|
|
5
5
|
"description": "Adds CSS layers to react native web styles, allowing it to be used with TailwindCSS v4",
|
|
6
6
|
"homepage": "https://github.com/a16n-dev/uniwind-plugin-next#readme",
|