vite-plugin-capsize-radix 0.0.4 → 0.0.5
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.js +61 -30
- package/dist/{index.cjs → index.mjs} +30 -61
- package/package.json +4 -5
- /package/dist/{index.d.cts → index.d.mts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,16 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
1
30
|
// src/index.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
capsizeRadixPlugin: () => capsizeRadixPlugin
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_core = require("@capsizecss/core");
|
|
38
|
+
var import_mustache = __toESM(require("mustache"));
|
|
39
|
+
var import_segoeUI = __toESM(require("@capsizecss/metrics/segoeUI"));
|
|
40
|
+
var import_appleSystem = __toESM(require("@capsizecss/metrics/appleSystem"));
|
|
41
|
+
var import_roboto = __toESM(require("@capsizecss/metrics/roboto"));
|
|
42
|
+
var import_ubuntu = __toESM(require("@capsizecss/metrics/ubuntu"));
|
|
43
|
+
var import_notoSans = __toESM(require("@capsizecss/metrics/notoSans"));
|
|
14
44
|
var template = `/* Auto-generated by scripts/generate-typography-styles.ts */
|
|
15
45
|
|
|
16
46
|
/* Override Radix variables */
|
|
@@ -76,21 +106,21 @@ async function generate(options) {
|
|
|
76
106
|
let defaultFontStack;
|
|
77
107
|
let headingFontStack;
|
|
78
108
|
if (!options.defaultFontStack) {
|
|
79
|
-
options.defaultFontStack = [
|
|
80
|
-
defaultFontStack = createFontStack(options.defaultFontStack);
|
|
109
|
+
options.defaultFontStack = [import_appleSystem.default, import_segoeUI.default, import_roboto.default, import_ubuntu.default, import_notoSans.default];
|
|
110
|
+
defaultFontStack = (0, import_core.createFontStack)(options.defaultFontStack);
|
|
81
111
|
defaultFontStack.fontFamily += `, ui-sans-serif, system-ui, sans-serif`;
|
|
82
112
|
} else if (options.defaultFontStack) {
|
|
83
|
-
defaultFontStack = createFontStack(options.defaultFontStack);
|
|
113
|
+
defaultFontStack = (0, import_core.createFontStack)(options.defaultFontStack);
|
|
84
114
|
}
|
|
85
115
|
if (options.headingFontStack) {
|
|
86
|
-
headingFontStack = createFontStack(options.headingFontStack);
|
|
116
|
+
headingFontStack = (0, import_core.createFontStack)(options.headingFontStack);
|
|
87
117
|
} else {
|
|
88
118
|
headingFontStack = defaultFontStack;
|
|
89
119
|
}
|
|
90
120
|
const mobileFontData = [options.fontSizes[0], ...options.fontSizes].map(
|
|
91
121
|
(fontSize, i) => {
|
|
92
122
|
const lineGap = options.lineHeights[i - 1] - fontSize;
|
|
93
|
-
const style = createStyleString(
|
|
123
|
+
const style = (0, import_core.createStyleString)(
|
|
94
124
|
`rt-r-size-${i + 1}:not(.rt-DialogContent)`,
|
|
95
125
|
{
|
|
96
126
|
capHeight: fontSize,
|
|
@@ -100,7 +130,7 @@ async function generate(options) {
|
|
|
100
130
|
);
|
|
101
131
|
return {
|
|
102
132
|
style,
|
|
103
|
-
...createStyleObject({
|
|
133
|
+
...(0, import_core.createStyleObject)({
|
|
104
134
|
capHeight: fontSize,
|
|
105
135
|
lineGap,
|
|
106
136
|
fontMetrics: options.defaultFontStack[0]
|
|
@@ -111,7 +141,7 @@ async function generate(options) {
|
|
|
111
141
|
);
|
|
112
142
|
const fontData = options.fontSizes.map((fontSize, i) => {
|
|
113
143
|
const lineGap = options.lineHeights[i] - fontSize;
|
|
114
|
-
const style = createStyleString(
|
|
144
|
+
const style = (0, import_core.createStyleString)(
|
|
115
145
|
`rt-r-size-${i + 1}:not(.rt-DialogContent)`,
|
|
116
146
|
{
|
|
117
147
|
capHeight: fontSize,
|
|
@@ -121,7 +151,7 @@ async function generate(options) {
|
|
|
121
151
|
);
|
|
122
152
|
return {
|
|
123
153
|
style,
|
|
124
|
-
...createStyleObject({
|
|
154
|
+
...(0, import_core.createStyleObject)({
|
|
125
155
|
capHeight: fontSize,
|
|
126
156
|
lineGap,
|
|
127
157
|
fontMetrics: options.defaultFontStack[0]
|
|
@@ -129,39 +159,39 @@ async function generate(options) {
|
|
|
129
159
|
i: i + 1
|
|
130
160
|
};
|
|
131
161
|
});
|
|
132
|
-
const mobileTextStyles = createStyleString(`rt-Text`, {
|
|
162
|
+
const mobileTextStyles = (0, import_core.createStyleString)(`rt-Text`, {
|
|
133
163
|
capHeight: options.fontSizes[1],
|
|
134
164
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
135
165
|
fontMetrics: options.defaultFontStack[0]
|
|
136
166
|
});
|
|
137
|
-
const mobileEmStyles = createStyleString(`rt-Em`, {
|
|
167
|
+
const mobileEmStyles = (0, import_core.createStyleString)(`rt-Em`, {
|
|
138
168
|
capHeight: options.fontSizes[1],
|
|
139
169
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
140
170
|
fontMetrics: options.defaultFontStack[0]
|
|
141
171
|
});
|
|
142
|
-
const mobileQuoteStyles = createStyleString(`rt-Quote`, {
|
|
172
|
+
const mobileQuoteStyles = (0, import_core.createStyleString)(`rt-Quote`, {
|
|
143
173
|
capHeight: options.fontSizes[1],
|
|
144
174
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
145
175
|
fontMetrics: options.defaultFontStack[0]
|
|
146
176
|
});
|
|
147
|
-
const textStyles = createStyleString(`rt-Text`, {
|
|
177
|
+
const textStyles = (0, import_core.createStyleString)(`rt-Text`, {
|
|
148
178
|
capHeight: options.fontSizes[2],
|
|
149
179
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
150
180
|
fontMetrics: options.defaultFontStack[0]
|
|
151
181
|
});
|
|
152
|
-
const emStyles = createStyleString(`rt-Em`, {
|
|
182
|
+
const emStyles = (0, import_core.createStyleString)(`rt-Em`, {
|
|
153
183
|
capHeight: options.fontSizes[2],
|
|
154
184
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
155
185
|
fontMetrics: options.defaultFontStack[0]
|
|
156
186
|
});
|
|
157
|
-
const quoteStyles = createStyleString(`rt-Quote`, {
|
|
187
|
+
const quoteStyles = (0, import_core.createStyleString)(`rt-Quote`, {
|
|
158
188
|
capHeight: options.fontSizes[2],
|
|
159
189
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
160
190
|
fontMetrics: options.defaultFontStack[0]
|
|
161
191
|
});
|
|
162
|
-
|
|
192
|
+
import_fs.default.writeFileSync(
|
|
163
193
|
options.outputPath,
|
|
164
|
-
|
|
194
|
+
import_mustache.default.render(template, {
|
|
165
195
|
headingFontStack,
|
|
166
196
|
defaultFontStack,
|
|
167
197
|
mobileFontData,
|
|
@@ -195,6 +225,7 @@ function capsizeRadixPlugin({
|
|
|
195
225
|
}
|
|
196
226
|
};
|
|
197
227
|
}
|
|
198
|
-
export
|
|
228
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
229
|
+
0 && (module.exports = {
|
|
199
230
|
capsizeRadixPlugin
|
|
200
|
-
};
|
|
231
|
+
});
|
|
@@ -1,46 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
1
|
// src/index.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var import_notoSans = __toESM(require("@capsizecss/metrics/notoSans"), 1);
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import {
|
|
4
|
+
createStyleObject,
|
|
5
|
+
createStyleString,
|
|
6
|
+
createFontStack
|
|
7
|
+
} from "@capsizecss/core";
|
|
8
|
+
import Mustache from "mustache";
|
|
9
|
+
import segoeUI from "@capsizecss/metrics/segoeUI";
|
|
10
|
+
import appleSystem from "@capsizecss/metrics/appleSystem";
|
|
11
|
+
import roboto from "@capsizecss/metrics/roboto";
|
|
12
|
+
import ubuntu from "@capsizecss/metrics/ubuntu";
|
|
13
|
+
import notoSans from "@capsizecss/metrics/notoSans";
|
|
44
14
|
var template = `/* Auto-generated by scripts/generate-typography-styles.ts */
|
|
45
15
|
|
|
46
16
|
/* Override Radix variables */
|
|
@@ -106,21 +76,21 @@ async function generate(options) {
|
|
|
106
76
|
let defaultFontStack;
|
|
107
77
|
let headingFontStack;
|
|
108
78
|
if (!options.defaultFontStack) {
|
|
109
|
-
options.defaultFontStack = [
|
|
110
|
-
defaultFontStack =
|
|
79
|
+
options.defaultFontStack = [appleSystem, segoeUI, roboto, ubuntu, notoSans];
|
|
80
|
+
defaultFontStack = createFontStack(options.defaultFontStack);
|
|
111
81
|
defaultFontStack.fontFamily += `, ui-sans-serif, system-ui, sans-serif`;
|
|
112
82
|
} else if (options.defaultFontStack) {
|
|
113
|
-
defaultFontStack =
|
|
83
|
+
defaultFontStack = createFontStack(options.defaultFontStack);
|
|
114
84
|
}
|
|
115
85
|
if (options.headingFontStack) {
|
|
116
|
-
headingFontStack =
|
|
86
|
+
headingFontStack = createFontStack(options.headingFontStack);
|
|
117
87
|
} else {
|
|
118
88
|
headingFontStack = defaultFontStack;
|
|
119
89
|
}
|
|
120
90
|
const mobileFontData = [options.fontSizes[0], ...options.fontSizes].map(
|
|
121
91
|
(fontSize, i) => {
|
|
122
92
|
const lineGap = options.lineHeights[i - 1] - fontSize;
|
|
123
|
-
const style =
|
|
93
|
+
const style = createStyleString(
|
|
124
94
|
`rt-r-size-${i + 1}:not(.rt-DialogContent)`,
|
|
125
95
|
{
|
|
126
96
|
capHeight: fontSize,
|
|
@@ -130,7 +100,7 @@ async function generate(options) {
|
|
|
130
100
|
);
|
|
131
101
|
return {
|
|
132
102
|
style,
|
|
133
|
-
...
|
|
103
|
+
...createStyleObject({
|
|
134
104
|
capHeight: fontSize,
|
|
135
105
|
lineGap,
|
|
136
106
|
fontMetrics: options.defaultFontStack[0]
|
|
@@ -141,7 +111,7 @@ async function generate(options) {
|
|
|
141
111
|
);
|
|
142
112
|
const fontData = options.fontSizes.map((fontSize, i) => {
|
|
143
113
|
const lineGap = options.lineHeights[i] - fontSize;
|
|
144
|
-
const style =
|
|
114
|
+
const style = createStyleString(
|
|
145
115
|
`rt-r-size-${i + 1}:not(.rt-DialogContent)`,
|
|
146
116
|
{
|
|
147
117
|
capHeight: fontSize,
|
|
@@ -151,7 +121,7 @@ async function generate(options) {
|
|
|
151
121
|
);
|
|
152
122
|
return {
|
|
153
123
|
style,
|
|
154
|
-
...
|
|
124
|
+
...createStyleObject({
|
|
155
125
|
capHeight: fontSize,
|
|
156
126
|
lineGap,
|
|
157
127
|
fontMetrics: options.defaultFontStack[0]
|
|
@@ -159,39 +129,39 @@ async function generate(options) {
|
|
|
159
129
|
i: i + 1
|
|
160
130
|
};
|
|
161
131
|
});
|
|
162
|
-
const mobileTextStyles =
|
|
132
|
+
const mobileTextStyles = createStyleString(`rt-Text`, {
|
|
163
133
|
capHeight: options.fontSizes[1],
|
|
164
134
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
165
135
|
fontMetrics: options.defaultFontStack[0]
|
|
166
136
|
});
|
|
167
|
-
const mobileEmStyles =
|
|
137
|
+
const mobileEmStyles = createStyleString(`rt-Em`, {
|
|
168
138
|
capHeight: options.fontSizes[1],
|
|
169
139
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
170
140
|
fontMetrics: options.defaultFontStack[0]
|
|
171
141
|
});
|
|
172
|
-
const mobileQuoteStyles =
|
|
142
|
+
const mobileQuoteStyles = createStyleString(`rt-Quote`, {
|
|
173
143
|
capHeight: options.fontSizes[1],
|
|
174
144
|
lineGap: options.lineHeights[1] - options.fontSizes[1],
|
|
175
145
|
fontMetrics: options.defaultFontStack[0]
|
|
176
146
|
});
|
|
177
|
-
const textStyles =
|
|
147
|
+
const textStyles = createStyleString(`rt-Text`, {
|
|
178
148
|
capHeight: options.fontSizes[2],
|
|
179
149
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
180
150
|
fontMetrics: options.defaultFontStack[0]
|
|
181
151
|
});
|
|
182
|
-
const emStyles =
|
|
152
|
+
const emStyles = createStyleString(`rt-Em`, {
|
|
183
153
|
capHeight: options.fontSizes[2],
|
|
184
154
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
185
155
|
fontMetrics: options.defaultFontStack[0]
|
|
186
156
|
});
|
|
187
|
-
const quoteStyles =
|
|
157
|
+
const quoteStyles = createStyleString(`rt-Quote`, {
|
|
188
158
|
capHeight: options.fontSizes[2],
|
|
189
159
|
lineGap: options.lineHeights[2] - options.fontSizes[2],
|
|
190
160
|
fontMetrics: options.defaultFontStack[0]
|
|
191
161
|
});
|
|
192
|
-
|
|
162
|
+
fs.writeFileSync(
|
|
193
163
|
options.outputPath,
|
|
194
|
-
|
|
164
|
+
Mustache.render(template, {
|
|
195
165
|
headingFontStack,
|
|
196
166
|
defaultFontStack,
|
|
197
167
|
mobileFontData,
|
|
@@ -225,7 +195,6 @@ function capsizeRadixPlugin({
|
|
|
225
195
|
}
|
|
226
196
|
};
|
|
227
197
|
}
|
|
228
|
-
|
|
229
|
-
0 && (module.exports = {
|
|
198
|
+
export {
|
|
230
199
|
capsizeRadixPlugin
|
|
231
|
-
}
|
|
200
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-capsize-radix",
|
|
3
3
|
"description": "Great Typography with Radix & Capsize",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@capsizecss/core": "^4.1.0",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
35
|
"types": {
|
|
36
|
-
"import": "./dist/index.d.
|
|
37
|
-
"require": "./dist/index.d.
|
|
36
|
+
"import": "./dist/index.d.mts",
|
|
37
|
+
"require": "./dist/index.d.ts"
|
|
38
38
|
},
|
|
39
|
-
"import": "./dist/index.
|
|
39
|
+
"import": "./dist/index.mjs",
|
|
40
40
|
"require": "./dist/index.cjs"
|
|
41
41
|
},
|
|
42
42
|
"./package.json": "./package.json"
|
|
@@ -70,6 +70,5 @@
|
|
|
70
70
|
],
|
|
71
71
|
"dts": true
|
|
72
72
|
},
|
|
73
|
-
"type": "module",
|
|
74
73
|
"types": "./dist/index.d.ts"
|
|
75
74
|
}
|
|
File without changes
|