@csszyx/runtime 0.10.0 → 0.10.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.
package/dist/index.d.cts CHANGED
@@ -695,6 +695,73 @@ declare function pick(classes: string, selector: BoxSelector): string;
695
695
  * @returns The non-matching tokens joined by spaces.
696
696
  */
697
697
  declare function omit(classes: string, selector: BoxSelector): string;
698
+ /** Options controlling how `splitBoxSz` partitions an sz object. */
699
+ interface SplitBoxSzOptions {
700
+ /** Force these selectors onto the outer object, overriding the default map. */
701
+ outer?: BoxSelector[];
702
+ /** Force these selectors onto the inner object, overriding the default map. */
703
+ inner?: BoxSelector[];
704
+ /** Where an unrecognized key goes. Defaults to `'outer'`. */
705
+ fallback?: BoxRole;
706
+ }
707
+ /** The two sz-object buckets produced by `splitBoxSz`. */
708
+ interface SplitBoxSzResult {
709
+ /** sz for the outer (border-outward) element. */
710
+ outer: SzObject;
711
+ /** sz for the inner (border-inward) element. */
712
+ inner: SzObject;
713
+ }
714
+ /**
715
+ * Classify an sz prop key by box-model role + semantic category, or `undefined`
716
+ * if it is not a csszyx-owned key. The sz-object analog of `classify` (which
717
+ * takes an emitted class token) — both read the same generated map, so
718
+ * `classifySzKey('m')` and `classify('m-4')` agree.
719
+ *
720
+ * @param key - An sz prop key (e.g. `'m'`, `'px'`, `'grow'`).
721
+ * @returns The key's role and category, or `undefined` if unowned.
722
+ */
723
+ declare function classifySzKey(key: string): Classification | undefined;
724
+ /**
725
+ * Partition an sz object (or any `SzInput`) into `{ outer, inner }` at the CSS
726
+ * box-model border line — the sz-object analog of `splitBox`. Each key routes to
727
+ * the same side its emitted class would (`splitBoxSz(x)` buckets keys to the
728
+ * roles `splitBox(compile(x))` gives the emitted classes). Arrays are flattened,
729
+ * `null`/`false` collapse to empty objects, and `options.inner`/`outer`/
730
+ * `fallback` behave like `SplitBoxOptions` (`inner` wins when a key matches both).
731
+ *
732
+ * @param sz - The sz object / input to partition.
733
+ * @param options - Overrides for forcing keys onto a node and the fallback role.
734
+ * @returns The `{ outer, inner }` sz-object buckets.
735
+ * @example splitBoxSz({ m: 4, px: 2 }) // → { outer: { m: 4 }, inner: { px: 2 } }
736
+ */
737
+ declare function splitBoxSz(sz: SzInput, options?: SplitBoxSzOptions): SplitBoxSzResult;
738
+ /**
739
+ * Does any key in `sz` match `selector` (after flattening, recursing into
740
+ * variants)? The sz-object analog of `has`.
741
+ *
742
+ * @param sz - The sz input to scan.
743
+ * @param selector - The selector to test keys against.
744
+ * @returns `true` if any key matches.
745
+ */
746
+ declare function hasSz(sz: SzInput, selector: BoxSelector): boolean;
747
+ /**
748
+ * Keep only the keys in `sz` that match `selector` (recursing into variants).
749
+ * The sz-object analog of `pick`.
750
+ *
751
+ * @param sz - The sz input to filter.
752
+ * @param selector - The selector keys must match to be kept.
753
+ * @returns A new sz object with the matching keys.
754
+ */
755
+ declare function pickSz(sz: SzInput, selector: BoxSelector): SzObject;
756
+ /**
757
+ * Drop the keys in `sz` that match `selector`, keeping the rest (recursing into
758
+ * variants). The sz-object analog of `omit`.
759
+ *
760
+ * @param sz - The sz input to filter.
761
+ * @param selector - The selector keys must match to be dropped.
762
+ * @returns A new sz object with the non-matching keys.
763
+ */
764
+ declare function omitSz(sz: SzInput, selector: BoxSelector): SzObject;
698
765
 
