kern-lang 1.0.0 → 2.0.0

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.
Files changed (66) hide show
  1. package/dist/index.d.ts +14 -25
  2. package/dist/index.js +15 -28
  3. package/dist/index.js.map +1 -1
  4. package/package.json +17 -36
  5. package/README.md +0 -304
  6. package/dist/cli.d.ts +0 -2
  7. package/dist/cli.js +0 -244
  8. package/dist/cli.js.map +0 -1
  9. package/dist/config.d.ts +0 -46
  10. package/dist/config.js +0 -54
  11. package/dist/config.js.map +0 -1
  12. package/dist/context-export.d.ts +0 -11
  13. package/dist/context-export.js +0 -121
  14. package/dist/context-export.js.map +0 -1
  15. package/dist/decompiler.d.ts +0 -2
  16. package/dist/decompiler.js +0 -44
  17. package/dist/decompiler.js.map +0 -1
  18. package/dist/draft-protocol.d.ts +0 -27
  19. package/dist/draft-protocol.js +0 -135
  20. package/dist/draft-protocol.js.map +0 -1
  21. package/dist/errors.d.ts +0 -12
  22. package/dist/errors.js +0 -40
  23. package/dist/errors.js.map +0 -1
  24. package/dist/metrics.d.ts +0 -30
  25. package/dist/metrics.js +0 -182
  26. package/dist/metrics.js.map +0 -1
  27. package/dist/parser.d.ts +0 -4
  28. package/dist/parser.js +0 -361
  29. package/dist/parser.js.map +0 -1
  30. package/dist/spec.d.ts +0 -17
  31. package/dist/spec.js +0 -86
  32. package/dist/spec.js.map +0 -1
  33. package/dist/styles-react.d.ts +0 -3
  34. package/dist/styles-react.js +0 -20
  35. package/dist/styles-react.js.map +0 -1
  36. package/dist/styles-tailwind.d.ts +0 -8
  37. package/dist/styles-tailwind.js +0 -197
  38. package/dist/styles-tailwind.js.map +0 -1
  39. package/dist/transpiler-cli.d.ts +0 -3
  40. package/dist/transpiler-cli.js +0 -279
  41. package/dist/transpiler-cli.js.map +0 -1
  42. package/dist/transpiler-express.d.ts +0 -3
  43. package/dist/transpiler-express.js +0 -612
  44. package/dist/transpiler-express.js.map +0 -1
  45. package/dist/transpiler-nextjs.d.ts +0 -21
  46. package/dist/transpiler-nextjs.js +0 -400
  47. package/dist/transpiler-nextjs.js.map +0 -1
  48. package/dist/transpiler-tailwind.d.ts +0 -3
  49. package/dist/transpiler-tailwind.js +0 -594
  50. package/dist/transpiler-tailwind.js.map +0 -1
  51. package/dist/transpiler-terminal.d.ts +0 -3
  52. package/dist/transpiler-terminal.js +0 -522
  53. package/dist/transpiler-terminal.js.map +0 -1
  54. package/dist/transpiler-web.d.ts +0 -3
  55. package/dist/transpiler-web.js +0 -218
  56. package/dist/transpiler-web.js.map +0 -1
  57. package/dist/transpiler.d.ts +0 -3
  58. package/dist/transpiler.js +0 -218
  59. package/dist/transpiler.js.map +0 -1
  60. package/dist/types.d.ts +0 -76
  61. package/dist/types.js +0 -11
  62. package/dist/types.js.map +0 -1
  63. package/dist/utils.d.ts +0 -5
  64. package/dist/utils.js +0 -36
  65. package/dist/utils.js.map +0 -1
  66. package/kern.config.ts +0 -61
