praxis-kit 4.1.1 → 4.1.2

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.
@@ -94,6 +94,38 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
94
94
  readonly _pluginProps?: TProps;
95
95
  }>;
96
96
 
97
+ /**
98
+ * Canonical list of reserved layout prop names.
99
+ *
100
+ * This array is the single source of truth for every supported CSS `display`
101
+ * value exposed as a boolean prop. The `LayoutKey` type is derived directly
102
+ * from this list.
103
+ *
104
+ * To add a new display mode:
105
+ * 1. Add the display value here.
106
+ * 2. Register its layout family in `LAYOUT_FAMILY_MAP`.
107
+ *
108
+ * Prop names intentionally match the corresponding Tailwind/CSS display
109
+ * utilities, so no additional prop-to-class mapping is required.
110
+ */
111
+ declare const layoutKeys: readonly ["flex", "inline-flex", "grid", "inline-grid", "block", "inline-block", "inline", "hidden", "contents", "flow-root", "list-item", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row"];
112
+
113
+ type TupleValues<T extends readonly unknown[]> = T[number];
114
+ type ValueOf<T> = T[keyof T];
115
+ type LayoutKey<T extends readonly string[]> = TupleValues<T>;
116
+ type LayoutFamily<M extends StringMap<string>> = ValueOf<M>;
117
+ type LayoutMode<T extends readonly string[]> = LayoutKey<T> | 'none';
118
+ type ExclusiveTrueProp<K extends PropertyKey> = {
119
+ [P in K]: Simplify<Record<P, true> & Partial<Record<Exclude<K, P>, never>>>;
120
+ }[K];
121
+ /**
122
+ * Mutually exclusive display shorthand props.
123
+ *
124
+ * At most one key may be `true`. Passing multiple is a compile-time error; the
125
+ * runtime also warns and lets the first key in declaration order take precedence.
126
+ */
127
+ type LayoutProps<T extends readonly string[]> = ExclusiveTrueProp<LayoutKey<T>> | Partial<Record<LayoutKey<T>, never>>;
128
+
97
129
  declare const LAYOUT_FAMILY_MAP: {
98
130
  readonly flex: "flex";
99
131
  readonly 'inline-flex': "flex";
@@ -107,6 +139,7 @@ declare const LAYOUT_FAMILY_MAP: {
107
139
  readonly 'flow-root': "none";
108
140
  readonly 'list-item': "none";
109
141
  readonly table: "none";
142
+ readonly 'inline-table': "none";
110
143
  readonly 'table-caption': "none";
111
144
  readonly 'table-cell': "none";
112
145
  readonly 'table-column': "none";
@@ -117,32 +150,16 @@ declare const LAYOUT_FAMILY_MAP: {
117
150
  readonly 'table-row': "none";
118
151
  };
119
152
 
120
- declare const layoutKeys: readonly ["flex", "inline-flex", "grid", "inline-grid", "block", "inline-block", "inline", "hidden", "contents", "flow-root", "list-item", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row"];
121
-
122
- type LayoutKey = (typeof layoutKeys)[number];
123
- type LayoutFamily = (typeof LAYOUT_FAMILY_MAP)[LayoutKey];
124
- type LayoutMode = LayoutKey | 'none';
125
- type ExclusiveTrueProp<K extends PropertyKey> = {
126
- [P in K]: Simplify<Record<P, true> & Partial<Record<Exclude<K, P>, never>>>;
127
- }[K];
128
- /**
129
- * Mutually exclusive display shorthand props.
130
- *
131
- * At most one key may be `true`. Passing multiple is a compile-time error; the
132
- * runtime also warns and lets the first key in declaration order take precedence.
133
- */
134
- type LayoutProps = ExclusiveTrueProp<LayoutKey> | Partial<Record<LayoutKey, never>>;
135
-
136
153
  type ClassToken = string;
137
154
  type Token<TKind extends string, TData extends object = EmptyRecord> = {
138
155
  kind: TKind;
139
156
  raw: string;
140
157
  } & TData;
141
158
  type LayoutToken = Token<'layout', {
142
- value: LayoutKey;
159
+ value: LayoutKey<typeof layoutKeys>;
143
160
  }>;
144
161
  type ConditionalToken = Token<'conditional', {
145
- requires: Exclude<LayoutFamily, 'none'>;
162
+ requires: Exclude<LayoutFamily<typeof LAYOUT_FAMILY_MAP>, 'none'>;
146
163
  }>;
147
164
  type GapToken = Token<'gap'>;
148
165
  type UtilityToken = Token<'utility', {
@@ -188,7 +205,7 @@ type CompoundVariant = {
188
205
  * flex-family modes strip `grid-*`; grid-family modes strip `flex-*`; all other
189
206
  * display values (and no prop) strip both `flex-*` and `grid-*`.
190
207
  */
191
- declare function createTailwindPipeline<V extends VariantMap = VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics): ClassPlugin<LayoutProps>;
208
+ declare function createTailwindPipeline<V extends VariantMap = VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics): ClassPlugin<LayoutProps<typeof layoutKeys>>;
192
209
 
193
210
  declare class ClassBuilder {
194
211
  #private;
@@ -200,7 +217,7 @@ declare class ClassClassifier {
200
217
  classify(token: ClassToken): ClassifiedToken;
201
218
  }
202
219
 
203
- type DependencyRules = Record<Exclude<LayoutFamily, 'none'>, readonly RegExp[]>;
220
+ type DependencyRules = Record<Exclude<LayoutFamily<typeof LAYOUT_FAMILY_MAP>, 'none'>, readonly RegExp[]>;
204
221
  declare const defaultDependencyRules: DependencyRules;
205
222
 
206
223
  /**
@@ -216,9 +233,9 @@ declare const defaultDependencyRules: DependencyRules;
216
233
  */
217
234
  declare class LayoutState {
218
235
  #private;
219
- constructor(mode: LayoutMode);
220
- get mode(): LayoutMode;
221
- get family(): LayoutFamily;
236
+ constructor(mode: LayoutMode<typeof layoutKeys>);
237
+ get mode(): LayoutMode<typeof layoutKeys>;
238
+ get family(): LayoutFamily<typeof LAYOUT_FAMILY_MAP>;
222
239
  }
223
240
 
224
241
  declare class DependencyEvaluator {
@@ -227,4 +244,4 @@ declare class DependencyEvaluator {
227
244
  evaluate(token: ClassifiedToken, state: LayoutState): boolean;
228
245
  }
229
246
 
230
- export { ClassBuilder, ClassClassifier, type ClassToken, type ClassifiedToken, type CompoundVariant, type ConditionalToken, DependencyEvaluator, type DependencyRules, type GapToken, type LayoutFamily, type LayoutKey, type LayoutMode, type LayoutProps, LayoutState, type LayoutToken, type UtilityToken, type VariantSelection, createTailwindPipeline, defaultDependencyRules };
247
+ export { ClassBuilder, ClassClassifier, type ClassToken, type ClassifiedToken, type CompoundVariant, type ConditionalToken, DependencyEvaluator, type DependencyRules, type GapToken, type LayoutFamily, type LayoutKey, type LayoutMode, type LayoutProps, LayoutState, type LayoutToken, type UtilityToken, type VariantSelection, createTailwindPipeline, defaultDependencyRules, layoutKeys };
@@ -400,6 +400,7 @@ var layoutKeys = [
400
400
  "flow-root",
401
401
  "list-item",
402
402
  "table",
403
+ "inline-table",
403
404
  "table-caption",
404
405
  "table-cell",
405
406
  "table-column",
@@ -425,6 +426,7 @@ var LAYOUT_FAMILY_MAP = {
425
426
  "flow-root": "none",
426
427
  "list-item": "none",
427
428
  table: "none",
429
+ "inline-table": "none",
428
430
  "table-caption": "none",
429
431
  "table-cell": "none",
430
432
  "table-column": "none",
@@ -672,5 +674,6 @@ export {
672
674
  DependencyEvaluator,
673
675
  LayoutState,
674
676
  createTailwindPipeline,
675
- defaultDependencyRules
677
+ defaultDependencyRules,
678
+ layoutKeys
676
679
  };
@@ -287,7 +287,17 @@ type DesignTokenManifest = {
287
287
  * destructured patterns fall through (same scope as `collectConstraints`).
288
288
  */
289
289
  declare function collectFileTokens(source: ts.SourceFile, calleeNames: ReadonlySet<string>): Map<string, ComponentTokens>;
290
- /** Builds a DesignTokenManifest from the accumulated per-component token maps, including a flat sorted `allClasses` union. */
290
+ /**
291
+ * Builds a DesignTokenManifest from the accumulated per-component token maps,
292
+ * including a flat sorted `allClasses` union.
293
+ *
294
+ * `allClasses` always includes every `layoutKeys` display value (`flex`,
295
+ * `inline-flex`, `grid`, `hidden`, etc.) even when no scanned component uses
296
+ * them literally. Those classes are only ever assembled at runtime by
297
+ * `createTailwindPipeline` from boolean props, so they never appear as a
298
+ * string literal for Tailwind's content scanner (or this manifest) to find
299
+ * on its own — without this, Tailwind silently drops their generated CSS.
300
+ */
291
301
  declare function buildManifest(allTokens: Map<string, ComponentTokens>): DesignTokenManifest;
292
302
  type DesignTokensOptions = {
293
303
  /**
@@ -1389,6 +1389,31 @@ function analyze(code, filename, options) {
1389
1389
  return diagnoseUsages(source, constraints, severity);
1390
1390
  }
1391
1391
 
1392
+ // ../../lib/tailwind/src/layout-keys.ts
1393
+ var layoutKeys = [
1394
+ "flex",
1395
+ "inline-flex",
1396
+ "grid",
1397
+ "inline-grid",
1398
+ "block",
1399
+ "inline-block",
1400
+ "inline",
1401
+ "hidden",
1402
+ "contents",
1403
+ "flow-root",
1404
+ "list-item",
1405
+ "table",
1406
+ "inline-table",
1407
+ "table-caption",
1408
+ "table-cell",
1409
+ "table-column",
1410
+ "table-column-group",
1411
+ "table-footer-group",
1412
+ "table-header-group",
1413
+ "table-row-group",
1414
+ "table-row"
1415
+ ];
1416
+
1392
1417
  // ../../plugins/vite/src/design-tokens.ts
1393
1418
  import { writeFileSync } from "fs";
1394
1419
  import { resolve } from "path";
@@ -1471,7 +1496,7 @@ function mergeTokens(existing, incoming) {
1471
1496
  }
1472
1497
  function buildManifest(allTokens) {
1473
1498
  const components = {};
1474
- const seen = /* @__PURE__ */ new Set();
1499
+ const seen = new Set(layoutKeys);
1475
1500
  iterate.forEach(allTokens, ([name, tokens]) => {
1476
1501
  components[name] = tokens;
1477
1502
  iterate.forEach(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praxis-kit",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./react": {
@@ -130,9 +130,9 @@
130
130
  "vite": "^8.1.3",
131
131
  "vue": "^3.5.38",
132
132
  "@praxis-kit/adapter-utils": "0.0.0",
133
+ "@praxis-kit/core": "0.0.0",
133
134
  "@praxis-kit/diagnostics": "0.0.0",
134
- "@praxis-kit/primitive": "0.0.0",
135
- "@praxis-kit/core": "0.0.0"
135
+ "@praxis-kit/primitive": "0.0.0"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public"