@webmate-studio/builder 0.2.115 → 0.2.117
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/package.json +3 -1
- package/src/design-tokens.js +48 -2
- package/src/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmate-studio/builder",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.117",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Webmate Studio Component Builder",
|
|
6
6
|
"keywords": [
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"./build-service.js": "./build-service.js",
|
|
25
25
|
"./src/css-deduplicator.js": "./src/css-deduplicator.js",
|
|
26
26
|
"./src/design-tokens.js": "./src/design-tokens.js",
|
|
27
|
+
"./src/template-processor.js": "./src/template-processor.js",
|
|
28
|
+
"./src/markdown.js": "./src/markdown.js",
|
|
27
29
|
"./dist/motion-runtime.min.js": "./dist/motion-runtime.min.js"
|
|
28
30
|
},
|
|
29
31
|
"bin": {
|
package/src/design-tokens.js
CHANGED
|
@@ -54,7 +54,12 @@ function generateSemanticColorUtilities(tokens) {
|
|
|
54
54
|
'textAccentMuted': 'text-accent-muted',
|
|
55
55
|
'borderAccentBase': 'border-accent-default',
|
|
56
56
|
'borderAccentSubtle': 'border-accent-subtle',
|
|
57
|
-
'borderAccentMuted': 'border-accent-muted'
|
|
57
|
+
'borderAccentMuted': 'border-accent-muted',
|
|
58
|
+
|
|
59
|
+
// Text-on-background colors
|
|
60
|
+
'textOnPrimary': 'text-on-primary',
|
|
61
|
+
'textOnSecondary': 'text-on-secondary',
|
|
62
|
+
'textOnAccent': 'text-on-accent'
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
// Collect unique class names (deduplicate)
|
|
@@ -242,7 +247,12 @@ export const defaultDesignTokens = {
|
|
|
242
247
|
// Border Colors (Accent)
|
|
243
248
|
borderAccentBase: '#8b5cf6', // violet-500
|
|
244
249
|
borderAccentSubtle: '#a78bfa', // violet-400
|
|
245
|
-
borderAccentMuted: '#c4b5fd'
|
|
250
|
+
borderAccentMuted: '#c4b5fd', // violet-300
|
|
251
|
+
|
|
252
|
+
// Text-on-Background Colors (for text on colored backgrounds)
|
|
253
|
+
textOnPrimary: '#ffffff', // Text on bg-primary
|
|
254
|
+
textOnSecondary: '#ffffff', // Text on bg-secondary
|
|
255
|
+
textOnAccent: '#ffffff' // Text on bg-accent
|
|
246
256
|
},
|
|
247
257
|
|
|
248
258
|
typography: {
|
|
@@ -671,6 +681,11 @@ export function generateTailwindV4Theme(tokens) {
|
|
|
671
681
|
if (tokens.colors.borderSubtle) lines.push(` --color-border-subtle: ${tokens.colors.borderSubtle};`);
|
|
672
682
|
if (tokens.colors.borderMuted) lines.push(` --color-border-muted: ${tokens.colors.borderMuted};`);
|
|
673
683
|
|
|
684
|
+
// Text-on-background colors
|
|
685
|
+
if (tokens.colors.textOnPrimary) lines.push(` --color-text-on-primary: ${tokens.colors.textOnPrimary};`);
|
|
686
|
+
if (tokens.colors.textOnSecondary) lines.push(` --color-text-on-secondary: ${tokens.colors.textOnSecondary};`);
|
|
687
|
+
if (tokens.colors.textOnAccent) lines.push(` --color-text-on-accent: ${tokens.colors.textOnAccent};`);
|
|
688
|
+
|
|
674
689
|
// Basic colors
|
|
675
690
|
if (tokens.colors.white) lines.push(` --color-white: ${tokens.colors.white};`);
|
|
676
691
|
if (tokens.colors.black) lines.push(` --color-black: ${tokens.colors.black};`);
|
|
@@ -1145,6 +1160,37 @@ export function generateTailwindConfig(tokens) {
|
|
|
1145
1160
|
};
|
|
1146
1161
|
}
|
|
1147
1162
|
|
|
1163
|
+
/**
|
|
1164
|
+
* Generate @import rules for Fontsource/Bunny Fonts used in the design tokens.
|
|
1165
|
+
* Works in both browser (preview) and build contexts.
|
|
1166
|
+
* Returns a CSS string with @import statements (or empty string if no web fonts).
|
|
1167
|
+
*/
|
|
1168
|
+
export function generateFontImports(tokens) {
|
|
1169
|
+
const imports = [];
|
|
1170
|
+
const processedFonts = new Set();
|
|
1171
|
+
|
|
1172
|
+
function processFontId(fontId) {
|
|
1173
|
+
if (!fontId || processedFonts.has(fontId)) return;
|
|
1174
|
+
processedFonts.add(fontId);
|
|
1175
|
+
|
|
1176
|
+
if (fontId.startsWith('fontsource:')) {
|
|
1177
|
+
const fontsourceName = fontId.replace('fontsource:', '');
|
|
1178
|
+
const fontFamily = fontsourceName
|
|
1179
|
+
.split('-')
|
|
1180
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
1181
|
+
.join(' ');
|
|
1182
|
+
imports.push(`@import url('https://fonts.bunny.net/css?family=${fontFamily.replace(/\s+/g, '+')}:100,200,300,400,500,600,700,800,900&display=swap');`);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
if (tokens?.typography?.fontHeadingId) processFontId(tokens.typography.fontHeadingId);
|
|
1187
|
+
if (tokens?.typography?.fontBodyId) processFontId(tokens.typography.fontBodyId);
|
|
1188
|
+
if (tokens?.typography?.fontMonoId) processFontId(tokens.typography.fontMonoId);
|
|
1189
|
+
if (tokens?.typography?.fontAccentId) processFontId(tokens.typography.fontAccentId);
|
|
1190
|
+
|
|
1191
|
+
return imports.length > 0 ? imports.join('\n') + '\n\n' : '';
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1148
1194
|
/**
|
|
1149
1195
|
* Generate CSS Variables from Design Tokens
|
|
1150
1196
|
*/
|
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { deduplicateCSS } from './css-deduplicator.js';
|
|
|
6
6
|
import { markdownToHtml, processMarkdownProps } from './markdown.js';
|
|
7
7
|
import TemplateProcessor, { templateProcessor } from './template-processor.js';
|
|
8
8
|
import { SafeHtml } from './safe-html.js';
|
|
9
|
-
import { defaultDesignTokens, generateTailwindV4Theme, generateTailwindConfig, generateCSSFromTokens } from './design-tokens.js';
|
|
9
|
+
import { defaultDesignTokens, generateTailwindV4Theme, generateTailwindConfig, generateCSSFromTokens, generateFontImports } from './design-tokens.js';
|
|
10
10
|
import { readFileSync } from 'fs';
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
12
|
import { dirname, join } from 'path';
|
|
@@ -19,4 +19,4 @@ function getMotionRuntime() {
|
|
|
19
19
|
return readFileSync(join(__dirname, '../dist/motion-runtime.min.js'), 'utf-8');
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export { build, generateComponentCSS, generateTailwindCSS, extractTailwindClasses, cleanComponentHTML, bundleIsland, bundleComponentIslands, deduplicateCSS, markdownToHtml, processMarkdownProps, SafeHtml, getMotionRuntime, TemplateProcessor, templateProcessor, defaultDesignTokens, generateTailwindV4Theme, generateTailwindConfig, generateCSSFromTokens };
|
|
22
|
+
export { build, generateComponentCSS, generateTailwindCSS, extractTailwindClasses, cleanComponentHTML, bundleIsland, bundleComponentIslands, deduplicateCSS, markdownToHtml, processMarkdownProps, SafeHtml, getMotionRuntime, TemplateProcessor, templateProcessor, defaultDesignTokens, generateTailwindV4Theme, generateTailwindConfig, generateCSSFromTokens, generateFontImports };
|