UNPKG

weapp-tailwindcss

Version:

把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!

44 lines (36 loc) 1.14 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/css-macro/constants.ts var queryKey = "weapp-tw-platform"; function createMediaQuery(value) { return `@media (${queryKey}:"${value}"){&}`; } function createNegativeMediaQuery(value) { return `@media not screen and (${queryKey}:"${value}"){&}`; } function normalComment(text) { if (typeof text === "string") { return text.replaceAll(/(?<!\\)_/g, " "); } return text; } function ifdef(text) { return { start: `#ifdef ${normalComment(text)}`, end: `#endif` }; } function ifndef(text) { return { start: `#ifndef ${normalComment(text)}`, end: `#endif` }; } function matchCustomPropertyFromValue(str, cb) { let arr; let index = 0; const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g"); while ((arr = regex.exec(str)) !== null) { cb(arr, index); index++; } } exports.createMediaQuery = createMediaQuery; exports.createNegativeMediaQuery = createNegativeMediaQuery; exports.ifdef = ifdef; exports.ifndef = ifndef; exports.matchCustomPropertyFromValue = matchCustomPropertyFromValue;