package/dist/parser.js DELETED
@@ -1,361 +0,0 @@
1
- let _parseWarnings = [];
2
- const MULTILINE_BLOCK_TYPES = new Set(['logic', 'handler']);
3
- function parseLine(raw, lineNum) {
4
- if (raw.trim() === '')
5
- return null;
6
- const indent = raw.search(/\S/);
7
- let rest = raw.slice(indent);
8
- const col = indent + 1;
9
- // Extract type
10
- const typeMatch = rest.match(/^([A-Za-z_][A-Za-z0-9_-]*)/);
11
- if (!typeMatch)
12
- return null;
13
- const type = typeMatch[1];
14
- rest = rest.slice(type.length);
15
- const props = {};
16
- const styles = {};
17
- const pseudoStyles = {};
18
- const themeRefs = [];
19
- // Special: theme nodes have a bare name after the type: "theme bar {h:8}"
20
- if (type === 'theme') {
21
- rest = rest.replace(/^ +/, '');
22
- const nameMatch = rest.match(/^([A-Za-z_][A-Za-z0-9_-]*)/);
23
- if (nameMatch) {
24
- props.name = nameMatch[1];
25
- rest = rest.slice(nameMatch[0].length);
26
- }
27
- }
28
- // Parse the remainder: props, style blocks, theme refs
29
- while (rest.length > 0) {
30
- rest = rest.replace(/^ +/, '');
31
- if (rest.length === 0)
32
- break;
33
- // Style block — find matching } respecting quotes
34
- if (rest[0] === '{') {
35
- let close = -1;
36
- let inQuote = false;
37
- for (let j = 1; j < rest.length; j++) {
38
- if (rest[j] === '"')
39
- inQuote = !inQuote;
40
- if (!inQuote && rest[j] === '}') {
41
- close = j;
42
- break;
43
- }
44
- }
45
- if (close === -1)
46
- break;
47
- const block = rest.slice(1, close);
48
- parseStyleBlock(block, styles, pseudoStyles);
49
- rest = rest.slice(close + 1);
50
- continue;
51
- }
52
- // Theme ref
53
- if (rest[0] === '$') {
54
- const refMatch = rest.match(/^\$([A-Za-z_][A-Za-z0-9_-]*)/);
55
- if (refMatch) {
56
- themeRefs.push(refMatch[1]);
57
- rest = rest.slice(refMatch[0].length);
58
- continue;
59
- }
60
- }
61
- // Prop: key={{ expression }}
62
- const exprPropMatch = rest.match(/^([A-Za-z_][A-Za-z0-9_-]*)=\{\{/);
63
- if (exprPropMatch) {
64
- const key = exprPropMatch[1];
65
- rest = rest.slice(exprPropMatch[0].length);
66
- // Find matching }}
67
- let depth = 1;
68
- let j = 0;
69
- for (; j < rest.length - 1; j++) {
70
- if (rest[j] === '{' && rest[j + 1] === '{') {
71
- depth++;
72
- j++;
73
- }
74
- else if (rest[j] === '}' && rest[j + 1] === '}') {
75
- depth--;
76
- j++;
77
- if (depth === 0)
78
- break;
79
- }
80
- }
81
- const expr = rest.slice(0, j - 1).trim();
82
- rest = rest.slice(j + 1);
83
- props[key] = { __expr: true, code: expr };
84
- continue;
85
- }
86
- // Prop: key=value or key="quoted value"
87
- const propMatch = rest.match(/^([A-Za-z_][A-Za-z0-9_-]*)=/);
88
- if (propMatch) {
89
- const key = propMatch[1];
90
- rest = rest.slice(propMatch[0].length);
91
- let value;
92
- if (rest[0] === '"') {
93
- const endQuote = rest.indexOf('"', 1);
94
- value = rest.slice(1, endQuote);
95
- rest = rest.slice(endQuote + 1);
96
- }
97
- else if (rest.startsWith('{{')) {
98
- // Bare expression without key= prefix (e.g. value={{ x }})
99
- rest = rest.slice(2);
100
- let depth = 1;
101
- let j = 0;
102
- for (; j < rest.length - 1; j++) {
103
- if (rest[j] === '{' && rest[j + 1] === '{') {
104
- depth++;
105
- j++;
106
- }
107
- else if (rest[j] === '}' && rest[j + 1] === '}') {
108
- depth--;
109
- j++;
110
- if (depth === 0)
111
- break;
112
- }
113
- }
114
- const expr = rest.slice(0, j - 1).trim();
115
- rest = rest.slice(j + 1);
116
- props[key] = { __expr: true, code: expr };
117
- continue;
118
- }
119
- else {
120
- const endMatch = rest.match(/^[^\s{$]+/);
121
- value = endMatch ? endMatch[0] : '';
122
- rest = rest.slice(value.length);
123
- }
124
- props[key] = value;
125
- continue;
126
- }
127
- // Unknown token — collect as warning, skip to next whitespace
128
- const skipped = rest.match(/^\S+/);
129
- if (skipped) {
130
- const errCol = col + (raw.length - rest.length);
131
- _parseWarnings.push(`Unexpected token "${skipped[0]}" at line ${lineNum}:${errCol}`);
132
- rest = rest.slice(skipped[0].length);
133
- continue;
134
- }
135
- break;
136
- }
137
- return {
138
- indent: indent / 2,
139
- type,
140
- props,
141
- styles,
142
- pseudoStyles,
143
- themeRefs,
144
- loc: { line: lineNum, col },
145
- };
146
- }
147
- function splitStylePairs(block) {
148
- const pairs = [];
149
- let current = '';
150
- let inQuote = false;
151
- let parenDepth = 0;
152
- for (let i = 0; i < block.length; i++) {
153
- const ch = block[i];
154
- if (ch === '"') {
155
- inQuote = !inQuote;
156
- current += ch;
157
- }
158
- else if (!inQuote && ch === '(') {
159
- parenDepth++;
160
- current += ch;
161
- }
162
- else if (!inQuote && ch === ')') {
163
- parenDepth--;
164
- current += ch;
165
- }
166
- else if (!inQuote && parenDepth === 0 && ch === ',') {
167
- if (current.trim())
168
- pairs.push(current.trim());
169
- current = '';
170
- }
171
- else {
172
- current += ch;
173
- }
174
- }
175
- if (current.trim())
176
- pairs.push(current.trim());
177
- return pairs;
178
- }
179
- function parseStyleBlock(block, styles, pseudoStyles) {
180
- const pairs = splitStylePairs(block);
181
- for (const pair of pairs) {
182
- // Pseudo-selector: :press:bg:#005BB5
183
- const pseudoMatch = pair.match(/^:([a-z]+):([A-Za-z0-9_-]+):(.+)$/);
184
- if (pseudoMatch) {
185
- const [, pseudo, key, value] = pseudoMatch;
186
- if (!pseudoStyles[pseudo])
187
- pseudoStyles[pseudo] = {};
188
- pseudoStyles[pseudo][key] = value.trim();
189
- continue;
190
- }
191
- // Quoted key: "backdrop-filter":"blur(8px)"
192
- const quotedKeyMatch = pair.match(/^"([^"]+)"\s*:\s*(.*)/);
193
- if (quotedKeyMatch) {
194
- const key = quotedKeyMatch[1];
195
- let value = quotedKeyMatch[2].trim();
196
- // Strip surrounding quotes from value if present
197
- if (value.startsWith('"') && value.endsWith('"')) {
198
- value = value.slice(1, -1);
199
- }
200
- styles[key] = value;
201
- continue;
202
- }
203
- // Normal: key:value (value may be quoted)
204
- const colonIdx = pair.indexOf(':');
205
- if (colonIdx > 0) {
206
- const key = pair.slice(0, colonIdx).trim();
207
- let value = pair.slice(colonIdx + 1).trim();
208
- // Strip surrounding quotes from value if present
209
- if (value.startsWith('"') && value.endsWith('"')) {
210
- value = value.slice(1, -1);
211
- }
212
- styles[key] = value;
213
- }
214
- }
215
- }
216
- function expandMinified(source) {
217
- // Detect minified S-expression format: node(child1,child2)
218
- // Convert to indented format for the standard parser
219
- if (!source.includes('(') || source.split('\n').length > 2)
220
- return source;
221
- const result = [];
222
- let depth = 0;
223
- let current = '';
224
- let inQuote = false;
225
- let inBraces = 0;
226
- for (let i = 0; i < source.length; i++) {
227
- const ch = source[i];
228
- if (ch === '"') {
229
- inQuote = !inQuote;
230
- current += ch;
231
- continue;
232
- }
233
- if (inQuote) {
234
- current += ch;
235
- continue;
236
- }
237
- if (ch === '{') {
238
- inBraces++;
239
- current += ch;
240
- continue;
241
- }
242
- if (ch === '}') {
243
- inBraces--;
244
- current += ch;
245
- continue;
246
- }
247
- if (inBraces > 0) {
248
- current += ch;
249
- continue;
250
- }
251
- if (ch === '(') {
252
- result.push(' '.repeat(depth) + current.trim());
253
- current = '';
254
- depth++;
255
- }
256
- else if (ch === ')') {
257
- if (current.trim())
258
- result.push(' '.repeat(depth) + current.trim());
259
- current = '';
260
- depth--;
261
- }
262
- else if (ch === ',' && inBraces === 0) {
263
- if (current.trim())
264
- result.push(' '.repeat(depth) + current.trim());
265
- current = '';
266
- }
267
- else {
268
- current += ch;
269
- }
270
- }
271
- if (current.trim())
272
- result.push(' '.repeat(depth) + current.trim());
273
- return result.join('\n');
274
- }
275
- /** Get warnings from the last parse() call */
276
- export function getParseWarnings() { return [..._parseWarnings]; }
277
- export function parse(source) {
278
- _parseWarnings = [];
279
- // Handle minified S-expression format
280
- source = expandMinified(source);
281
- const lines = source.split('\n');
282
- const parsed = [];
283
- for (let i = 0; i < lines.length; i++) {
284
- const trimmed = lines[i].trimStart();
285
- const multilineType = [...MULTILINE_BLOCK_TYPES].find(type => trimmed.startsWith(`${type} <<<`));
286
- if (multilineType) {
287
- const indent = lines[i].search(/\S/);
288
- const codeLines = [];
289
- const startLine = i + 1;
290
- const blockOpen = `${multilineType} <<<`;
291
- // Check if inline close on same line
292
- const afterOpen = trimmed.slice(blockOpen.length);
293
- if (afterOpen.includes('>>>')) {
294
- codeLines.push(afterOpen.split('>>>')[0]);
295
- }
296
- else {
297
- i++;
298
- while (i < lines.length && !lines[i].includes('>>>')) {
299
- codeLines.push(lines[i]);
300
- i++;
301
- }
302
- // Capture text before >>> on closing line
303
- if (i < lines.length) {
304
- const closeLine = lines[i];
305
- const closeIdx = closeLine.indexOf('>>>');
306
- if (closeIdx > 0)
307
- codeLines.push(closeLine.slice(0, closeIdx));
308
- }
309
- }
310
- parsed.push({
311
- indent: indent / 2,
312
- type: multilineType,
313
- props: { code: codeLines.join('\n').trim() },
314
- styles: {},
315
- pseudoStyles: {},
316
- themeRefs: [],
317
- loc: { line: startLine, col: indent + 1 },
318
- });
319
- continue;
320
- }
321
- const p = parseLine(lines[i], i + 1);
322
- if (p)
323
- parsed.push(p);
324
- }
325
- if (parsed.length === 0) {
326
- return { type: 'document', children: [], loc: { line: 1, col: 1 } };
327
- }
328
- function toNode(p) {
329
- const node = {
330
- type: p.type,
331
- loc: p.loc,
332
- props: { ...p.props },
333
- children: [],
334
- };
335
- if (Object.keys(p.styles).length > 0)
336
- node.props.styles = p.styles;
337
- if (Object.keys(p.pseudoStyles).length > 0)
338
- node.props.pseudoStyles = p.pseudoStyles;
339
- if (p.themeRefs.length > 0)
340
- node.props.themeRefs = p.themeRefs;
341
- return node;
342
- }
343
- // Build tree using indent levels
344
- const root = toNode(parsed[0]);
345
- const stack = [{ node: root, indent: parsed[0].indent }];
346
- for (let i = 1; i < parsed.length; i++) {
347
- const p = parsed[i];
348
- const node = toNode(p);
349
- // Pop stack until we find a parent at a lower indent level
350
- while (stack.length > 1 && stack[stack.length - 1].indent >= p.indent) {
351
- stack.pop();
352
- }
353
- const parent = stack[stack.length - 1].node;
354
- if (!parent.children)
355
- parent.children = [];
356
- parent.children.push(node);
357
- stack.push({ node, indent: p.indent });
358
- }
359
- return root;
360
- }
361
- //# sourceMappingURL=parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAGA,IAAI,cAAc,GAAa,EAAE,CAAC;AAYlC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5D,SAAS,SAAS,CAAC,GAAW,EAAE,OAAe;IAC7C,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAEnC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,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AM,CAAC,QAAQ,GAAG,EAAE,CAAC;QAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
package/dist/spec.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Kern v2 Specification
3
- *
4
- * The LLM-native language. Swiss-engineered.
5
- * Designed by 3 AIs through forge + tribunal + brainstorm.
6
- *
7
- * Foundation: indent-based, semantic names, key=value props
8
- * Styles: shorthand blocks in {} with CSS escape hatch
9
- * Meta: theme nodes ($ref), pseudo-selectors (:press, :hover)
10
- * Targets: Next.js, React+Tailwind, React Native, Express
11
- */
12
- export declare const KERN_VERSION = "2.0.0";
13
- export declare const IR_GRAMMAR = "\ndocument = node+\nnode = indent type (SP prop)* (SP style)? (SP themeref)* NL child*\nchild = node\nindent = \" \"*\ntype = ident\nprop = ident \"=\" value\nvalue = quoted | bare\nquoted = '\"' [^\"]* '\"'\nbare = [^\\s{$]+\nstyle = \"{\" spair (\",\" spair)* \"}\"\nspair = sident \":\" svalue | \":\" pseudo \":\" sident \":\" svalue\npseudo = \"press\" | \"hover\" | \"active\" | \"focus\"\nsident = shorthand | ident\nsvalue = [^,}]+\nthemeref = \"$\" ident\nident = [A-Za-z_][A-Za-z0-9_-]*\nSP = \" \"+\nNL = \"\\n\" | EOF\n";
14
- export declare const NODE_TYPES: readonly ["screen", "row", "col", "card", "scroll", "text", "image", "progress", "divider", "button", "input", "modal", "list", "item", "tabs", "tab", "header", "theme", "server", "route", "middleware", "handler", "schema", "stream", "spawn", "timer", "on", "env", "cli", "command", "arg", "flag", "import", "separator", "table", "scoreboard", "metric", "spinner", "progress", "box", "gradient", "repl", "guard", "parallel", "dispatch", "then", "each"];
15
- export type IRNodeType = (typeof NODE_TYPES)[number];
16
- export declare const STYLE_SHORTHANDS: Record<string, string>;
17
- export declare const VALUE_SHORTHANDS: Record<string, string>;
package/dist/spec.js DELETED
@@ -1,86 +0,0 @@
1
- /**
2
- * Kern v2 Specification
3
- *
4
- * The LLM-native language. Swiss-engineered.
5
- * Designed by 3 AIs through forge + tribunal + brainstorm.
6
- *
7
- * Foundation: indent-based, semantic names, key=value props
8
- * Styles: shorthand blocks in {} with CSS escape hatch
9
- * Meta: theme nodes ($ref), pseudo-selectors (:press, :hover)
10
- * Targets: Next.js, React+Tailwind, React Native, Express
11
- */
12
- export const KERN_VERSION = '2.0.0';
13
- // ── Grammar ─────────────────────────────────────────────────────────────
14
- export const IR_GRAMMAR = `
15
- document = node+
16
- node = indent type (SP prop)* (SP style)? (SP themeref)* NL child*
17
- child = node
18
- indent = " "*
19
- type = ident
20
- prop = ident "=" value
21
- value = quoted | bare
22
- quoted = '"' [^"]* '"'
23
- bare = [^\\s{$]+
24
- style = "{" spair ("," spair)* "}"
25
- spair = sident ":" svalue | ":" pseudo ":" sident ":" svalue
26
- pseudo = "press" | "hover" | "active" | "focus"
27
- sident = shorthand | ident
28
- svalue = [^,}]+
29
- themeref = "$" ident
30
- ident = [A-Za-z_][A-Za-z0-9_-]*
31
- SP = " "+
32
- NL = "\\n" | EOF
33
- `;
34
- // ── Node Types ──────────────────────────────────────────────────────────
35
- export const NODE_TYPES = [
36
- // Layout
37
- 'screen', 'row', 'col', 'card', 'scroll',
38
- // Content
39
- 'text', 'image', 'progress', 'divider',
40
- // Interactive
41
- 'button', 'input', 'modal',
42
- // Lists
43
- 'list', 'item',
44
- // Navigation
45
- 'tabs', 'tab', 'header',
46
- // Meta
47
- 'theme',
48
- // Backend
49
- 'server', 'route', 'middleware', 'handler', 'schema',
50
- 'stream', 'spawn', 'timer', 'on', 'env',
51
- // CLI
52
- 'cli', 'command', 'arg', 'flag', 'import',
53
- // Terminal
54
- 'separator', 'table', 'scoreboard', 'metric',
55
- 'spinner', 'progress', 'box', 'gradient',
56
- 'repl', 'guard', 'parallel', 'dispatch', 'then', 'each',
57
- ];
58
- // ── Style Shorthands (FROZEN at v1.0 — 30 entries) ──────────────────────
59
- // Any CSS property not in this map uses the escape hatch: "property":"value"
60
- // This map will NOT grow. Use quoted keys for new CSS properties.
61
- export const STYLE_SHORTHANDS = {
62
- // Spacing
63
- p: 'padding', m: 'margin',
64
- pt: 'paddingTop', pb: 'paddingBottom', pl: 'paddingLeft', pr: 'paddingRight',
65
- mt: 'marginTop', mb: 'marginBottom', ml: 'marginLeft', mr: 'marginRight',
66
- // Sizing
67
- w: 'width', h: 'height', f: 'flex',
68
- // Colors
69
- bg: 'backgroundColor', c: 'color', bc: 'borderColor',
70
- // Typography
71
- fs: 'fontSize', fw: 'fontWeight', ta: 'textAlign',
72
- // Borders
73
- br: 'borderRadius', bw: 'borderWidth',
74
- // Layout
75
- jc: 'justifyContent', ai: 'alignItems', fd: 'flexDirection',
76
- // Effects
77
- shadow: 'elevation',
78
- };
79
- // ── Justify/Align Value Shorthands ──────────────────────────────────────
80
- export const VALUE_SHORTHANDS = {
81
- sb: 'space-between', sa: 'space-around', se: 'space-evenly',
82
- center: 'center', start: 'flex-start', end: 'flex-end',
83
- stretch: 'stretch', bold: 'bold',
84
- full: '100%',
85
- };
86
- //# sourceMappingURL=spec.js.map
package/dist/spec.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;CAmBzB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS;IACT,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ;IACxC,UAAU;IACV,MAAM,EAAE,OAAO,E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rC,SAAS;IACT,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe;IAC3D,UAAU;IACV,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc;IAC3D,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU;IACtD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM;IAChC,IAAI,EAAE,MAAM;CACb,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare function expandStyleKey(key: string): string;
2
- export declare function expandStyleValue(value: string): string | number;
3
- export declare function expandStyles(styles: Record<string, string>): Record<string, string | number>;
@@ -1,20 +0,0 @@
1
- import { STYLE_SHORTHANDS, VALUE_SHORTHANDS } from './spec.js';
2
- export function expandStyleKey(key) {
3
- return STYLE_SHORTHANDS[key] || key;
4
- }
5
- export function expandStyleValue(value) {
6
- if (VALUE_SHORTHANDS[value])
7
- return VALUE_SHORTHANDS[value];
8
- const num = Number(value);
9
- if (!isNaN(num) && value !== '')
10
- return num;
11
- return value;
12
- }
13
- export function expandStyles(styles) {
14
- const result = {};
15
- for (const [k, v] of Object.entries(styles)) {
16
- result[expandStyleKey(k)] = expandStyleValue(v);
17
- }
18
- return result;
19
- }
20
- //# sourceMappingURL=styles-react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles-react.js","sourceRoot":"","sources":["../src/styles-react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,IAAI,gBAAgB,CAAC,KAAK,CAAC;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,GAAG,CAAC;IAC5C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAA8B;IACzD,MAAM,MAAM,GAAoC,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare const DEFAULT_COLORS: Record<string, string>;
2
- export declare function stylesToTailwind(styles: Record<string, string>, colors?: Record<string, string>): string;
3
- export declare function pxToTw(prefix: string, v: string): string;
4
- export declare function colorToTw(prefix: string, v: string, colors?: Record<string, string>): string;
5
- export declare function fsTw(v: string): string;
6
- export declare function fwTw(v: string): string;
7
- export declare function addPx(v: string): string;
8
- export declare function cssKebab(s: string): string;