@kutur-kit/oxc 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (139) hide show
  1. package/README.md +75 -27
  2. package/dist/app.d.ts +16 -0
  3. package/dist/app.d.ts.map +1 -0
  4. package/dist/app.js +17 -0
  5. package/dist/app.js.map +1 -0
  6. package/dist/base.d.ts.map +1 -1
  7. package/dist/base.js +5 -1
  8. package/dist/base.js.map +1 -1
  9. package/dist/effect-ui-stylex/class.d.ts +2 -0
  10. package/dist/effect-ui-stylex/class.d.ts.map +1 -0
  11. package/dist/effect-ui-stylex/class.js +109 -0
  12. package/dist/effect-ui-stylex/class.js.map +1 -0
  13. package/dist/effect-ui-stylex/components.d.ts +30 -0
  14. package/dist/effect-ui-stylex/components.d.ts.map +1 -0
  15. package/dist/effect-ui-stylex/components.js +175 -0
  16. package/dist/effect-ui-stylex/components.js.map +1 -0
  17. package/dist/effect-ui-stylex/condition-key.d.ts.map +1 -0
  18. package/dist/{foldkit-stylex → effect-ui-stylex}/condition-key.js +7 -41
  19. package/dist/effect-ui-stylex/condition-key.js.map +1 -0
  20. package/dist/effect-ui-stylex/hover-gate.d.ts.map +1 -0
  21. package/dist/effect-ui-stylex/hover-gate.js.map +1 -0
  22. package/dist/effect-ui-stylex/internal-import.d.ts +2 -0
  23. package/dist/effect-ui-stylex/internal-import.d.ts.map +1 -0
  24. package/dist/effect-ui-stylex/internal-import.js +29 -0
  25. package/dist/effect-ui-stylex/internal-import.js.map +1 -0
  26. package/dist/effect-ui-stylex/layers.d.ts +14 -0
  27. package/dist/effect-ui-stylex/layers.d.ts.map +1 -0
  28. package/dist/effect-ui-stylex/layers.js +118 -0
  29. package/dist/effect-ui-stylex/layers.js.map +1 -0
  30. package/dist/effect-ui-stylex/look-level.d.ts +2 -0
  31. package/dist/effect-ui-stylex/look-level.d.ts.map +1 -0
  32. package/dist/effect-ui-stylex/look-level.js +83 -0
  33. package/dist/effect-ui-stylex/look-level.js.map +1 -0
  34. package/dist/effect-ui-stylex/modules.d.ts +36 -0
  35. package/dist/effect-ui-stylex/modules.d.ts.map +1 -0
  36. package/dist/effect-ui-stylex/modules.js +97 -0
  37. package/dist/effect-ui-stylex/modules.js.map +1 -0
  38. package/dist/effect-ui-stylex/parts.d.ts +17 -0
  39. package/dist/effect-ui-stylex/parts.d.ts.map +1 -0
  40. package/dist/effect-ui-stylex/parts.js +66 -0
  41. package/dist/effect-ui-stylex/parts.js.map +1 -0
  42. package/dist/effect-ui-stylex/raw-part.d.ts +2 -0
  43. package/dist/effect-ui-stylex/raw-part.d.ts.map +1 -0
  44. package/dist/effect-ui-stylex/raw-part.js +90 -0
  45. package/dist/effect-ui-stylex/raw-part.js.map +1 -0
  46. package/dist/effect-ui-stylex/state-attributes.d.ts +8 -0
  47. package/dist/effect-ui-stylex/state-attributes.d.ts.map +1 -0
  48. package/dist/effect-ui-stylex/state-attributes.js +141 -0
  49. package/dist/effect-ui-stylex/state-attributes.js.map +1 -0
  50. package/dist/effect-ui-stylex/state-key.d.ts +2 -0
  51. package/dist/effect-ui-stylex/state-key.d.ts.map +1 -0
  52. package/dist/effect-ui-stylex/state-key.js +103 -0
  53. package/dist/effect-ui-stylex/state-key.js.map +1 -0
  54. package/dist/effect-ui-stylex/subpath.d.ts +10 -0
  55. package/dist/effect-ui-stylex/subpath.d.ts.map +1 -0
  56. package/dist/effect-ui-stylex/subpath.js +53 -0
  57. package/dist/effect-ui-stylex/subpath.js.map +1 -0
  58. package/dist/effect-ui-stylex.d.ts +23 -0
  59. package/dist/effect-ui-stylex.d.ts.map +1 -0
  60. package/dist/{foldkit-stylex.js → effect-ui-stylex.js} +10 -9
  61. package/dist/effect-ui-stylex.js.map +1 -0
  62. package/dist/{foldkit-stylex.json → effect-ui-stylex.json} +7 -6
  63. package/dist/plugin.d.ts.map +1 -1
  64. package/dist/plugin.js +18 -12
  65. package/dist/plugin.js.map +1 -1
  66. package/dist/rules/imports.d.ts +5 -6
  67. package/dist/rules/imports.d.ts.map +1 -1
  68. package/dist/rules/imports.js +18 -14
  69. package/dist/rules/imports.js.map +1 -1
  70. package/dist/rules/module-sources.d.ts +33 -0
  71. package/dist/rules/module-sources.d.ts.map +1 -0
  72. package/dist/rules/module-sources.js +139 -0
  73. package/dist/rules/module-sources.js.map +1 -0
  74. package/dist/rules/no-suppression-directives.js +3 -3
  75. package/dist/rules/no-suppression-directives.js.map +1 -1
  76. package/dist/rules/scope.d.ts +3 -1
  77. package/dist/rules/scope.d.ts.map +1 -1
  78. package/dist/rules/scope.js.map +1 -1
  79. package/dist/vendor/anti-slop/rules/no-runtime-typeof.js +1 -1
  80. package/dist/vendor/anti-slop/rules/no-runtime-typeof.js.map +1 -1
  81. package/package.json +21 -17
  82. package/src/app.ts +19 -0
  83. package/src/base.ts +5 -1
  84. package/src/effect-ui-stylex/class.ts +140 -0
  85. package/src/effect-ui-stylex/components.ts +184 -0
  86. package/src/{foldkit-stylex → effect-ui-stylex}/condition-key.ts +6 -52
  87. package/src/effect-ui-stylex/internal-import.ts +32 -0
  88. package/src/effect-ui-stylex/layers.ts +161 -0
  89. package/src/effect-ui-stylex/look-level.ts +99 -0
  90. package/src/effect-ui-stylex/modules.ts +115 -0
  91. package/src/effect-ui-stylex/parts.ts +89 -0
  92. package/src/effect-ui-stylex/raw-part.ts +110 -0
  93. package/src/effect-ui-stylex/state-attributes.ts +140 -0
  94. package/src/effect-ui-stylex/state-key.ts +147 -0
  95. package/src/effect-ui-stylex/subpath.ts +65 -0
  96. package/src/{foldkit-stylex.ts → effect-ui-stylex.ts} +9 -8
  97. package/src/plugin.ts +18 -12
  98. package/src/rules/imports.ts +22 -15
  99. package/src/rules/module-sources.ts +179 -0
  100. package/src/rules/no-suppression-directives.ts +3 -3
  101. package/src/rules/scope.ts +1 -1
  102. package/src/vendor/anti-slop/UPSTREAM.md +2 -0
  103. package/src/vendor/anti-slop/rules/no-runtime-typeof.ts +1 -1
  104. package/dist/foldkit-stylex/attributes.d.ts +0 -2
  105. package/dist/foldkit-stylex/attributes.d.ts.map +0 -1
  106. package/dist/foldkit-stylex/attributes.js +0 -191
  107. package/dist/foldkit-stylex/attributes.js.map +0 -1
  108. package/dist/foldkit-stylex/components.d.ts +0 -12
  109. package/dist/foldkit-stylex/components.d.ts.map +0 -1
  110. package/dist/foldkit-stylex/components.js +0 -41
  111. package/dist/foldkit-stylex/components.js.map +0 -1
  112. package/dist/foldkit-stylex/condition-key.d.ts.map +0 -1
  113. package/dist/foldkit-stylex/condition-key.js.map +0 -1
  114. package/dist/foldkit-stylex/hover-gate.d.ts.map +0 -1
  115. package/dist/foldkit-stylex/hover-gate.js.map +0 -1
  116. package/dist/foldkit-stylex/styles.d.ts +0 -2
  117. package/dist/foldkit-stylex/styles.d.ts.map +0 -1
  118. package/dist/foldkit-stylex/styles.js +0 -131
  119. package/dist/foldkit-stylex/styles.js.map +0 -1
  120. package/dist/foldkit-stylex/unstyled-view.d.ts +0 -2
  121. package/dist/foldkit-stylex/unstyled-view.d.ts.map +0 -1
  122. package/dist/foldkit-stylex/unstyled-view.js +0 -94
  123. package/dist/foldkit-stylex/unstyled-view.js.map +0 -1
  124. package/dist/foldkit-stylex/vite.d.ts +0 -2
  125. package/dist/foldkit-stylex/vite.d.ts.map +0 -1
  126. package/dist/foldkit-stylex/vite.js +0 -26
  127. package/dist/foldkit-stylex/vite.js.map +0 -1
  128. package/dist/foldkit-stylex.d.ts +0 -22
  129. package/dist/foldkit-stylex.d.ts.map +0 -1
  130. package/dist/foldkit-stylex.js.map +0 -1
  131. package/src/foldkit-stylex/attributes.ts +0 -282
  132. package/src/foldkit-stylex/components.ts +0 -41
  133. package/src/foldkit-stylex/styles.ts +0 -170
  134. package/src/foldkit-stylex/unstyled-view.ts +0 -121
  135. package/src/foldkit-stylex/vite.ts +0 -29
  136. /package/dist/{foldkit-stylex → effect-ui-stylex}/condition-key.d.ts +0 -0
  137. /package/dist/{foldkit-stylex → effect-ui-stylex}/hover-gate.d.ts +0 -0
  138. /package/dist/{foldkit-stylex → effect-ui-stylex}/hover-gate.js +0 -0
  139. /package/src/{foldkit-stylex → effect-ui-stylex}/hover-gate.ts +0 -0
