Skip to content

Commit 08ecd55

Browse files
committed
update for cdn
1 parent 9814496 commit 08ecd55

File tree

8 files changed

+211
-27
lines changed

8 files changed

+211
-27
lines changed

coverage/coverage-summary.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{"total": {"lines":{"total":128,"covered":7,"skipped":0,"pct":5.46},"statements":{"total":128,"covered":7,"skipped":0,"pct":5.46},"functions":{"total":3,"covered":1,"skipped":0,"pct":33.33},"branches":{"total":4,"covered":2,"skipped":0,"pct":50},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
2-
,"C:\\www\\dev-npm\\tailwindcss-text-shadow\\release.config.cjs": {"lines":{"total":14,"covered":0,"skipped":0,"pct":0},"functions":{"total":1,"covered":0,"skipped":0,"pct":0},"statements":{"total":14,"covered":0,"skipped":0,"pct":0},"branches":{"total":1,"covered":0,"skipped":0,"pct":0}}
3-
,"C:\\www\\dev-npm\\tailwindcss-text-shadow\\src\\generateShadows.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":7,"covered":7,"skipped":0,"pct":100},"branches":{"total":2,"covered":2,"skipped":0,"pct":100}}
4-
,"C:\\www\\dev-npm\\tailwindcss-text-shadow\\src\\index.ts": {"lines":{"total":107,"covered":0,"skipped":0,"pct":0},"functions":{"total":1,"covered":0,"skipped":0,"pct":0},"statements":{"total":107,"covered":0,"skipped":0,"pct":0},"branches":{"total":1,"covered":0,"skipped":0,"pct":0}}
1+
{"total": {"lines":{"total":127,"covered":7,"skipped":0,"pct":5.51},"statements":{"total":127,"covered":7,"skipped":0,"pct":5.51},"functions":{"total":3,"covered":1,"skipped":0,"pct":33.33},"branches":{"total":4,"covered":2,"skipped":0,"pct":50},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
2+
,"C:\\www\\tailwindcss-plugins\\packages\\tailwindcss-text-shadow\\release.config.cjs": {"lines":{"total":14,"covered":0,"skipped":0,"pct":0},"functions":{"total":1,"covered":0,"skipped":0,"pct":0},"statements":{"total":14,"covered":0,"skipped":0,"pct":0},"branches":{"total":1,"covered":0,"skipped":0,"pct":0}}
3+
,"C:\\www\\tailwindcss-plugins\\packages\\tailwindcss-text-shadow\\src\\generateShadows.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":7,"covered":7,"skipped":0,"pct":100},"branches":{"total":2,"covered":2,"skipped":0,"pct":100}}
4+
,"C:\\www\\tailwindcss-plugins\\packages\\tailwindcss-text-shadow\\src\\index.ts": {"lines":{"total":106,"covered":0,"skipped":0,"pct":0},"functions":{"total":1,"covered":0,"skipped":0,"pct":0},"statements":{"total":106,"covered":0,"skipped":0,"pct":0},"branches":{"total":1,"covered":0,"skipped":0,"pct":0}}
55
}

dist/index.cjs

+1-1
Large diffs are not rendered by default.

