@pantoken/utils 0.2.6 → 0.3.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.
- package/dist/index.d.mts +18 -1
- package/dist/index.mjs +59 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -63,6 +63,23 @@ declare function focusOutlineRules(selector?: string): string;
|
|
|
63
63
|
//#region src/index.d.ts
|
|
64
64
|
/** The colour mode to collapse `light-dark()` to. */
|
|
65
65
|
type Mode = "light" | "dark";
|
|
66
|
+
/** One entry of the pantoken spacing scale: the short key, the long (word) key, and the shared CSS value. */
|
|
67
|
+
interface SpacingStep {
|
|
68
|
+
/** The short scale key, e.g. `"sm"` (the zero step's short key is `"0"`). */
|
|
69
|
+
short: string;
|
|
70
|
+
/** The long, word-spelled key, e.g. `"small"` (the zero step's long key is `"none"`). */
|
|
71
|
+
long: string;
|
|
72
|
+
/** The CSS value — a token reference, or a plain `"0"`/`"auto"`. */
|
|
73
|
+
value: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The pantoken spacing scale, `none`/`0` → `2xl` — the single shared source for
|
|
77
|
+
* `@pantoken/components`' spacing/gap utilities and `@pantoken/interactions`' `resolveSpace`, so the
|
|
78
|
+
* two never drift apart.
|
|
79
|
+
*/
|
|
80
|
+
declare const SPACING_STEPS: readonly SpacingStep[];
|
|
81
|
+
/** The `auto` step — margin only, spelled the same both ways. */
|
|
82
|
+
declare const SPACING_AUTO_STEP: SpacingStep;
|
|
66
83
|
/**
|
|
67
84
|
* Strip `<script>` elements and event-handler attributes from SVG markup.
|
|
68
85
|
*
|
|
@@ -311,4 +328,4 @@ interface TokenUtilityGroup {
|
|
|
311
328
|
*/
|
|
312
329
|
declare function tokenUtilitiesCss(groups: readonly TokenUtilityGroup[], options?: UtilityOptions): string;
|
|
313
330
|
//#endregion
|
|
314
|
-
export { ColorUtilityNames, ELEVATION_NAMES, FOCUSABLE_SELECTOR, LIGHT_DARK_RE, Mode, ResolveOptions, Rgba, TokenUtilityGroup, UtilityOptions, VAR_RE, camelCase, colorUtilitiesCss, danglingReferences, elevationDeclarations, extractInstuiRefs, focusOutlineDeclarations, focusOutlineRules, makeResolver, parseHexColor, resolveTokens, sanitizeSvg, tokenNames, tokenUtilitiesCss, unknownReferences };
|
|
331
|
+
export { ColorUtilityNames, ELEVATION_NAMES, FOCUSABLE_SELECTOR, LIGHT_DARK_RE, Mode, ResolveOptions, Rgba, SPACING_AUTO_STEP, SPACING_STEPS, SpacingStep, TokenUtilityGroup, UtilityOptions, VAR_RE, camelCase, colorUtilitiesCss, danglingReferences, elevationDeclarations, extractInstuiRefs, focusOutlineDeclarations, focusOutlineRules, makeResolver, parseHexColor, resolveTokens, sanitizeSvg, tokenNames, tokenUtilitiesCss, unknownReferences };
|
package/dist/index.mjs
CHANGED
|
@@ -121,16 +121,69 @@ function focusOutlineRules(selector = FOCUSABLE_SELECTOR) {
|
|
|
121
121
|
/**
|
|
122
122
|
* `@pantoken/utils` — shared, upstream-free helpers used across the pantoken packages: the token
|
|
123
123
|
* reference resolver (with `light-dark()` handling), the two token regexes (typed via `arkregex`),
|
|
124
|
-
* kebab→camel case, hex-colour parsing,
|
|
125
|
-
* ({@link colorUtilitiesCss}, {@link tokenUtilitiesCss}) that
|
|
126
|
-
* tier) and `@pantoken/plugin-primitives` (raw-palette tier)
|
|
127
|
-
* `@pantoken/model` (types) + `arkregex`, so any package can use it without
|
|
128
|
-
* upstream.
|
|
124
|
+
* kebab→camel case, hex-colour parsing, the shared spacing scale ({@link SPACING_STEPS}), and the
|
|
125
|
+
* generic token→utility-class emitters ({@link colorUtilitiesCss}, {@link tokenUtilitiesCss}) that
|
|
126
|
+
* both `@pantoken/components` (semantic tier) and `@pantoken/plugin-primitives` (raw-palette tier)
|
|
127
|
+
* build on. Depends only on `@pantoken/model` (types) + `arkregex`, so any package can use it without
|
|
128
|
+
* pulling the GitHub-only upstream.
|
|
129
129
|
*
|
|
130
130
|
* @module
|
|
131
131
|
* @beta
|
|
132
132
|
*/
|
|
133
133
|
/**
|
|
134
|
+
* The pantoken spacing scale, `none`/`0` → `2xl` — the single shared source for
|
|
135
|
+
* `@pantoken/components`' spacing/gap utilities and `@pantoken/interactions`' `resolveSpace`, so the
|
|
136
|
+
* two never drift apart.
|
|
137
|
+
*/
|
|
138
|
+
const SPACING_STEPS = [
|
|
139
|
+
{
|
|
140
|
+
short: "0",
|
|
141
|
+
long: "none",
|
|
142
|
+
value: "var(--instui-component-shared-tokens-spacing-general-space-none)"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
short: "2xs",
|
|
146
|
+
long: "xx-small",
|
|
147
|
+
value: "var(--instui-spacing-space2xs)"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
short: "xs",
|
|
151
|
+
long: "x-small",
|
|
152
|
+
value: "var(--instui-spacing-space-xs)"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
short: "sm",
|
|
156
|
+
long: "small",
|
|
157
|
+
value: "var(--instui-spacing-space-sm)"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
short: "md",
|
|
161
|
+
long: "medium",
|
|
162
|
+
value: "var(--instui-spacing-space-md)"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
short: "lg",
|
|
166
|
+
long: "large",
|
|
167
|
+
value: "var(--instui-spacing-space-lg)"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
short: "xl",
|
|
171
|
+
long: "x-large",
|
|
172
|
+
value: "var(--instui-spacing-space-xl)"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
short: "2xl",
|
|
176
|
+
long: "xx-large",
|
|
177
|
+
value: "var(--instui-spacing-space2xl)"
|
|
178
|
+
}
|
|
179
|
+
];
|
|
180
|
+
/** The `auto` step — margin only, spelled the same both ways. */
|
|
181
|
+
const SPACING_AUTO_STEP = {
|
|
182
|
+
short: "auto",
|
|
183
|
+
long: "auto",
|
|
184
|
+
value: "auto"
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
134
187
|
* Strip `<script>` elements and event-handler attributes from SVG markup.
|
|
135
188
|
*
|
|
136
189
|
* Defense-in-depth for SVG decoded from vendored data URIs or contributed by plugins.
|
|
@@ -420,4 +473,4 @@ function tokenUtilitiesCss(groups, options = {}) {
|
|
|
420
473
|
})).join("\n")}\n`;
|
|
421
474
|
}
|
|
422
475
|
//#endregion
|
|
423
|
-
export { ELEVATION_NAMES, FOCUSABLE_SELECTOR, LIGHT_DARK_RE, VAR_RE, camelCase, colorUtilitiesCss, danglingReferences, elevationDeclarations, extractInstuiRefs, focusOutlineDeclarations, focusOutlineRules, makeResolver, parseHexColor, resolveTokens, sanitizeSvg, tokenNames, tokenUtilitiesCss, unknownReferences };
|
|
476
|
+
export { ELEVATION_NAMES, FOCUSABLE_SELECTOR, LIGHT_DARK_RE, SPACING_AUTO_STEP, SPACING_STEPS, VAR_RE, camelCase, colorUtilitiesCss, danglingReferences, elevationDeclarations, extractInstuiRefs, focusOutlineDeclarations, focusOutlineRules, makeResolver, parseHexColor, resolveTokens, sanitizeSvg, tokenNames, tokenUtilitiesCss, unknownReferences };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantoken/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared pantoken helpers: token reference resolver, typed regexes (arkregex), name-case, and hex-colour parsing.",
|
|
5
5
|
"homepage": "https://pantoken.iywahl.com",
|
|
6
6
|
"bugs": "https://github.com/thedannywahl/pantoken/issues",
|