699
766
  /**
700
767
  * Drop the `sz` prop before a component spreads `...rest` onto a host element.
@@ -880,5 +947,5 @@ declare function isRuntimeInitialized(): boolean;
880
947
  */
881
948
  declare function resetRuntime(): void;
882
949
 
883
- export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szMerge, abortHydration, attemptCSRRecovery, classify, clearHydrationErrors, computeMangleChecksumAsync, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, has, hasRecoveryToken, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidMangleMap, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, omit, pick, resetRuntime, splitBox, startHydration, stripSzProps, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleChecksumAsync, verifyMangleMapIntegrity, verifyRecoveryToken };
884
- export type { BoxRole, BoxSelector, Classification, HydrationError, HydrationErrorType, MangleMap, RecoveryManifest, RecoveryMode, RuntimeConfig, SSRContext, SplitBoxOptions, SplitBoxResult, SzInput, TokenData, VerificationResult };
950
+ export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szMerge, abortHydration, attemptCSRRecovery, classify, classifySzKey, clearHydrationErrors, computeMangleChecksumAsync, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, has, hasRecoveryToken, hasSz, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidMangleMap, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, omit, omitSz, pick, pickSz, resetRuntime, splitBox, splitBoxSz, startHydration, stripSzProps, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleChecksumAsync, verifyMangleMapIntegrity, verifyRecoveryToken };
951
+ export type { BoxRole, BoxSelector, Classification, HydrationError, HydrationErrorType, MangleMap, RecoveryManifest, RecoveryMode, RuntimeConfig, SSRContext, SplitBoxOptions, SplitBoxResult, SplitBoxSzOptions, SplitBoxSzResult, SzInput, TokenData, VerificationResult };
package/dist/index.d.mts CHANGED
@@ -695,6 +695,73 @@ declare function pick(classes: string, selector: BoxSelector): string;
695
695
  * @returns The non-matching tokens joined by spaces.
696
696
  */
697
697
  declare function omit(classes: string, selector: BoxSelector): string;
698
+ /** Options controlling how `splitBoxSz` partitions an sz object. */
699
+ interface SplitBoxSzOptions {
700
+ /** Force these selectors onto the outer object, overriding the default map. */
701
+ outer?: BoxSelector[];
702
+ /** Force these selectors onto the inner object, overriding the default map. */
703
+ inner?: BoxSelector[];
704
+ /** Where an unrecognized key goes. Defaults to `'outer'`. */
705
+ fallback?: BoxRole;
706
+ }
707
+ /** The two sz-object buckets produced by `splitBoxSz`. */
708
+ interface SplitBoxSzResult {
709
+ /** sz for the outer (border-outward) element. */
710
+ outer: SzObject;
711
+ /** sz for the inner (border-inward) element. */
712
+ inner: SzObject;
713
+ }
714
+ /**
715
+ * Classify an sz prop key by box-model role + semantic category, or `undefined`
716
+ * if it is not a csszyx-owned key. The sz-object analog of `classify` (which
717
+ * takes an emitted class token) — both read the same generated map, so
718
+ * `classifySzKey('m')` and `classify('m-4')` agree.
719
+ *
720
+ * @param key - An sz prop key (e.g. `'m'`, `'px'`, `'grow'`).
721
+ * @returns The key's role and category, or `undefined` if unowned.
722
+ */
723
+ declare function classifySzKey(key: string): Classification | undefined;
724
+ /**
725
+ * Partition an sz object (or any `SzInput`) into `{ outer, inner }` at the CSS
726
+ * box-model border line — the sz-object analog of `splitBox`. Each key routes to
727
+ * the same side its emitted class would (`splitBoxSz(x)` buckets keys to the
728
+ * roles `splitBox(compile(x))` gives the emitted classes). Arrays are flattened,
729
+ * `null`/`false` collapse to empty objects, and `options.inner`/`outer`/
730
+ * `fallback` behave like `SplitBoxOptions` (`inner` wins when a key matches both).
731
+ *
732
+ * @param sz - The sz object / input to partition.
733
+ * @param options - Overrides for forcing keys onto a node and the fallback role.
734
+ * @returns The `{ outer, inner }` sz-object buckets.
735
+ * @example splitBoxSz({ m: 4, px: 2 }) // → { outer: { m: 4 }, inner: { px: 2 } }
736
+ */
737
+ declare function splitBoxSz(sz: SzInput, options?: SplitBoxSzOptions): SplitBoxSzResult;
738
+ /**
739
+ * Does any key in `sz` match `selector` (after flattening, recursing into
740
+ * variants)? The sz-object analog of `has`.
741
+ *
742
+ * @param sz - The sz input to scan.
743
+ * @param selector - The selector to test keys against.
744
+ * @returns `true` if any key matches.
745
+ */
746
+ declare function hasSz(sz: SzInput, selector: BoxSelector): boolean;
747
+ /**
748
+ * Keep only the keys in `sz` that match `selector` (recursing into variants).
749
+ * The sz-object analog of `pick`.
750
+ *
751
+ * @param sz - The sz input to filter.
752
+ * @param selector - The selector keys must match to be kept.
753
+ * @returns A new sz object with the matching keys.
754
+ */
755
+ declare function pickSz(sz: SzInput, selector: BoxSelector): SzObject;
756
+ /**
757
+ * Drop the keys in `sz` that match `selector`, keeping the rest (recursing into
758
+ * variants). The sz-object analog of `omit`.
759
+ *
760
+ * @param sz - The sz input to filter.
761
+ * @param selector - The selector keys must match to be dropped.
762
+ * @returns A new sz object with the non-matching keys.
763
+ */
764
+ declare function omitSz(sz: SzInput, selector: BoxSelector): SzObject;
698
765
 