dist/index.js

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
var __getOwnPropNames = Object.getOwnPropertyNames;
2+
var __commonJS = (cb, mod) => function __require() {
3+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4+
};
5+
import { comment } from "postcss";
6+
var require_index = __commonJS({
7+
"index.js"(exports, module) {
8+
function generateShadows(steps = 1) {
9+
const classes = [];
10+
for (let x = 0; x < steps; x++) {
11+
classes.push(`calc(var(--ts-text-shadow-x) * ${x}) calc(var(--ts-text-shadow-y) * ${x}) var(--ts-text-shadow-blur) var(--ts-text-shadow-color)`);
12+
}
13+
return classes.toString();
14+
}
15+
const version = "2.1.6";
16+
function getDefaultExportFromCjs(x) {
17+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
18+
}
19+
var createPlugin$2 = {};
20+
var createPlugin$1 = {};
21+
(function(exports2) {
22+
Object.defineProperty(exports2, "__esModule", {
23+
value: true
24+
});
25+
Object.defineProperty(exports2, "default", {
26+
enumerable: true,
27+
get: function() {
28+
return _default;
29+
}
30+
});
31+
function createPlugin2(plugin2, config) {
32+
return {
33+
handler: plugin2,
34+
config
35+
};
36+
}
37+
createPlugin2.withOptions = function(pluginFunction, configFunction = () => ({})) {
38+
const optionsFunction = function(options) {
39+
return {
40+
__options: options,
41+
handler: pluginFunction(options),
42+
config: configFunction(options)
43+
};
44+
};
45+
optionsFunction.__isOptionsFunction = true;
46+
optionsFunction.__pluginFunction = pluginFunction;
47+
optionsFunction.__configFunction = configFunction;
48+
return optionsFunction;
49+
};
50+
const _default = createPlugin2;
51+
})(createPlugin$1);
52+
(function(exports2) {
53+
Object.defineProperty(exports2, "__esModule", {
54+
value: true
55+
});
56+
Object.defineProperty(exports2, "default", {
57+
enumerable: true,
58+
get: function() {
59+
return _default;
60+
}
61+
});
62+
const _createPlugin = /* @__PURE__ */ _interop_require_default(createPlugin$1);
63+
function _interop_require_default(obj) {
64+
return obj && obj.__esModule ? obj : {
65+
default: obj
66+
};
67+
}
68+
const _default = _createPlugin.default;
69+
})(createPlugin$2);
70+
let createPlugin = createPlugin$2;
71+
var plugin = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default;
72+
const plugin$1 = /* @__PURE__ */ getDefaultExportFromCjs(plugin);
73+
const { default: flattenColorPalette } = require("tailwindcss/lib/util/flattenColorPalette");
74+
module.exports = plugin$1.withOptions(
75+
function(options = {}) {
76+
const prefix = options.prefix || "text-shadow";
77+
return function({ addBase, addComponents, matchUtilities, matchComponents, theme }) {
78+
addBase([
79+
comment({
80+
text: `! tailwindcss-text-shadow v${version} | MIT License | https://designbycode.co.za`
81+
})
82+
]);
83+
addBase({
84+
":root": {
85+
"--ts-text-shadow-color": options.shadowColor || "rgba(0, 0,0,0.45)",
86+
"--ts-text-shadow-x": options.shadowOffsetX || "1px",
87+
"--ts-text-shadow-y": options.shadowOffsetY || "1px",
88+
"--ts-text-shadow-blur": options.shadowBlur || "2px"
89+
}
90+
});
91+
addComponents({
92+
[`.${prefix}`]: {
93+
textShadow: `var(--ts-text-shadow-x) var(--ts-text-shadow-y) var(--ts-text-shadow-blur) var(--ts-text-shadow-color)`
94+
}
95+
});
96+
matchUtilities(
97+
{
98+
[`${prefix}-x`]: (value) => ({
99+
"--ts-text-shadow-x": value
100+
}),
101+
[`${prefix}-y`]: (value) => ({
102+
"--ts-text-shadow-y": value
103+
}),
104+
[`${prefix}-blur`]: (value) => ({
105+
"--ts-text-shadow-blur": value
106+
})
107+
},
108+
{
109+
values: theme("textShadowSteps"),
110+
type: "length",
111+
supportsNegativeValues: true
112+
}
113+
);
114+
matchUtilities(
115+
{
116+
[`${prefix}`]: (value) => ({
117+
"--ts-text-shadow-color": value
118+
})
119+
},
120+
{
121+
values: flattenColorPalette(theme("colors")),
122+
type: "color"
123+
}
124+
);
125+
addComponents({
126+
[`.${prefix}-sm`]: {
127+
textShadow: generateShadows(theme("textShadowSteps")[0])
128+
}
129+
});
130+
matchComponents(
131+
{
132+
[`${prefix}`]: (value) => ({
133+
textShadow: generateShadows(value)
134+
})
135+
},
136+
{
137+
type: "number",
138+
values: theme("textShadowLong")
139+
}
140+
);
141+
};
142+
},
143+
function() {
144+
return {
145+
theme: {
146+
experimental: false,
147+
textShadowLong: {
148+
sm: 4,
149+
md: 8,
150+
lg: 12,
151+
xl: 16
152+
},
153+
textShadowSteps: {
154+
xs: "1px",
155+
sm: "2px",
156+
md: "3px",
157+
lg: "4px",
158+
xl: "5px",
159+
0: "0",
160+
1: "1px",
161+
2: "2px",
162+
3: "3px",
163+
4: "4px",
164+
5: "5px",
165+
6: "6px",
166+
7: "7px",
167+
8: "8px",
168+
9: "9px",
169+
10: "10px"
170+
}
171+
}
172+
};
173+
}
174+
);
175+
}
176+
});
177+
export default require_index();