@@ -0,0 +1,66 @@
1
+ import { keyOf } from "../rules/imports.js";
2
+ import { variableOf } from "../rules/scope.js";
3
+ /**
4
+ * The call that hands `fn` a component's parts: `fn` is the `view` of the options the component
5
+ * takes second, as in `Dialog(h, { view: (dialog) => … })`. A component's own
6
+ * `view: (h, model) => …` is in the one argument of `make`, so it is not one.
7
+ */
8
+ const partsCallOf = (fn) => {
9
+ const property = fn.parent;
10
+ if (property?.type !== "Property" || property.value !== fn || keyOf(property) !== "view") {
11
+ return undefined;
12
+ }
13
+ const options = property.parent;
14
+ const call = options.parent;
15
+ return options.type === "ObjectExpression" &&
16
+ call?.type === "CallExpression" &&
17
+ call.arguments[1] === options
18
+ ? call
19
+ : undefined;
20
+ };
21
+ /**
22
+ * The component call whose `view` gets `node` as its parts object: `Dialog(h, { … })` for `dialog`
23
+ * in `view: (dialog) => dialog.trigger(h.button)`. `undefined` for anything else, a parts object
24
+ * that reached a helper function as its parameter included.
25
+ */
26
+ const ownerOf = (sourceCode, node) => {
27
+ if (node.type !== "Identifier")
28
+ return undefined;
29
+ for (const { type, node: fn } of variableOf(sourceCode, node)?.defs ?? []) {
30
+ if (type === "Parameter")
31
+ return partsCallOf(fn);
32
+ }
33
+ return undefined;
34
+ };
35
+ /**
36
+ * The part a call applies, with the call that draws the part's component: `trigger` and
37
+ * `Dialog(h, { … })` for `dialog.trigger(h.button)` in that call's `view`.
38
+ */
39
+ export const partOf = (sourceCode, call) => {
40
+ const { callee } = call;
41
+ if (callee.type !== "MemberExpression" || callee.computed)
42
+ return undefined;
43
+ const owner = ownerOf(sourceCode, callee.object);
44
+ return owner === undefined || callee.property.type !== "Identifier"
45
+ ? undefined
46
+ : { name: callee.property.name, owner };
47
+ };
48
+ /** The `element` an options object names, as in `tabs.tab({ element: h.button, value })`. */
49
+ const elementIn = (options) => options.properties.find((property) => property.type === "Property" && keyOf(property) === "element");
50
+ /**
51
+ * The builder a call draws its element on, when the call is a part or a view function: the
52
+ * argument of `dialog.trigger(h.button)`, or the `element` of `tabs.tab({ element: h.button })`
53
+ * and of `Save(h, { element: h.button })`. A part's result is that builder again, so what is
54
+ * chained on the two reaches one element.
55
+ */
56
+ export const elementOf = (sourceCode, call) => {
57
+ const [first, second] = call.arguments;
58
+ const part = partOf(sourceCode, call);
59
+ const options = part === undefined ? second : first;
60
+ if (options?.type === "ObjectExpression") {
61
+ const element = elementIn(options);
62
+ return element?.type === "Property" ? element.value : undefined;
63
+ }
64
+ return part === undefined || first?.type === "SpreadElement" ? undefined : first;
65
+ };
66
+ //# sourceMappingURL=parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.js","sources":["../../src/effect-ui-stylex/parts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,GAAG,CAAC,EAAe,EAAqC,EAAE;IACzE,MAAM,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC;IAE3B,IAAI,QAAQ,EAAE,IAAI,KAAK,UAAU,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,MAAM,EAAE,CAAC;QACzF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC;IAChC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAE5B,OAAO,OAAO,CAAC,IAAI,KAAK,kBAAkB;QACxC,IAAI,EAAE,IAAI,KAAK,gBAAgB;QAC/B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,OAAO;QAC7B,CAAC,CAAC,IAAI;QACN,CAAC,C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MAAM,SAAS,GAAG,CACvB,UAAsB,EACtB,IAA2B,EACF,EAAE;IAC3B,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IACvC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;IAEpD,IAAI,OAAO,EAAE,IAAI,KAAK,kBAAkB,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,OAAO,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;AACnF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const rawPart: import("@oxlint/plugins").Rule;
2
+ //# sourceMappingURL=raw-part.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-part.d.ts","sources":["../../src/effect-ui-stylex/raw-part.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,OAAO,gCA4FlB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { importsOf } from "../rules/imports.js";
3
+ import { variableOf } from "../rules/scope.js";
4
+ import { drawnFunction, drawnOf, drawnParts, libraryExportOf } from "./components.js";
5
+ import { elementOf, partOf } from "./parts.js";
6
+ // The parts that are behaviour alone where the library has no function for them: they take any
7
+ // drawn button.
8
+ const pressable = new Set(["trigger", "close"]);
9
+ // A part of that name that is no button: a context menu opens over its trigger, which is any
10
+ // area of the page.
11
+ const areas = new Set(["ContextMenu.trigger"]);
12
+ export const rawPart = defineRule({
13
+ meta: {
14
+ type: "problem",
15
+ docs: {
16
+ description: "Disallow a part of a drawn component on a bare element where a drawn function exists.",
17
+ },
18
+ schema: [],
19
+ messages: {
20
+ drawn: "Draw this part with {{drawn}}(h, {{parts}}) from {{module}}, and chain its children on the result. On a bare element {{parts}}.{{part}}(...) has none of the component's look, and none of the CSS the part needs to work.",
21
+ button: "Give {{parts}}.{{part}}(...) a drawn button, as {{parts}}.{{part}}(Button(h)). The part is behaviour alone, so a bare element stays unstyled.",
22
+ },
23
+ },
24
+ createOnce(context) {
25
+ let imports = new Map();
26
+ const isParameter = (node) => node.type === "Identifier" &&
27
+ (variableOf(context.sourceCode, node)?.defs ?? []).some(({ type }) => type === "Parameter");
28
+ // Whether a part's element is a bare builder of the view's `h`, such as `h.div`,
29
+ // `h.div.attrs(...)` or `h.button.key(id)`, under any other part applied to it. An element
30
+ // that a drawn function or the app's own function made, or a variable holds, is not one.
31
+ const isBare = (node) => {
32
+ if (node === undefined)
33
+ return false;
34
+ if (node.type === "MemberExpression")
35
+ return isParameter(node.object);
36
+ if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression")
37
+ return false;
38
+ const { object } = node.callee;
39
+ if (object.type !== "Identifier")
40
+ return isBare(object);
41
+ // Another component's part around the element, as `tooltip.trigger(h.button)`.
42
+ if (partOf(context.sourceCode, node) !== undefined) {
43
+ return isBare(elementOf(context.sourceCode, node));
44
+ }
45
+ // `h.div(child)`.
46
+ return isParameter(object);
47
+ };
48
+ return {
49
+ Program(program) {
50
+ imports = importsOf(program);
51
+ },
52
+ CallExpression(node) {
53
+ const part = partOf(context.sourceCode, node);
54
+ if (part === undefined || node.callee.type !== "MemberExpression")
55
+ return;
56
+ const component = libraryExportOf(part.owner.callee, imports);
57
+ const drawn = component === undefined ? undefined : drawnParts.get(component.name);
58
+ if (component === undefined || drawn === undefined)
59
+ return;
60
+ const element = elementOf(context.sourceCode, node);
61
+ if (element === undefined ||
62
+ (element.type === "CallExpression" && drawnOf(element.callee, imports) !== undefined) ||
63
+ !isBare(element)) {
64
+ return;
65
+ }
66
+ const parts = node.callee.object.type === "Identifier" ? node.callee.object.name : "parts";
67
+ if (drawn.includes(part.name)) {
68
+ context.report({
69
+ node: node.callee.property,
70
+ messageId: "drawn",
71
+ data: {
72
+ drawn: drawnFunction(component.name, part.name),
73
+ module: component.module,
74
+ part: part.name,
75
+ parts,
76
+ },
77
+ });
78
+ }
79
+ else if (pressable.has(part.name) && !areas.has(`${component.name}.${part.name}`)) {
80
+ context.report({
81
+ node: node.callee.property,
82
+ messageId: "button",
83
+ data: { part: part.name, parts },
84
+ });
85
+ }
86
+ },
87
+ };
88
+ },
89
+ });
90
+ //# sourceMappingURL=raw-part.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw-part.js","sources":["../../src/effect-ui-stylex/raw-part.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAgB,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE/C,+FAA+F;AAC/F,gBAAgB;AAChB,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAErE,6FAA6F;AAC7F,oBAAoB;AACpB,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,uFAAuF;SAC1F;QACD,MAAM,EAAE,EAAE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AO;wBAClB,IAAI,EAAE;4BACJ,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;4BAC/C,MAAM,EAAE,SAAS,CAAC,MAAM;4BACxB,IAAI,EAAE,IAAI,CAAC,IAAI;4BACf,KAAK;yBACN;qBACF,CAAC,CAAC;gBACL,CAAC;qBAAM,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;oBACpF,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;wBAC1B,SAAS,EAAE,QAAQ;wBACnB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;qBACjC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The data attributes effect/ui/kit writes, without `data-`: every `data-*` name in the
3
+ * JavaScript it ships. `effect-ui-state-key` reports a key that selects another. A test reads the
4
+ * list again from the installed effect, so replace it with the one the test prints when a
5
+ * release adds or drops a name.
6
+ */
7
+ export declare const stateAttributes: ReadonlyArray<string>;
8
+ //# sourceMappingURL=state-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-attributes.d.ts","sources":["../../src/effect-ui-stylex/state-attributes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,MAAM,CAqIjD,CAAC"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * The data attributes effect/ui/kit writes, without `data-`: every `data-*` name in the
3
+ * JavaScript it ships. `effect-ui-state-key` reports a key that selects another. A test reads the
4
+ * list again from the installed effect, so replace it with the one the test prints when a
5
+ * release adds or drops a name.
6
+ */
7
+ export const stateAttributes = [
8
+ "activation-direction",
9
+ "active",
10
+ "align",
11
+ "anchor-hidden",
12
+ "behind",
13
+ "checked",
14
+ "closed",
15
+ "combobox-blocker",
16
+ "combobox-chip",
17
+ "combobox-chips",
18
+ "combobox-group",
19
+ "combobox-input",
20
+ "combobox-inside",
21
+ "combobox-positioner",
22
+ "combobox-trigger",
23
+ "complete",
24
+ "current",
25
+ "date-picker-input",
26
+ "date-picker-trigger",
27
+ "dialog-backdrop",
28
+ "dialog-blocker",
29
+ "dialog-portal",
30
+ "dialog-trigger",
31
+ "direction",
32
+ "dirty",
33
+ "disabled",
34
+ "drag-over",
35
+ "dragging",
36
+ "drawer-backdrop",
37
+ "drawer-content",
38
+ "drawer-popup",
39
+ "drop-position",
40
+ "effect-ui-devtools",
41
+ "empty",
42
+ "ending-style",
43
+ "expanded",
44
+ "filled",
45
+ "final-focus",
46
+ "focusable",
47
+ "focused",
48
+ "has-overflow-x",
49
+ "has-overflow-y",
50
+ "has-submenu-open",
51
+ "hidden",
52
+ "highlighted",
53
+ "hovering",
54
+ "in-range",
55
+ "inactive",
56
+ "indeterminate",
57
+ "index",
58
+ "instant",
59
+ "invalid",
60
+ "key",
61
+ "limited",
62
+ "list-empty",
63
+ "menu-active",
64
+ "menu-blocker",
65
+ "menu-context",
66
+ "menu-item",
67
+ "menu-popup",
68
+ "menu-trigger",
69
+ "menu-viewport",
70
+ "menubar-trigger",
71
+ "modal",
72
+ "moving",
73
+ "multiple",
74
+ "navigation-item",
75
+ "navigation-menu",
76
+ "navigation-menu-trigger",
77
+ "nested",
78
+ "nested-dialog-open",
79
+ "nested-drawer-open",
80
+ "nested-drawer-swiping",
81
+ "open",
82
+ "orientation",
83
+ "outside-month",
84
+ "overflow-x-end",
85
+ "overflow-x-start",
86
+ "overflow-y-end",
87
+ "overflow-y-start",
88
+ "panel-open",
89
+ "parent",
90
+ "placeholder",
91
+ "popup-open",
92
+ "popup-side",
93
+ "pressed",
94
+ "preview-card-trigger",
95
+ "previous",
96
+ "progressing",
97
+ "range-end",
98
+ "range-start",
99
+ "readonly",
100
+ "required",
101
+ "scroll-area-content",
102
+ "scroll-area-corner",
103
+ "scroll-area-scrollbar-x",
104
+ "scroll-area-scrollbar-y",
105
+ "scroll-area-thumb-x",
106
+ "scroll-area-thumb-y",
107
+ "scroll-area-viewport",
108
+ "scrolling",
109
+ "scrubbing",
110
+ "select-blocker",
111
+ "select-item-text",
112
+ "select-scroll-arrow",
113
+ "select-value",
114
+ "selected",
115
+ "side",
116
+ "starting-style",
117
+ "swipe-direction",
118
+ "swipe-dismiss",
119
+ "swipe-ignore",
120
+ "swiping",
121
+ "toast-root",
122
+ "today",
123
+ "tooltip-trigger",
124
+ "touched",
125
+ "transitioning",
126
+ "trigger-disabled",
127
+ "type",
128
+ "unavailable",
129
+ "uncentered",
130
+ "unchecked",
131
+ "valid",
132
+ "virtual-grid-body",
133
+ "virtual-grid-cell",
134
+ "virtual-grid-row",
135
+ "virtual-grid-viewport",
136
+ "virtual-list-item",
137
+ "virtual-list-spacer",
138
+ "virtual-list-viewport",
139
+ "visible",
140
+ ];
141
+ //# sourceMappingURL=state-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-attributes.js","sources":["../../src/effect-ui-stylex/state-attributes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,sBAAsB;IACtB,QAAQ;IACR,OAAO;IACP,eAAe;IACf,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,kBAAkB;IAClB,UAAU;IACV,SAAS;IACT,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,OAAO;IACP,UAAU;IACV,W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,uBAAuB;IACvB,mBAAmB;IACnB,qBAAqB;IACrB,uBAAuB;IACvB,SAAS;CACV,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const stateKey: import("@oxlint/plugins").Rule;
2
+ //# sourceMappingURL=state-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-key.d.ts","sources":["../../src/effect-ui-stylex/state-key.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,QAAQ,gCAkGnB,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { exportOf, importsOf, keyOf } from "../rules/imports.js";
3
+ import { stateAttributes } from "./state-attributes.js";
4
+ const written = new Set(stateAttributes);
5
+ const attributesIn = (selector) => Array.from(selector.matchAll(/\[\s*data-([a-z]+(?:-[a-z]+)*)\s*(?:[~|^$*]?=\s*["']?([^\]"']*)["']?\s*)?\]/g), ([, name = "", value]) => ({ name, value }));
6
+ // Reads `:is([data-side="top"]):not([data-instant])`. `undefined` for a key with no data
7
+ // attribute in it, and for a bare `[data-x]`, which `effect-ui-stylex-condition-key` reports.
8
+ const stateKeyOf = (key) => {
9
+ if (!key.startsWith(":") || !key.includes("[data-"))
10
+ return undefined;
11
+ const [first = "", ...negated] = key.split(":not(");
12
+ return { needs: attributesIn(first), excludes: attributesIn(negated.join(" ")) };
13
+ };
14
+ // Whether no element matches both keys: one excludes an attribute the other needs, or both need
15
+ // one attribute at different values.
16
+ const exclusive = (a, b) => a.needs.some(({ name, value }) => b.needs.some((other) => other.name === name &&
17
+ value !== undefined &&
18
+ other.value !== undefined &&
19
+ other.value !== value)) ||
20
+ a.needs.some(({ name }) => b.excludes.some((other) => other.name === name)) ||
21
+ b.needs.some(({ name }) => a.excludes.some((other) => other.name === name));
22
+ export const stateKey = defineRule({
23
+ meta: {
24
+ type: "problem",
25
+ docs: {
26
+ description: "Hold a StyleX key on a data attribute to one effect/ui/kit writes, with a plain value, exclusive of the property's other such keys.",
27
+ },
28
+ schema: [],
29
+ messages: {
30
+ unknown: "effect/ui/kit writes no data-{{name}}, so '{{key}}' matches none of its parts. Pass state as a value, as stylex.attrs(styles.base, isOpen && styles.open), from what the view gets. A key on an attribute is for one that effect/ui/kit writes and hands the view no value for.",
31
+ nested: "Give '{{key}}' a plain value. StyleX's valid-styles rule takes no conditions under a key on an attribute. Put the other condition around it, as { '@media (…)': { default: …, '{{key}}': … } }.",
32
+ overlap: "'{{key}}' and '{{other}}' can match one element, and StyleX ranks keys on attributes of one property equally, so the stylesheet's order picks between them. Exclude one from the other, as '{{key}}:not([data-{{name}}])'.",
33
+ },
34
+ },
35
+ createOnce(context) {
36
+ let imports = new Map();
37
+ // The conditions of one property, or of one condition under it.
38
+ const checkConditions = (conditions) => {
39
+ const keys = conditions.properties.flatMap((property) => {
40
+ const key = property.type === "Property" ? keyOf(property) : undefined;
41
+ const state = key === undefined ? undefined : stateKeyOf(key);
42
+ return property.type !== "Property" || key === undefined || state === undefined
43
+ ? []
44
+ : [{ key, state, property }];
45
+ });
46
+ for (const [index, { key, state, property }] of keys.entries()) {
47
+ const unknown = [...state.needs, ...state.excludes].find(({ name }) => !written.has(name));
48
+ if (unknown !== undefined) {
49
+ context.report({
50
+ node: property.key,
51
+ messageId: "unknown",
52
+ data: { key, name: unknown.name },
53
+ });
54
+ }
55
+ if (property.value.type === "ObjectExpression") {
56
+ context.report({ node: property.key, messageId: "nested", data: { key } });
57
+ }
58
+ const other = keys.slice(index + 1).find((later) => !exclusive(state, later.state));
59
+ const [needed] = other?.state.needs ?? [];
60
+ if (other !== undefined) {
61
+ context.report({
62
+ node: other.property.key,
63
+ messageId: "overlap",
64
+ data: { key: other.key, other: key, name: state.needs[0]?.name ?? needed?.name ?? "" },
65
+ });
66
+ }
67
+ }
68
+ for (const property of conditions.properties) {
69
+ if (property.type === "Property" && property.value.type === "ObjectExpression") {
70
+ checkConditions(property.value);
71
+ }
72
+ }
73
+ };
74
+ const checkStyle = (style) => {
75
+ // A dynamic style's conditions are in the object its function returns.
76
+ const object = style.type === "ArrowFunctionExpression" ? style.body : style;
77
+ if (object.type !== "ObjectExpression")
78
+ return;
79
+ for (const property of object.properties) {
80
+ if (property.type === "Property" && property.value.type === "ObjectExpression") {
81
+ checkConditions(property.value);
82
+ }
83
+ }
84
+ };
85
+ return {
86
+ Program(program) {
87
+ imports = importsOf(program);
88
+ },
89
+ CallExpression(node) {
90
+ const [styles] = node.arguments;
91
+ if (exportOf(node.callee, imports, "@stylexjs/stylex") !== "create" ||
92
+ styles?.type !== "ObjectExpression") {
93
+ return;
94
+ }
95
+ for (const entry of styles.properties) {
96
+ if (entry.type === "Property")
97
+ checkStyle(entry.value);
98
+ }
99
+ },
100
+ };
101
+ },
102
+ });
103
+ //# sourceMappingURL=state-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-key.js","sources":["../../src/effect-ui-stylex/state-key.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAgB,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,eAAe,CAAC,CAAC;AAQ9D,MAAM,YAAY,GAAG,CAAC,QAAgB,EAA4B,EAAE,CAClE,KAAK,CAAC,IAAI,CACR,QAAQ,CAAC,QAAQ,CACf,8EAA8E,CAC/E,EACD,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAC5C,CAAC;AAEJ,yFAAyF;AACzF,8FAA8F;AAC9F,MAAM,UAAU,GAAG,CAAC,GAAW,EAAwB,EAAE;IACvD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QA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efined` for an import of anything else. A module of the library reaches its own files by
4
+ * path, so a path that stays inside the one checkout names none.
5
+ */
6
+ export declare const libraryFile: (filename: string, source: string) => string | undefined;
7
+ /** The module to import in place of a file of the library, if the library exports that file. */
8
+ export declare const exportedAs: (path: string) => string | undefined;
9
+ export declare const subpath: import("@oxlint/plugins").Rule;
10
+ //# sourceMappingURL=subpath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subpath.d.ts","sources":["../../src/effect-ui-stylex/subpath.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,eAAO,MAAM,WAAW,aAAc,MAAM,UAAU,MAAM,uBAS3D,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,UAAU,SAAU,MAAM,uBAKtC,CAAC;AAEF,eAAO,MAAM,OAAO,gCA6BlB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { isPath, moduleSources, posixPath, resolveFrom } from "../rules/module-sources.js";
3
+ import { exportedPlace, library, placeOf } from "./modules.js";
4
+ // The library's files as an app can name them: through the package, or by a path, relative or
5
+ // absolute, into the directory it is installed or checked out in.
6
+ const throughPackage = new RegExp(`^${library}/(?:src|dist)/(.+)$`);
7
+ const byPath = /^(.*\/effect-ui-stylex)\/(?:src|dist)\/(.+)$/;
8
+ /**
9
+ * The file of the library an import names from `file`, as a path under its `src` or `dist`, or
10
+ * `undefined` for an import of anything else. A module of the library reaches its own files by
11
+ * path, so a path that stays inside the one checkout names none.
12
+ */
13
+ export const libraryFile = (filename, source) => {
14
+ const file = posixPath(filename);
15
+ const [, through] = throughPackage.exec(posixPath(source)) ?? [];
16
+ if (through !== undefined || !isPath(source))
17
+ return through;
18
+ const [, root, path] = byPath.exec(resolveFrom(file, source)) ?? [];
19
+ return root === undefined || file.startsWith(`${root}/`) ? undefined : path;
20
+ };
21
+ /** The module to import in place of a file of the library, if the library exports that file. */
22
+ export const exportedAs = (path) => {
23
+ const place = placeOf(path);
24
+ const exported = place && exportedPlace(place.name);
25
+ return exported?.layer === place?.layer ? exported?.name : undefined;
26
+ };
27
+ export const subpath = defineRule({
28
+ meta: {
29
+ type: "problem",
30
+ docs: {
31
+ description: "Import @kutur-kit/effect-ui-stylex by the modules it exports, not by file.",
32
+ },
33
+ schema: [],
34
+ messages: {
35
+ exported: "Import {{library}}/{{module}}. {{source}} names a file of the package, and the layout of its `src` and `dist` changes without a version.",
36
+ unexported: "{{source}} names a file that {{library}} does not export, which changes without a version. Import one of the package's modules, such as {{library}}/button.",
37
+ },
38
+ },
39
+ createOnce(context) {
40
+ return moduleSources(({ source, node }) => {
41
+ const path = libraryFile(context.filename, source);
42
+ if (path === undefined)
43
+ return;
44
+ const module = exportedAs(path);
45
+ context.report({
46
+ node,
47
+ messageId: module === undefined ? "unexported" : "exported",
48
+ data: { library, module: module ?? "", source },
49
+ });
50
+ });
51
+ },
52
+ });
53
+ //# sourceMappingURL=subpath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subpath.js","sources":["../../src/effect-ui-stylex/subpath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE/D,8FAA8F;AAC9F,kEAAkE;AAClE,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,GAAG,8CAA8C,CAAC;AAE9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,MAAc,EAAE,EAAE;IAC9D,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,IAAI,CAA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AK,SAAS;gBAAE,OAAO;YAE/B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI;gBACJ,SAAS,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU;gBAC3D,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,EAAE;aAChD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ declare const effectUiStylex: {
2
+ jsPlugins: {
3
+ name: string;
4
+ specifier: string;
5
+ }[];
6
+ rules: {
7
+ "kit/effect-ui-class": "error";
8
+ "kit/effect-ui-internal-import": "error";
9
+ "kit/effect-ui-raw-part": "error";
10
+ "kit/effect-ui-state-key": "error";
11
+ "kit/effect-ui-stylex-condition-key": "error";
12
+ "kit/effect-ui-stylex-hover-gate": "error";
13
+ "kit/effect-ui-stylex-subpath": "error";
14
+ "stylex/enforce-extension": "error";
15
+ "stylex/no-legacy-contextual-styles": "error";
16
+ "stylex/no-nonstandard-styles": "error";
17
+ "stylex/no-unused": "error";
18
+ "stylex/valid-shorthands": "error";
19
+ "stylex/valid-styles": "error";
20
+ };
21
+ };
22
+ export default effectUiStylex;
23
+ //# sourceMappingURL=effect-ui-stylex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-ui-stylex.d.ts","sources":["../src/effect-ui-stylex.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;CAqBI,CAAC;AAEzB,eAAe,cAAc,CAAC"}
@@ -1,19 +1,20 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  const extension = import.meta.url.endsWith(".ts") ? "ts" : "js";
3
3
  // `satisfies` keeps each plugin entry an object, which the build's JSON form relies on.
