@duro-app/eslint-plugin 1.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 (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/index.d.ts +29 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +23 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/rules/index.d.ts +19 -0
  8. package/dist/rules/index.d.ts.map +1 -0
  9. package/dist/rules/index.js +11 -0
  10. package/dist/rules/index.js.map +1 -0
  11. package/dist/rules/no-deprecated-table-parts.d.ts +17 -0
  12. package/dist/rules/no-deprecated-table-parts.d.ts.map +1 -0
  13. package/dist/rules/no-deprecated-table-parts.js +92 -0
  14. package/dist/rules/no-deprecated-table-parts.js.map +1 -0
  15. package/dist/rules/no-raw-design-values.d.ts +20 -0
  16. package/dist/rules/no-raw-design-values.d.ts.map +1 -0
  17. package/dist/rules/no-raw-design-values.js +178 -0
  18. package/dist/rules/no-raw-design-values.js.map +1 -0
  19. package/dist/rules/no-raw-html-element.d.ts +23 -0
  20. package/dist/rules/no-raw-html-element.d.ts.map +1 -0
  21. package/dist/rules/no-raw-html-element.js +108 -0
  22. package/dist/rules/no-raw-html-element.js.map +1 -0
  23. package/dist/rules/no-tokens-barrel-import.d.ts +17 -0
  24. package/dist/rules/no-tokens-barrel-import.d.ts.map +1 -0
  25. package/dist/rules/no-tokens-barrel-import.js +0 -0
  26. package/dist/rules/no-tokens-barrel-import.js.map +1 -0
  27. package/dist/util/imports.d.ts +20 -0
  28. package/dist/util/imports.d.ts.map +1 -0
  29. package/dist/util/imports.js +74 -0
  30. package/dist/util/imports.js.map +1 -0
  31. package/dist/util/jsx.d.ts +14 -0
  32. package/dist/util/jsx.d.ts.map +1 -0
  33. package/dist/util/jsx.js +121 -0
  34. package/dist/util/jsx.js.map +1 -0
  35. package/dist/util/tokens.d.ts +20 -0
  36. package/dist/util/tokens.d.ts.map +1 -0
  37. package/dist/util/tokens.js +177 -0
  38. package/dist/util/tokens.js.map +1 -0
  39. package/package.json +57 -0
@@ -0,0 +1,108 @@
1
+ import { RSD_HTML_ELEMENTS, SVG_ONLY_TAGS } from '../util/jsx.js';
2
+ import { ensureNamedImport, isShadowed } from '../util/imports.js';
3
+ /**
4
+ * Forbid raw lowercase JSX intrinsics (<div>, <span>, …) in favor of
5
+ * react-strict-dom's html.* elements. SVG subtrees are exempt: RSD has no SVG
6
+ * primitives, so anything inside <svg> (tracked by depth) or in the SVG-only
7
+ * tag set stays raw.
8
+ *
9
+ * The rewrite is a *suggestion*, never an autofix: html.* elements accept a
10
+ * strict prop subset (no className, etc.), so a mechanical `--fix` over a
11
+ * whole tree would mint type errors wholesale. A suggestion keeps a human at
12
+ * each site.
13
+ */
14
+ export const noRawHtmlElement = {
15
+ defaultOptions: [{}],
16
+ meta: {
17
+ type: 'problem',
18
+ docs: {
19
+ description: 'Require react-strict-dom html.* elements instead of raw HTML JSX intrinsics',
20
+ },
21
+ hasSuggestions: true,
22
+ schema: [
23
+ {
24
+ type: 'object',
25
+ properties: {
26
+ allow: { type: 'array', items: { type: 'string' }, uniqueItems: true },
27
+ reportUnsupported: { type: 'boolean' },
28
+ htmlModule: { type: 'string' },
29
+ },
30
+ additionalProperties: false,
31
+ },
32
+ ],
33
+ messages: {
34
+ useHtml: 'Use <html.{{tag}}> from react-strict-dom instead of the raw <{{tag}}> element.',
35
+ noEquivalent: '<{{tag}}> has no react-strict-dom equivalent and is not portable. Compose it from html.* elements, or add it to this rule\'s "allow" option.',
36
+ suggestReplace: 'Replace with <html.{{tag}}>',
37
+ },
38
+ },
39
+ create(context) {
40
+ const options = context.options[0] ?? {};
41
+ const allow = new Set(options.allow ?? []);
42
+ const reportUnsupported = options.reportUnsupported ?? true;
43
+ const htmlModule = options.htmlModule ?? 'react-strict-dom';
44
+ const sourceCode = context.sourceCode;
45
+ let svgDepth = 0;
46
+ function tagOf(node) {
47
+ return node.name.type === 'JSXIdentifier' ? node.name.name : null;
48
+ }
49
+ return {
50
+ JSXElement(node) {
51
+ const tag = tagOf(node.openingElement);
52
+ if (tag === 'svg')
53
+ svgDepth++;
54
+ },
55
+ 'JSXElement:exit'(node) {
56
+ const tag = tagOf(node.openingElement);
57
+ if (tag === 'svg')
58
+ svgDepth--;
59
+ },
60
+ JSXOpeningElement(node) {
61
+ const tag = tagOf(node);
62
+ if (tag === null)
63
+ return; // member/namespaced names
64
+ const first = tag.charAt(0);
65
+ if (first !== first.toLowerCase())
66
+ return; // component
67
+ if (tag.includes('-'))
68
+ return; // custom element
69
+ if (svgDepth > 0)
70
+ return; // inside an <svg> subtree
71
+ if (SVG_ONLY_TAGS.has(tag))
72
+ return; // detached SVG fragment helpers
73
+ if (allow.has(tag))
74
+ return;
75
+ if (!RSD_HTML_ELEMENTS.has(tag)) {
76
+ if (reportUnsupported) {
77
+ context.report({ node: node.name, messageId: 'noEquivalent', data: { tag } });
78
+ }
79
+ return;
80
+ }
81
+ const shadowed = isShadowed(sourceCode.getScope(node), 'html', htmlModule);
82
+ context.report({
83
+ node: node.name,
84
+ messageId: 'useHtml',
85
+ data: { tag },
86
+ suggest: shadowed
87
+ ? []
88
+ : [
89
+ {
90
+ messageId: 'suggestReplace',
91
+ data: { tag },
92
+ fix(fixer) {
93
+ const { local, fixes } = ensureNamedImport(sourceCode, fixer, htmlModule, 'html');
94
+ const parent = node.parent;
95
+ const edits = [...fixes, fixer.replaceText(node.name, `${local}.${tag}`)];
96
+ if (parent.closingElement) {
97
+ edits.push(fixer.replaceText(parent.closingElement.name, `${local}.${tag}`));
98
+ }
99
+ return edits;
100
+ },
101
+ },
102
+ ],
103
+ });
104
+ },
105
+ };
106
+ },
107
+ };
108
+ //# sourceMappingURL=no-raw-html-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-raw-html-element.js","sourceRoot":"","sources":["../../src/rules/no-raw-html-element.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAA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AG,EAAC,EAAC,CAAC,CAAA;oBAC3E,CAAC;oBACD,OAAM;gBACR,CAAC;gBAED,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;gBAC1E,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,SAAS,EAAE,SAAS;oBACpB,IAAI,EAAE,EAAC,GAAG,EAAC;oBACX,OAAO,EAAE,QAAQ;wBACf,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC;4BACE;gCACE,SAAS,EAAE,gBAAgB;gCAC3B,IAAI,EAAE,EAAC,GAAG,EAAC;gCACX,GAAG,CAAC,KAAK;oCACP,MAAM,EAAC,KAAK,EAAE,KAAK,EAAC,GAAG,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;oCAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,MAA6B,CAAA;oCACjD,MAAM,KAAK,GAAG,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;oCACzE,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;wCAC1B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,CAAA;oCAC9E,CAAC;oCACD,OAAO,KAAK,CAAA;gCACd,CAAC;6BACF;yBACF;iBACN,CAAC,CAAA;YACJ,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ type MessageIds = 'barrelImport' | 'barrelNamespace' | 'barrelSideEffect' | 'unknownSpecifiers';
3
+ type Options = [
4
+ {
5
+ packages?: string[];
6
+ }?
7
+ ];
8
+ /**
9
+ * Forbid barrel imports from @duro-app/tokens — they break the StyleX babel
10
+ * plugin, which needs each css.defineVars module imported directly. The fix
11
+ * splits the import into the matching deep imports, preserving aliases and
12
+ * inline `type` specifiers. All-or-nothing: any unmapped specifier downgrades
13
+ * the report to fix-less (a partial rewrite could drop bindings).
14
+ */
15
+ export declare const noTokensBarrelImport: TSESLint.RuleModule<MessageIds, Options>;
16
+ export {};
17
+ //# sourceMappingURL=no-tokens-barrel-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-tokens-barrel-import.d.ts","sourceRoot":"","sources":["../../src/rules/no-tokens-barrel-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAW,MAAM,0BAA0B,CAAA;AAGhE,KAAK,UAAU,GAAG,cAAc,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AAC/F,KAAK,OAAO,GAAG;IACb;QACE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KACpB,CAAC;CACH,CAAA;AAQD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAqHzE,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-tokens-barrel-import.js","sourceRoot":"","sources":["../../src/rules/no-tokens-barrel-import.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AAelD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC5E,cAAc,EAAE,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,0EAA0E;SACxF;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAA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;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ export interface EnsureImportResult {
3
+ /** The local name the caller should reference (respects aliases). */
4
+ local: string;
5
+ /** Fixes that add the import when it is missing (empty when present). */
6
+ fixes: TSESLint.RuleFix[];
7
+ }
8
+ /**
9
+ * Is `name` bound to anything other than an import from `moduleName` in any
10
+ * scope enclosing `scope`? Used to bail out of fixes that would reference a
11
+ * shadowed binding.
12
+ */
13
+ export declare function isShadowed(scope: TSESLint.Scope.Scope | null, name: string, moduleName: string): boolean;
14
+ /**
15
+ * Ensure a named import for `importedName` from `moduleName` exists, returning
16
+ * the local name to reference plus the fixes that create/extend the import.
17
+ * Reuses an existing (possibly aliased) specifier when present.
18
+ */
19
+ export declare function ensureNamedImport(sourceCode: Readonly<TSESLint.SourceCode>, fixer: TSESLint.RuleFixer, moduleName: string, importedName: string): EnsureImportResult;
20
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/util/imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAW,MAAM,0BAA0B,CAAA;AAiBhE,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAA;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,EAClC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,OAAO,CAaT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzC,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,kBAAkB,CA6CpB"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Find how a module import is written in this file so inserted imports match
3
+ * its style (quote char, trailing semicolon). Falls back to the repo default
4
+ * (single quotes, no semicolon) when the file has no imports.
5
+ */
6
+ function importStyle(sourceCode) {
7
+ const first = sourceCode.ast.body.find((stmt) => stmt.type === 'ImportDeclaration');
8
+ if (!first)
9
+ return { quote: "'", semi: '' };
10
+ const raw = sourceCode.getText(first.source);
11
+ const text = sourceCode.getText(first);
12
+ return { quote: raw.startsWith('"') ? '"' : "'", semi: text.endsWith(';') ? ';' : '' };
13
+ }
14
+ /**
15
+ * Is `name` bound to anything other than an import from `moduleName` in any
16
+ * scope enclosing `scope`? Used to bail out of fixes that would reference a
17
+ * shadowed binding.
18
+ */
19
+ export function isShadowed(scope, name, moduleName) {
20
+ for (let s = scope; s; s = s.upper) {
21
+ const variable = s.variables.find((v) => v.name === name);
22
+ if (!variable)
23
+ continue;
24
+ const fromModule = variable.defs.every((def) => def.type === 'ImportBinding' &&
25
+ def.parent.type === 'ImportDeclaration' &&
26
+ def.parent.source.value === moduleName);
27
+ if (!fromModule || variable.defs.length === 0)
28
+ return true;
29
+ }
30
+ return false;
31
+ }
32
+ /**
33
+ * Ensure a named import for `importedName` from `moduleName` exists, returning
34
+ * the local name to reference plus the fixes that create/extend the import.
35
+ * Reuses an existing (possibly aliased) specifier when present.
36
+ */
37
+ export function ensureNamedImport(sourceCode, fixer, moduleName, importedName) {
38
+ const imports = sourceCode.ast.body.filter((stmt) => stmt.type === 'ImportDeclaration');
39
+ const fromModule = imports.filter((decl) => decl.source.value === moduleName && decl.importKind !== 'type');
40
+ for (const decl of fromModule) {
41
+ for (const spec of decl.specifiers) {
42
+ if (spec.type === 'ImportSpecifier' &&
43
+ spec.imported.type === 'Identifier' &&
44
+ spec.imported.name === importedName &&
45
+ spec.importKind !== 'type') {
46
+ return { local: spec.local.name, fixes: [] };
47
+ }
48
+ }
49
+ }
50
+ // Extend an existing value-import from the module when possible.
51
+ for (const decl of fromModule) {
52
+ const named = decl.specifiers.filter((spec) => spec.type === 'ImportSpecifier');
53
+ const last = named[named.length - 1];
54
+ if (last) {
55
+ return { local: importedName, fixes: [fixer.insertTextAfter(last, `, ${importedName}`)] };
56
+ }
57
+ const defaultSpec = decl.specifiers.find((spec) => spec.type === 'ImportDefaultSpecifier');
58
+ if (defaultSpec) {
59
+ return {
60
+ local: importedName,
61
+ fixes: [fixer.insertTextAfter(defaultSpec, `, {${importedName}}`)],
62
+ };
63
+ }
64
+ }
65
+ // Add a fresh import declaration.
66
+ const { quote, semi } = importStyle(sourceCode);
67
+ const statement = `import {${importedName}} from ${quote}${moduleName}${quote}${semi}`;
68
+ const lastImport = imports[imports.length - 1];
69
+ if (lastImport) {
70
+ return { local: importedName, fixes: [fixer.insertTextAfter(lastImport, `\n${statement}`)] };
71
+ }
72
+ return { local: importedName, fixes: [fixer.insertTextBeforeRange([0, 0], `${statement}\n`)] };
73
+ }
74
+ //# sourceMappingURL=imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/util/imports.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,SAAS,WAAW,CAAC,UAAyC;IAC5D,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CACpC,CAAC,IAAI,EAAsC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,mBAAmB,CAChF,CAAA;IACD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,CAAA;IACzC,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,EAAC,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,C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,EAAE,MAAM,YAAY,GAAG,CAAC,CAAC;aACnE,CAAA;QACH,CAAC;IACH,CAAC;IAED,kCAAkC;IAClC,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,WAAW,CAAC,UAAU,CAAC,CAAA;IAC7C,MAAM,SAAS,GAAG,WAAW,YAAY,UAAU,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,IAAI,EAAE,CAAA;IACtF,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC9C,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,EAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,SAAS,EAAE,CAAC,CAAC,EAAC,CAAA;IAC5F,CAAC;IACD,OAAO,EAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,IAAI,CAAC,CAAC,EAAC,CAAA;AAC9F,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The html.* elements react-strict-dom actually exports (0.0.55). Raw tags in
3
+ * this set can be suggested as `html.<tag>`; raw tags outside it have no RSD
4
+ * equivalent at all.
5
+ */
6
+ export declare const RSD_HTML_ELEMENTS: Set<string>;
7
+ /**
8
+ * SVG-only tags, skipped regardless of ancestry — icon helpers commonly return
9
+ * a bare <path> without the enclosing <svg> in the same function. Tags that
10
+ * exist in both namespaces (a, title, style, script, text…) are NOT in this
11
+ * set; those are handled by svg-depth tracking instead.
12
+ */
13
+ export declare const SVG_ONLY_TAGS: Set<string>;
14
+ //# sourceMappingURL=jsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../../src/util/jsx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAkD5B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,aAyDxB,CAAA"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * The html.* elements react-strict-dom actually exports (0.0.55). Raw tags in
3
+ * this set can be suggested as `html.<tag>`; raw tags outside it have no RSD
4
+ * equivalent at all.
5
+ */
6
+ export const RSD_HTML_ELEMENTS = new Set([
7
+ 'a',
8
+ 'article',
9
+ 'aside',
10
+ 'b',
11
+ 'bdi',
12
+ 'bdo',
13
+ 'blockquote',
14
+ 'br',
15
+ 'button',
16
+ 'code',
17
+ 'del',
18
+ 'div',
19
+ 'em',
20
+ 'fieldset',
21
+ 'footer',
22
+ 'form',
23
+ 'h1',
24
+ 'h2',
25
+ 'h3',
26
+ 'h4',
27
+ 'h5',
28
+ 'h6',
29
+ 'header',
30
+ 'hr',
31
+ 'i',
32
+ 'img',
33
+ 'input',
34
+ 'ins',
35
+ 'kbd',
36
+ 'label',
37
+ 'li',
38
+ 'main',
39
+ 'mark',
40
+ 'nav',
41
+ 'ol',
42
+ 'optgroup',
43
+ 'option',
44
+ 'p',
45
+ 'pre',
46
+ 's',
47
+ 'section',
48
+ 'select',
49
+ 'span',
50
+ 'strong',
51
+ 'sub',
52
+ 'sup',
53
+ 'textarea',
54
+ 'u',
55
+ 'ul',
56
+ ]);
57
+ /**
58
+ * SVG-only tags, skipped regardless of ancestry — icon helpers commonly return
59
+ * a bare <path> without the enclosing <svg> in the same function. Tags that
60
+ * exist in both namespaces (a, title, style, script, text…) are NOT in this
61
+ * set; those are handled by svg-depth tracking instead.
62
+ */
63
+ export const SVG_ONLY_TAGS = new Set([
64
+ 'svg',
65
+ 'path',
66
+ 'circle',
67
+ 'ellipse',
68
+ 'rect',
69
+ 'line',
70
+ 'polyline',
71
+ 'polygon',
72
+ 'g',
73
+ 'defs',
74
+ 'mask',
75
+ 'clipPath',
76
+ 'linearGradient',
77
+ 'radialGradient',
78
+ 'stop',
79
+ 'use',
80
+ 'symbol',
81
+ 'marker',
82
+ 'pattern',
83
+ 'foreignObject',
84
+ 'tspan',
85
+ 'textPath',
86
+ 'desc',
87
+ 'filter',
88
+ 'animate',
89
+ 'animateMotion',
90
+ 'animateTransform',
91
+ 'set',
92
+ 'view',
93
+ 'switch',
94
+ 'metadata',
95
+ 'feBlend',
96
+ 'feColorMatrix',
97
+ 'feComponentTransfer',
98
+ 'feComposite',
99
+ 'feConvolveMatrix',
100
+ 'feDiffuseLighting',
101
+ 'feDisplacementMap',
102
+ 'feDistantLight',
103
+ 'feDropShadow',
104
+ 'feFlood',
105
+ 'feFuncA',
106
+ 'feFuncB',
107
+ 'feFuncG',
108
+ 'feFuncR',
109
+ 'feGaussianBlur',
110
+ 'feImage',
111
+ 'feMerge',
112
+ 'feMergeNode',
113
+ 'feMorphology',
114
+ 'feOffset',
115
+ 'fePointLight',
116
+ 'feSpecularLighting',
117
+ 'feSpotLight',
118
+ 'feTile',
119
+ 'feTurbulence',
120
+ ]);
121
+ //# sourceMappingURL=jsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx.js","sourceRoot":"","sources":["../../src/util/jsx.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,GAAG;IACH,SAAS;IACT,OAAO;IACP,GAAG;IACH,KAAK;IACL,KAAK;IACL,YAAY;IACZ,IAAI;IACJ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,GAAG;IACH,KAAK;IACL,OAAO;IACP,KAAK;IACL,KAAK;IACL,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,IAAI;IACJ,UAAU;IACV,QAAQ;IACR,GAAG;IACH,KAAK;IACL,GAAG;IACH,SAAS;IACT,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,UAAU;IACV,GAAG;IACH,IAAI;CACL,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IACnC,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,GAAG;IACH,MAAM;IACN,MAAM;IACN,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,eAAe;IACf,OAAO;IACP,UAAU;IACV,MAAM;IACN,QAAQ;IACR,SAAS;IACT,eAAe;IACf,kBAAkB;IAClB,KAAK;IACL,MAAM;IACN,QAAQ;IACR,UAAU;IACV,SAAS;IACT,eAAe;IACf,qBAAqB;IACrB,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;IACd,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,gBAAgB;IAChB,SAAS;IACT,SAAS;IACT,aAAa;IACb,cAAc;IACd,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,aAAa;IACb,QAAQ;IACR,cAAc;CACf,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ /** Barrel specifier → deep-import path, keyed by the *imported* name. */
2
+ export declare const TOKEN_DEEP_PATHS: Record<string, string>;
3
+ /** px value → spacing token name. */
4
+ export declare const SPACING_TOKENS_BY_PX: Record<number, string>;
5
+ /** px value → radius token name. */
6
+ export declare const RADII_TOKENS_BY_PX: Record<number, string>;
7
+ /**
8
+ * Color value (lowercased) → semantic color token name. Built from the dark,
9
+ * light, and high-contrast palettes in that order, first entry wins — so a hex
10
+ * shared across tokens/themes suggests the token it most likely stands for
11
+ * (e.g. #6aaffc is both `accent` and `info` in the dark palette → `accent`).
12
+ */
13
+ export declare const COLOR_TOKENS: Record<string, string>;
14
+ /** Expand #abc / #abcd to the 6/8-digit form, lowercased. */
15
+ export declare function normalizeHex(hex: string): string;
16
+ /** Style properties whose numeric values map to the spacing scale. */
17
+ export declare const SPACING_PROPERTIES: Set<string>;
18
+ /** Style properties whose numeric values map to the radius scale. */
19
+ export declare const RADII_PROPERTIES: Set<string>;
20
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/util/tokens.ts"],"names":[],"mappings":"AAKA,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmCnD,CAAA;AAED,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASvD,CAAA;AAED,oCAAoC;AACpC,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMrD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4D/C,CAAA;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,aA0B7B,CAAA;AAEF,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,aAU3B,CAAA"}
@@ -0,0 +1,177 @@
1
+ // Token data mirrored from @duro-app/tokens. The published plugin stays
2
+ // dependency-free, so these tables are literals; the drift test in
3
+ // test/token-drift.test.ts rebuilds each one from @duro-app/tokens (a
4
+ // workspace devDependency) with the same construction and fails on divergence.
5
+ /** Barrel specifier → deep-import path, keyed by the *imported* name. */
6
+ export const TOKEN_DEEP_PATHS = {
7
+ colors: 'tokens/colors.css',
8
+ spacing: 'tokens/spacing.css',
9
+ radii: 'tokens/spacing.css',
10
+ layoutSpacing: 'tokens/layout-spacing.css',
11
+ typography: 'tokens/typography.css',
12
+ typeScale: 'tokens/typography.css',
13
+ typePresets: 'tokens/type-presets.css',
14
+ shadows: 'tokens/shadows.css',
15
+ duration: 'tokens/motion.css',
16
+ easing: 'tokens/motion.css',
17
+ breakpoints: 'tokens/breakpoints.css',
18
+ breakpointsPx: 'tokens/breakpoints.css',
19
+ Breakpoint: 'tokens/breakpoints.css',
20
+ lightTheme: 'themes/light.css',
21
+ lightShadows: 'themes/light.css',
22
+ highContrastTheme: 'themes/high-contrast.css',
23
+ highContrastShadows: 'themes/high-contrast.css',
24
+ SPACING_KEYS: 'keys',
25
+ SPACING_PX: 'keys',
26
+ SpacingToken: 'keys',
27
+ RADIUS_KEYS: 'keys',
28
+ RADII_PX: 'keys',
29
+ RadiusToken: 'keys',
30
+ SHADOW_KEYS: 'keys',
31
+ ShadowToken: 'keys',
32
+ DURATION_MS: 'keys',
33
+ DurationToken: 'keys',
34
+ ICON_SIZES: 'keys',
35
+ IconSize: 'keys',
36
+ ColorToken: 'keys',
37
+ RawColors: 'raw',
38
+ darkColors: 'raw',
39
+ lightColors: 'raw',
40
+ highContrastColors: 'raw',
41
+ };
42
+ /** px value → spacing token name. */
43
+ export const SPACING_TOKENS_BY_PX = {
44
+ 4: 'xs',
45
+ 8: 'sm',
46
+ 12: 'ms',
47
+ 16: 'md',
48
+ 24: 'lg',
49
+ 32: 'xl',
50
+ 48: 'xxl',
51
+ 64: 'xxxl',
52
+ };
53
+ /** px value → radius token name. */
54
+ export const RADII_TOKENS_BY_PX = {
55
+ 4: 'xs',
56
+ 8: 'sm',
57
+ 12: 'md',
58
+ 16: 'lg',
59
+ 9999: 'full',
60
+ };
61
+ /**
62
+ * Color value (lowercased) → semantic color token name. Built from the dark,
63
+ * light, and high-contrast palettes in that order, first entry wins — so a hex
64
+ * shared across tokens/themes suggests the token it most likely stands for
65
+ * (e.g. #6aaffc is both `accent` and `info` in the dark palette → `accent`).
66
+ */
67
+ export const COLOR_TOKENS = {
68
+ '#0f0f0f': 'bg',
69
+ '#1a1a1a': 'bgCard',
70
+ '#242424': 'bgCardHover',
71
+ '#e5e5e5': 'text',
72
+ '#b0b0b0': 'textMuted',
73
+ '#6aaffc': 'accent',
74
+ '#93c5fd': 'accentHover',
75
+ '#000000': 'accentContrast',
76
+ '#333333': 'border',
77
+ '#f87171': 'error',
78
+ '#fca5a5': 'errorHover',
79
+ 'rgba(248, 113, 113, 0.1)': 'errorBg',
80
+ 'rgba(248, 113, 113, 0.3)': 'errorBorder',
81
+ '#22c55e': 'success',
82
+ 'rgba(34, 197, 94, 0.1)': 'successBg',
83
+ 'rgba(34, 197, 94, 0.3)': 'successBorder',
84
+ '#86efac': 'successText',
85
+ '#fbbf24': 'warning',
86
+ 'rgba(251, 191, 36, 0.1)': 'warningBg',
87
+ 'rgba(251, 191, 36, 0.3)': 'warningBorder',
88
+ '#fde68a': 'warningText',
89
+ 'rgba(106, 175, 252, 0.1)': 'infoBg',
90
+ 'rgba(106, 175, 252, 0.3)': 'infoBorder',
91
+ '#ffffff': 'bg',
92
+ '#f5f5f5': 'bgCard',
93
+ '#ebebeb': 'bgCardHover',
94
+ '#4a4a4a': 'textMuted',
95
+ '#1e40af': 'accent',
96
+ '#1a3799': 'accentHover',
97
+ '#d4d4d4': 'border',
98
+ '#991b1b': 'error',
99
+ '#7f1d1d': 'errorHover',
100
+ 'rgba(153, 27, 27, 0.08)': 'errorBg',
101
+ 'rgba(153, 27, 27, 0.3)': 'errorBorder',
102
+ '#166534': 'success',
103
+ 'rgba(22, 101, 52, 0.08)': 'successBg',
104
+ 'rgba(22, 101, 52, 0.3)': 'successBorder',
105
+ '#14532d': 'successText',
106
+ '#92400e': 'warning',
107
+ 'rgba(146, 64, 14, 0.08)': 'warningBg',
108
+ 'rgba(146, 64, 14, 0.3)': 'warningBorder',
109
+ '#78350f': 'warningText',
110
+ 'rgba(30, 64, 175, 0.08)': 'infoBg',
111
+ 'rgba(30, 64, 175, 0.3)': 'infoBorder',
112
+ '#111111': 'bgCard',
113
+ '#60a5fa': 'accent',
114
+ '#555555': 'border',
115
+ 'rgba(248, 113, 113, 0.15)': 'errorBg',
116
+ 'rgba(248, 113, 113, 0.5)': 'errorBorder',
117
+ '#4ade80': 'success',
118
+ 'rgba(74, 222, 128, 0.15)': 'successBg',
119
+ 'rgba(74, 222, 128, 0.5)': 'successBorder',
120
+ '#fcd34d': 'warning',
121
+ 'rgba(252, 211, 77, 0.15)': 'warningBg',
122
+ 'rgba(252, 211, 77, 0.5)': 'warningBorder',
123
+ '#fef08a': 'warningText',
124
+ 'rgba(96, 165, 250, 0.15)': 'infoBg',
125
+ 'rgba(96, 165, 250, 0.5)': 'infoBorder',
126
+ '#bfdbfe': 'infoText',
127
+ };
128
+ /** Expand #abc / #abcd to the 6/8-digit form, lowercased. */
129
+ export function normalizeHex(hex) {
130
+ const lower = hex.toLowerCase();
131
+ const digits = lower.slice(1);
132
+ if (digits.length === 3 || digits.length === 4) {
133
+ return '#' + [...digits].map((d) => d + d).join('');
134
+ }
135
+ return lower;
136
+ }
137
+ /** Style properties whose numeric values map to the spacing scale. */
138
+ export const SPACING_PROPERTIES = new Set([
139
+ 'padding',
140
+ 'paddingTop',
141
+ 'paddingRight',
142
+ 'paddingBottom',
143
+ 'paddingLeft',
144
+ 'paddingBlock',
145
+ 'paddingBlockStart',
146
+ 'paddingBlockEnd',
147
+ 'paddingInline',
148
+ 'paddingInlineStart',
149
+ 'paddingInlineEnd',
150
+ 'margin',
151
+ 'marginTop',
152
+ 'marginRight',
153
+ 'marginBottom',
154
+ 'marginLeft',
155
+ 'marginBlock',
156
+ 'marginBlockStart',
157
+ 'marginBlockEnd',
158
+ 'marginInline',
159
+ 'marginInlineStart',
160
+ 'marginInlineEnd',
161
+ 'gap',
162
+ 'rowGap',
163
+ 'columnGap',
164
+ ]);
165
+ /** Style properties whose numeric values map to the radius scale. */
166
+ export const RADII_PROPERTIES = new Set([
167
+ 'borderRadius',
168
+ 'borderTopLeftRadius',
169
+ 'borderTopRightRadius',
170
+ 'borderBottomLeftRadius',
171
+ 'borderBottomRightRadius',
172
+ 'borderStartStartRadius',
173
+ 'borderStartEndRadius',
174
+ 'borderEndStartRadius',
175
+ 'borderEndEndRadius',
176
+ ]);
177
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/util/tokens.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,mEAAmE;AACnE,sEAAsE;AACtE,+EAA+E;AAE/E,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,MAAM,EAAE,mBAAmB;IAC3B,OAAO,EAAE,oBAAoB;IAC7B,KAAK,EAAE,oBAAoB;IAC3B,aAAa,EAAE,2BAA2B;IAC1C,UAAU,EAAE,uBAAuB;IACnC,SAAS,EAAE,uBAAuB;IAClC,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,mBAAmB;IAC7B,MAAM,EAAE,mBAAmB;IAC3B,WAAW,EAAE,wBAAwB;IACrC,aAAa,EAAE,wBAAwB;IACvC,UAAU,EAAE,wBAAwB;IACpC,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,kBAAkB;IAChC,iBAAiB,EAAE,0BAA0B;IAC7C,mBAAmB,EAAE,0BAA0B;IAC/C,YAAY,EAAE,MAAM;IACpB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,MAAM;IACnB,aAAa,EAAE,MAAM;IACrB,UAAU,EAAE,MAAM;IAClB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB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