dist/index.umd.cjs

+1-1
Large diffs are not rendered by default.

src/generateShadows.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export default function generateShadows(steps: number = 1) {
2-
let classes = []
1+
export default function generateShadows(steps: number = 1): string {
2+
const classes: string[] = []
33
for (let x = 0; x < steps; x++) {
44
classes.push(`calc(var(--ts-text-shadow-x) * ${x}) calc(var(--ts-text-shadow-y) * ${x}) var(--ts-text-shadow-blur) var(--ts-text-shadow-color)`)
55
}
66
return classes.toString()
7-
}
7+
}

src/types.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
declare module 'tailwindcss/plugin' {
2+
const plugin: any
3+
export default plugin
4+
}
5+
6+
declare module 'tailwindcss/lib/util/flattenColorPalette' {
7+
const flattenColorPalette: any
8+
export default flattenColorPalette
9+
}

tsconfig.json

+6-17
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,21 @@
33
"target": "ES2020",
44
"useDefineForClassFields": true,
55
"module": "ESNext",
6-
"lib": [
7-
"ES2020",
8-
"DOM",
9-
"DOM.Iterable"
10-
],
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
117
"skipLibCheck": true,
12-
/* Bundler mode */
138
"moduleResolution": "bundler",
149
"allowImportingTsExtensions": true,
1510
"resolveJsonModule": true,
1611
"isolatedModules": true,
1712
"noEmit": true,
18-
/* Linting */
1913
"strict": true,
2014
"noUnusedLocals": true,
2115
"noUnusedParameters": true,
2216
"noFallthroughCasesInSwitch": true,
23-
"removeComments": true,
24-
"sourceMap": true,
25-
/* declaration */
26-
// "outDir": "./dist",
27-
// "declaration": true,
28-
// "rootDir": "./src",
29-
// "declarationMap": true
30-
17+
"declaration": true,
18+
"declarationDir": "./dist",
19+
"outDir": "./dist"
3120
},
32-
"include": ["src/**/*"],
21+
"include": ["src"],
3322
"exclude": ["node_modules"]
34-
}
23+
}

vite.config.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@ export default defineConfig({
1616
name: "Tailwindcss Text Shadow",
1717
// the proper extensions will be added
1818
fileName: "index",
19-
formats: ["cjs", "umd"],
19+
formats: ["es", "cjs", "umd"],
2020
},
2121
minify: "terser",
22+
rollupOptions: {
23+
external: ["tailwindcss", "postcss"],
24+
output: {
25+
globals: {
26+
tailwindcss: "tailwindcss",
27+
postcss: "postcss"
28+
}
29+
}
30+
}
2231
},
2332
plugins: [dts()],
2433
})

0 commit comments

Comments
 (0)