@pantoken/utils 0.2.5 → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danny Wahl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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, and the generic token→utility-class emitters
125
- * ({@link colorUtilitiesCss}, {@link tokenUtilitiesCss}) that both `@pantoken/components` (semantic
126
- * tier) and `@pantoken/plugin-primitives` (raw-palette tier) build on. Depends only on
127
- * `@pantoken/model` (types) + `arkregex`, so any package can use it without pulling the GitHub-only
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.2.5",
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",
@@ -23,22 +23,22 @@
23
23
  "access": "public",
24
24
  "provenance": true
25
25
  },
26
- "scripts": {
27
- "dev": "vp pack --watch",
28
- "test": "vp test",
29
- "check": "vp check"
30
- },
31
26
  "dependencies": {
32
- "@pantoken/model": "workspace:*",
33
- "arkregex": "catalog:"
27
+ "arkregex": "^0.0.8",
28
+ "@pantoken/model": "0.3.0"
34
29
  },
35
30
  "devDependencies": {
36
- "@types/node": "catalog:",
37
- "typescript": "catalog:",
38
- "vite": "catalog:",
39
- "vite-plus": "catalog:"
31
+ "@types/node": "^24.13.3",
32
+ "typescript": "^7.0.2",
33
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.9",
34
+ "vite-plus": "0.2.9"
40
35
  },
41
36
  "engines": {
42
37
  "node": ">=22.18.0"
38
+ },
39
+ "scripts": {
40
+ "dev": "vp pack --watch",
41
+ "test": "vp test",
42
+ "check": "vp check"
43
43
  }
44
- }
44
+ }