699
766
  /**
700
767
  * Drop the `sz` prop before a component spreads `...rest` onto a host element.
@@ -880,5 +947,5 @@ declare function isRuntimeInitialized(): boolean;
880
947
  */
881
948
  declare function resetRuntime(): void;
882
949
 
883
- export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szMerge, abortHydration, attemptCSRRecovery, classify, clearHydrationErrors, computeMangleChecksumAsync, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, has, hasRecoveryToken, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidMangleMap, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, omit, pick, resetRuntime, splitBox, startHydration, stripSzProps, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleChecksumAsync, verifyMangleMapIntegrity, verifyRecoveryToken };
884
- export type { BoxRole, BoxSelector, Classification, HydrationError, HydrationErrorType, MangleMap, RecoveryManifest, RecoveryMode, RuntimeConfig, SSRContext, SplitBoxOptions, SplitBoxResult, SzInput, TokenData, VerificationResult };
950
+ export { DEFAULT_RUNTIME_CONFIG, VERSION, _sz, _sz2, _sz3, _szMerge, abortHydration, attemptCSRRecovery, classify, classifySzKey, clearHydrationErrors, computeMangleChecksumAsync, disableCSRRecovery, enableCSRRecovery, endHydration, getAbortedSubtreeCount, getHydrationErrors, getRecoveryMode, getRuntimeConfig, getSSRContext, guardHydration, has, hasRecoveryToken, hasSz, initRuntime, isCSRRecoveryAllowed, isHydrating, isHydrationAborted, isRuntimeInitialized, isSSREnvironment, isValidMangleMap, isValidManifest, loadMangleMapFromDOM, loadManifestFromDOM, omit, omitSz, pick, pickSz, resetRuntime, splitBox, splitBoxSz, startHydration, stripSzProps, szv, validateHydrationClass, verifyAllTokens, verifyMangleChecksum, verifyMangleChecksumAsync, verifyMangleMapIntegrity, verifyRecoveryToken };
951
+ export type { BoxRole, BoxSelector, Classification, HydrationError, HydrationErrorType, MangleMap, RecoveryManifest, RecoveryMode, RuntimeConfig, SSRContext, SplitBoxOptions, SplitBoxResult, SplitBoxSzOptions, SplitBoxSzResult, SzInput, TokenData, VerificationResult };