4
- const foldkitStylex = {
4
+ const effectUiStylex = {
5
5
  jsPlugins: [
6
6
  // `/base` registers the same plugin with the same specifier, so Oxlint loads it once.
7
7
  { name: "kit", specifier: fileURLToPath(new URL(`./plugin.${extension}`, import.meta.url)) },
8
8
  { name: "stylex", specifier: fileURLToPath(import.meta.resolve("@stylexjs/eslint-plugin")) },
9
9
  ],
10
10
  rules: {
11
- "kit/foldkit-stylex-attributes": "error",
12
- "kit/foldkit-stylex-condition-key": "error",
13
- "kit/foldkit-stylex-hover-gate": "error",
14
- "kit/foldkit-stylex-styles": "error",
15
- "kit/foldkit-stylex-unstyled-view": "error",
16
- "kit/foldkit-stylex-vite": "error",
11
+ "kit/effect-ui-class": "error",
12
+ "kit/effect-ui-internal-import": "error",
13
+ "kit/effect-ui-raw-part": "error",
14
+ "kit/effect-ui-state-key": "error",
15
+ "kit/effect-ui-stylex-condition-key": "error",
16
+ "kit/effect-ui-stylex-hover-gate": "error",
17
+ "kit/effect-ui-stylex-subpath": "error",
17
18
  "stylex/enforce-extension": "error",
18
19
  "stylex/no-legacy-contextual-styles": "error",
19
20
  "stylex/no-nonstandard-styles": "error",
@@ -22,5 +23,5 @@ const foldkitStylex = {
22
23
  "stylex/valid-styles": "error",
23
24
  },
24
25
  };
25
- export default foldkitStylex;
26
- //# sourceMappingURL=foldkit-stylex.js.map
26
+ export default effectUiStylex;
27
+ //# sourceMappingURL=effect-ui-stylex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-ui-stylex.js","sources":["../src/effect-ui-stylex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAEhE,wFAAwF;AACxF,MAAM,cAAc,GAAG;IACrB,SAAS,EAAE;QACT,sFAAsF;QACtF,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,SAAS,EAAE,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;QAC5F,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,EAAE;KAC7F;IACD,KAAK,EAAE;QACL,qBAAqB,EAAE,OAAO;QAC9B,+BAA+B,EAAE,OAAO;QACxC,wBAAwB,EAAE,OAAO;QACjC,yBAAyB,EAAE,OAAO;QAClC,oCAAoC,EAAE,OAAO;QAC7C,iCAAiC,EAAE,OAAO;QAC1C,8BAA8B,EAAE,OAAO;QACvC,0BAA0B,EAAE,OAAO;QACnC,oCAAoC,EAAE,OAAO;QAC7C,8BAA8B,EAAE,OAAO;QACvC,kBAAkB,EAAE,OAAO;QAC3B,yBAAyB,EAAE,OAAO;QAClC,qBAAqB,EAAE,OAAO;KAC/B;CACqB,CAAC;AAEzB,eAAe,cAAc,CAAC"}
@@ -10,12 +10,13 @@
10
10
  }
11
11
  ],
12
12
  "rules": {
13
- "kit/foldkit-stylex-attributes": "error",
14
- "kit/foldkit-stylex-condition-key": "error",
15
- "kit/foldkit-stylex-hover-gate": "error",
16
- "kit/foldkit-stylex-styles": "error",
17
- "kit/foldkit-stylex-unstyled-view": "error",
18
- "kit/foldkit-stylex-vite": "error",
13
+ "kit/effect-ui-class": "error",
14
+ "kit/effect-ui-internal-import": "error",
15
+ "kit/effect-ui-raw-part": "error",
16
+ "kit/effect-ui-state-key": "error",
17
+ "kit/effect-ui-stylex-condition-key": "error",
18
+ "kit/effect-ui-stylex-hover-gate": "error",
19
+ "kit/effect-ui-stylex-subpath": "error",
19
20
  "stylex/enforce-extension": "error",
20
21
  "stylex/no-legacy-contextual-styles": "error",
21
22
  "stylex/no-nonstandard-styles": "error",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sources":["../src/plugin.ts"],"names":[],"mappings":";AAcA,wBAeG"}
1
+ {"version":3,"file":"plugin.d.ts","sources":["../src/plugin.ts"],"names":[],"mappings":";AAiBA,wBAkBG"}