@charcoal-ui/styled 5.0.0-beta.6 → 5.0.0-beta.7

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.cjs CHANGED
@@ -1,608 +1,25 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- let __charcoal_ui_utils = require("@charcoal-ui/utils");
25
- __charcoal_ui_utils = __toESM(__charcoal_ui_utils);
26
- let warning = require("warning");
27
- warning = __toESM(warning);
28
- let __charcoal_ui_foundation = require("@charcoal-ui/foundation");
29
- __charcoal_ui_foundation = __toESM(__charcoal_ui_foundation);
30
- let styled_components = require("styled-components");
31
- styled_components = __toESM(styled_components);
32
- let react_jsx_runtime = require("react/jsx-runtime");
33
- react_jsx_runtime = __toESM(react_jsx_runtime);
34
- let __charcoal_ui_react = require("@charcoal-ui/react");
35
- __charcoal_ui_react = __toESM(__charcoal_ui_react);
36
-
37
- //#region src/util.ts
38
- function unreachable(value) {
39
- throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
40
- }
41
- /**
42
- * Check whether a value is non-null and non-undefined
43
- *
44
- * @param value nullable
45
- */
46
- const isPresent = (value) => value != null;
47
- function objectAssign(...sources) {
48
- return Object.assign({}, ...sources);
49
- }
50
- /**
51
- * Object.keys の返り値の型を厳しめにしてくれるやつ。
52
- *
53
- * ジェネリクスは基本的に明示して使うことを推奨。
54
- *
55
- * このライブラリでは Theme オブジェクトのジェネリクスを引き回すケースが多く、
56
- * ジェネリクスを省略するといつのまにか keys の返り値が `string | number | symbol` になりがちなので
57
- *
58
- * @param obj - キーを取りたいオブジェクト。ジェネリクスを省略したとき `never[]` のような使えない型が返って欲しい
59
- */
60
- function keyof(obj) {
61
- return Object.keys(obj);
62
- }
63
- /**
64
- * 配列じゃなかったら配列にする
65
- */
66
- function wrapArray(value) {
67
- return Array.isArray(value) ? value : [value];
68
- }
69
- const noThemeProvider = /* @__PURE__ */ new Error("`theme` is invalid. `<ThemeProvider>` is not likely mounted.");
70
- /**
71
- * 子孫要素で使われるカラーテーマの CSS Variables を上書きする
72
- *
73
- * @params colorParams - 上書きしたい色の定義( `theme.color` の一部だけ書けば良い )
74
- * @params effectParams - effect の定義を上書きしたい場合は渡す(必須ではない)
75
- *
76
- * @example
77
- * ```tsx
78
- * const LocalTheme = styled.div`
79
- * ${defineThemeVariables({ text1: '#ff0000' })}
80
- * // `text1` is now defined as red
81
- * ${theme((o) => [o.font.text1])}
82
- * `
83
- * ```
84
- */
85
- function defineThemeVariables(colorParams, effectParams) {
86
- return function toCssObject(props) {
87
- if (!isPresent(props.theme)) throw noThemeProvider;
88
- const colors$1 = (0, __charcoal_ui_utils.filterObject)(colorParams, isPresent);
89
- const effects = Object.entries({
90
- ...props.theme.effect,
91
- ...effectParams
92
- });
93
- return (0, __charcoal_ui_utils.flatMapObject)(colors$1, (colorKey, color) => [[(0, __charcoal_ui_utils.customPropertyToken)(colorKey), color], ...effects.map(([effectKey, effect]) => [(0, __charcoal_ui_utils.customPropertyToken)(colorKey, [effectKey]), (0, __charcoal_ui_utils.applyEffect)(color, [effect])])]);
94
- };
95
- }
96
- function isSupportedEffect(effect) {
97
- return [
98
- "hover",
99
- "press",
100
- "disabled"
101
- ].includes(effect);
102
- }
103
- const variable = (value) => `var(${value})`;
104
- function onEffectPseudo(effect, css$8) {
105
- return effect === "hover" ? { "&:hover": { [__charcoal_ui_utils.notDisabledSelector]: css$8 } } : effect === "press" ? { "&:active": { [__charcoal_ui_utils.notDisabledSelector]: css$8 } } : effect === "disabled" ? { [__charcoal_ui_utils.disabledSelector]: css$8 } : unreachable(effect);
106
- }
107
- function withPrefixes(...parts) {
108
- return parts.join("-");
109
- }
110
-
111
- //#endregion
112
- //#region src/internals/index.ts
113
- /**
114
- * 絶対にこれを export してはいけない
115
- *
116
- * さもないと `o.bg[internalSym]` みたいな叩き方が可能になってしまう(補完にも意図せず出てしまう)
117
- */
118
- const internalSym = Symbol("internal");
119
- /**
120
- * CSSObject に変換可能なオブジェクトを作成する
121
- *
122
- * 実際に CSSObject に変換するには外部から `__DO_NOT_USE_GET_INTERNAL__` を使わなければならない
123
- *
124
- * これ以降メソッドチェーンが続いてもいいし、続かなくても良い
125
- */
126
- function createInternal({ toCSS, context = {} }) {
127
- return { [internalSym]: {
128
- toCSS,
129
- context
130
- } };
131
- }
132
- function __DO_NOT_USE_ACCESS_PRIVATE_PROPERTY__(internal) {
133
- return internal[internalSym];
134
- }
135
- const shouldCancelHalfLeading = ({ cancelHalfLeadingPx, hasVerticalPadding = false }) => cancelHalfLeadingPx !== void 0 && !hasVerticalPadding;
136
- /**
137
- * 個別の Internal( o.〇〇 の返り値 )が提出した context の中身を1つの context にまとめる
138
- */
139
- function getContext(internals) {
140
- return internals.reduce((context, internal) => ({
141
- ...context,
142
- ...__DO_NOT_USE_ACCESS_PRIVATE_PROPERTY__(internal).context
143
- }), {});
144
- }
145
- /**
146
- * 全ユーザー定義からコンテキスト生成し、styled-components 向けに CSSObject を構築
147
- */
148
- function toCSSObjects(internals) {
149
- const context = getContext(internals);
150
- return internals.map((v) => __DO_NOT_USE_ACCESS_PRIVATE_PROPERTY__(v).toCSS(context));
151
- }
152
-
153
- //#endregion
154
- //#region src/factories/lib.ts
155
- /**
156
- * 配列で指定したプロパティを動的に生やす
157
- *
158
- * @param source 拡張するオブジェクト
159
- * @param member オブジェクトに生やすプロパティ一覧
160
- * @param chain プロパティに格納される値を生成する関数
161
- *
162
- * @example
163
- *
164
- * const o = factory({}, ['red', 'blue'],
165
- * color => hex(color)
166
- * )
167
- *
168
- * console.log(o.red) //=> #ff0000
169
- */
170
- const defineProperties = (source, member, chain) => Object.defineProperties(source, Object.fromEntries(member.map((key) => [key, {
171
- get: () => chain(key),
172
- enumerable: true,
173
- configurable: true
174
- }])));
175
- /**
176
- * 配列で指定した名前のメソッドを動的に生やす
177
- *
178
- * @param source 拡張するオブジェクト
179
- * @param member オブジェクトに生やすメソッド名一覧
180
- * @param chain メソッドの戻り値になる値を生成する関数
181
- *
182
- * @example
183
- *
184
- * const o = defineMethods({}, ['red', 'blue'],
185
- * (color, alpha: number) => hex(color, alpha)
186
- * )
187
- *
188
- * console.log(o.red(0.5)) //=> #ff000077
189
- */
190
- const defineMethods = (source, member, chain) => Object.defineProperties(source, Object.fromEntries(member.map((key) => [key, {
191
- value: (...args) => chain(key, ...args),
192
- enumerable: true,
193
- configurable: true
194
- }])));
195
- /**
196
- * オブジェクトで指定したプロパティ名と値を動的に生やす
197
- *
198
- * @param source 拡張するオブジェクト
199
- * @param def オブジェクトに生やす定義(プロパティ名と値)
200
- *
201
- * @example
202
- *
203
- * const o = defineConstantProperties({}, {
204
- * red: '#f00',
205
- * blue: '#00f',
206
- * })
207
- *
208
- * console.log(o.red) //=> #f00
209
- */
210
- const defineConstantProperties = (source, def) => defineProperties(source, Object.keys(def), (key) => def[key]);
211
- /**
212
- * 配列で指定したモディファイア(プロパティ)をチェーン可能な再帰オブジェクトを動的に生やす
213
- *
214
- * @param modifiers オブジェクトに生やすモディファイヤ一覧
215
- * @param source 指定されたモディファイヤの一覧から値を生成する関数
216
- *
217
- * @example
218
- *
219
- * const o = definePropertyChains(['red', 'blue'],
220
- * modifiers => modifiers.map(color => hex(color)).join(',')
221
- * )
222
- *
223
- * console.log(o.red.blue) => #f00,#00f
224
- */
225
- const definePropertyChains = (modifiers, source) => (function definePropertiesRecursively(applied) {
226
- const notApplied = modifiers.filter((v) => !applied.includes(v));
227
- return defineProperties(source(applied), notApplied, (modifier) => notApplied.length === 0 ? unreachable() : definePropertiesRecursively([...applied, modifier]));
228
- })([]);
229
- /**
230
- * 配列で指定したモディファイア(メソッド)をチェーン可能な再帰オブジェクトを動的に生やす
231
- *
232
- * @param modifiers オブジェクトに生やすモディファイヤ一覧
233
- * @param source 指定されたモディファイヤの一覧から値を生成する関数
234
- * @param _inferPhantom 関数形式のモディファイヤの引数型を推論するためのメタタイプ(引数の個数に合わせてタプルで指定する)
235
- *
236
- * @example
237
- *
238
- * const o = defineMethodChains(['red', 'blue'],
239
- * modifiers => modifiers.map(([color, alpha]) => hex(color, alpha)).join(',')
240
- * , {} as [number])
241
- *
242
- * console.log(o.red(0.5).blue(1)) => #ff000077,#0000ffff
243
- */
244
- const defineMethodChains = (modifiers, source, ..._inferPhantom) => (function defineMethodsRecursively(applied) {
245
- const notApplied = modifiers.filter((v) => !applied.map(([w]) => w).includes(v));
246
- return defineMethods(source(applied), notApplied, (modifier, ...args) => notApplied.length === 0 ? unreachable() : defineMethodsRecursively([...applied, [modifier, ...args]]));
247
- })([]);
248
-
249
- //#endregion
250
- //#region src/builders/border.ts
251
- const borderDirections = [
252
- "top",
253
- "right",
254
- "bottom",
255
- "left"
256
- ];
257
- const createBorderCss = (variant, directions) => {
258
- const all = directions.length === 0;
259
- const value = `solid 1px ${variable((0, __charcoal_ui_utils.customPropertyToken)(withPrefixes("border", variant.toString())))}`;
260
- return createInternal({ toCSS() {
261
- return { ...all ? { border: value } : directions.reduce((acc, direction) => ({
262
- ...acc,
263
- [`border-${direction}`]: value
264
- }), {}) };
265
- } });
266
- };
267
- function border(theme) {
268
- return defineConstantProperties({}, { border: defineProperties({}, keyof(theme.border), (variant) => definePropertyChains(borderDirections, (modifiers) => createBorderCss(variant, modifiers))) });
269
- }
270
-
271
- //#endregion
272
- //#region src/builders/borderRadius.ts
273
- const createBorderRadiusCss = (theme) => (size$1) => {
274
- return createInternal({ toCSS() {
275
- return { borderRadius: (0, __charcoal_ui_utils.px)(theme.borderRadius[size$1]) };
276
- } });
277
- };
278
- function borderRadius(theme) {
279
- const borderRadiusCss = createBorderRadiusCss(theme);
280
- return defineConstantProperties({}, { borderRadius: (radius) => borderRadiusCss(radius) });
281
- }
282
-
283
- //#endregion
284
- //#region src/builders/transition.ts
285
- const TRANSITION_DURATION = .2;
286
- /**
287
- * context の状態を元に transition を追加する。必ず一番最後に呼ぶ
288
- */
289
- function transition(_theme) {
290
- const duration = (0, __charcoal_ui_utils.dur)(TRANSITION_DURATION);
291
- const transition$1 = (property) => ({ transition: property.map((v) => `${duration} ${v}`).join(", ") });
292
- function toCSS({ colorTransition = false, backgroundColorTransition = false, boxShadowTransition = false }) {
293
- return transition$1([
294
- colorTransition ? "color" : null,
295
- backgroundColorTransition ? "background-color" : null,
296
- boxShadowTransition ? "box-shadow" : null
297
- ].filter(isPresent));
298
- }
299
- return createInternal({ toCSS });
300
- }
301
-
302
- //#endregion
303
- //#region src/builders/colors.ts
304
- function targetProperty(target) {
305
- return target === "bg" ? "background-color" : "color";
306
- }
307
- const createColorCss = (_theme) => (target, color, effects = []) => {
308
- function toCSS() {
309
- return {
310
- [targetProperty(target)]: variable((0, __charcoal_ui_utils.customPropertyToken)(color.toString())),
311
- ...effects.filter(isSupportedEffect).reduce((acc, effect) => ({
312
- ...acc,
313
- ...onEffectPseudo(effect, { [targetProperty(target)]: variable((0, __charcoal_ui_utils.customPropertyToken)(color.toString(), [effect])) })
314
- }), {})
315
- };
316
- }
317
- return createInternal({
318
- toCSS,
319
- context: effects.length > 0 ? target === "font" ? { colorTransition: true } : { backgroundColorTransition: true } : {}
320
- });
321
- };
322
- const createGradientColorCss = (theme) => (color, effects = [], direction) => {
323
- const toLinearGradient = (0, __charcoal_ui_utils.gradient)(direction);
324
- function toCSS(context) {
325
- const optimized = !shouldCancelHalfLeading(context);
326
- const duration = (0, __charcoal_ui_utils.dur)(TRANSITION_DURATION);
327
- if (optimized && effects.length > 0) return {
328
- position: "relative",
329
- zIndex: 0,
330
- overflow: "hidden",
331
- ...effects.filter(isSupportedEffect).reduce((acc, effect) => ({
332
- ...acc,
333
- "&::before": {
334
- zIndex: -1,
335
- ...overlayElement,
336
- transition: `${duration} background-color`
337
- },
338
- "&::after": {
339
- zIndex: -2,
340
- ...overlayElement,
341
- ...toLinearGradient(theme.gradientColor[color])
342
- },
343
- ...onEffectPseudo(effect, { "&::before": { backgroundColor: (0, __charcoal_ui_utils.applyEffect)(null, theme.effect[effect] ?? []) } })
344
- }), {})
345
- };
346
- (0, warning.default)(effects.length === 0, `'Transition' will not be applied. You can get around this by specifying 'preserveHalfLeading' or both 'padding' and 'typography'.`);
347
- return {
348
- ...toLinearGradient(theme.gradientColor[color]),
349
- ...effects.filter(isSupportedEffect).reduce((acc, effect) => ({
350
- ...acc,
351
- ...onEffectPseudo(effect, { ...toLinearGradient((0, __charcoal_ui_utils.applyEffectToGradient)(theme.effect[effect] ?? [])(theme.gradientColor[color])) })
352
- }), {})
353
- };
354
- }
355
- return createInternal({ toCSS });
356
- };
357
- const overlayElement = {
358
- content: "''",
359
- display: "block",
360
- position: "absolute",
361
- width: "100%",
362
- height: "100%",
363
- top: 0,
364
- left: 0
365
- };
366
- function colors(theme) {
367
- const colors$1 = keyof(theme.color);
368
- const effects = keyof(theme.effect);
369
- const gradientColors = keyof(theme.gradientColor);
370
- const colorCss = createColorCss(theme);
371
- const gradientColorCss = createGradientColorCss(theme);
372
- return defineConstantProperties({}, {
373
- bg: objectAssign(defineProperties({}, colors$1, (color) => definePropertyChains(effects, (modifiers) => colorCss("bg", color, modifiers))), defineProperties({}, gradientColors, (color) => (direction) => definePropertyChains(effects, (modifiers) => gradientColorCss(color, modifiers, direction)))),
374
- font: defineProperties({}, colors$1, (color) => definePropertyChains(effects, (modifiers) => colorCss("font", color, modifiers)))
375
- });
376
- }
377
-
378
- //#endregion
379
- //#region src/builders/elementEffect.ts
380
- const createElementEffectCss = (theme) => (effects = []) => createInternal({ toCSS() {
381
- return effects.filter(isSupportedEffect).reduce((acc, effect) => ({
382
- ...acc,
383
- ...onEffectPseudo(effect, { opacity: !Array.isArray(theme.elementEffect[effect]) && theme.elementEffect[effect]?.type === "opacity" ? theme.elementEffect[effect]?.opacity : unreachable() })
384
- }), {});
385
- } });
386
- function elementEffect(theme) {
387
- const effectTypes = keyof(theme.elementEffect);
388
- const elementEffectCss = createElementEffectCss(theme);
389
- return definePropertyChains(effectTypes, (modifiers) => elementEffectCss(modifiers));
390
- }
391
-
392
- //#endregion
393
- //#region src/builders/outline.ts
394
- const outlineType = ["focus"];
395
- const outlineCss = (weight, color) => ({ boxShadow: `0 0 0 ${(0, __charcoal_ui_utils.px)(weight)} ${color}` });
396
- const createOutlineColorCss = (theme) => (variant, modifiers) => {
397
- const weight = theme.outline[variant].weight;
398
- const color = theme.outline[variant].color;
399
- return createInternal({
400
- toCSS() {
401
- return modifiers.includes("focus") ? onFocus(outlineCss(weight, color)) : { "&&": { [__charcoal_ui_utils.notDisabledSelector]: outlineCss(weight, color) } };
402
- },
403
- context: { boxShadowTransition: true }
404
- });
405
- };
406
- /**
407
- * @see https://developer.mozilla.org/ja/docs/Web/CSS/:focus-visible#selectively_showing_the_focus_indicator
408
- */
409
- const onFocus = (css$8) => ({ [__charcoal_ui_utils.notDisabledSelector]: {
410
- "&:focus, &:active": {
411
- outline: "none",
412
- ...css$8
413
- },
414
- "&:focus:not(:focus-visible), &:active:not(:focus-visible)": { outline: "none" },
415
- "&:focus-visible": {
416
- outline: "none",
417
- ...css$8
418
- }
419
- } });
420
- function outline(theme) {
421
- const outlineCss$1 = createOutlineColorCss(theme);
422
- return defineConstantProperties({}, { outline: defineProperties({}, keyof(theme.outline), (variant) => definePropertyChains(outlineType, (modifiers) => outlineCss$1(variant, modifiers))) });
423
- }
424
-
425
- //#endregion
426
- //#region src/builders/size.ts
427
- const fixedProperties = ["width", "height"];
428
- const createFixedPxCss = (theme) => (property, size$1) => createInternal({ toCSS() {
429
- return { [property]: size$1 === "auto" ? "auto" : (0, __charcoal_ui_utils.px)(theme.spacing[size$1]) };
430
- } });
431
- const createFixedRelativeCss = (_theme) => (property, amount) => createInternal({ toCSS() {
432
- return { [property]: amount };
433
- } });
434
- const createFixedColumnCss = (theme) => (property, span) => createInternal({ toCSS() {
435
- return { [property]: (0, __charcoal_ui_utils.px)((0, __charcoal_ui_foundation.columnSystem)(span, theme.grid.unit.column, theme.grid.unit.gutter)) };
436
- } });
437
- function size(theme) {
438
- const fixedPxCss = createFixedPxCss(theme);
439
- const fixedColumnCss = createFixedColumnCss(theme);
440
- const fixedRelativeCss = createFixedRelativeCss(theme);
441
- return defineProperties({}, fixedProperties, (property) => defineConstantProperties({}, {
442
- px: (size$1) => fixedPxCss(property, size$1),
443
- column: (span) => fixedColumnCss(property, span),
444
- auto: fixedRelativeCss(property, "auto"),
445
- full: fixedRelativeCss(property, "100%")
446
- }));
447
- }
448
-
449
- //#endregion
450
- //#region src/builders/spacing.ts
451
- const spacingProperties = ["margin", "padding"];
452
- const spacingDirections = [
453
- "top",
454
- "right",
455
- "bottom",
456
- "left",
457
- "vertical",
458
- "horizontal",
459
- "all"
460
- ];
461
- function spacingProperty(property, direction) {
462
- return `${property}-${direction}`;
463
- }
464
- const createSpacingCss = (theme) => (property, modifiers) => {
465
- const { top, right, bottom, left } = modifiers.reduce((acc, [direction, size$1]) => {
466
- if (direction === "all") {
467
- acc.top = size$1;
468
- acc.right = size$1;
469
- acc.bottom = size$1;
470
- acc.left = size$1;
471
- } else if (direction === "vertical") {
472
- acc.top = size$1;
473
- acc.bottom = size$1;
474
- } else if (direction === "horizontal") {
475
- acc.right = size$1;
476
- acc.left = size$1;
477
- } else acc[direction] = size$1;
478
- return acc;
479
- }, {});
480
- const hasVerticalPadding = property === "padding" && top !== void 0 && bottom !== void 0 && top !== "auto" && bottom !== "auto";
481
- function toCSS({ cancelHalfLeadingPx = 0 }) {
482
- return {
483
- ...top !== void 0 && { [spacingProperty(property, "top")]: top === "auto" ? "auto" : (0, __charcoal_ui_utils.px)(theme.spacing[top] + (hasVerticalPadding ? cancelHalfLeadingPx : 0)) },
484
- ...bottom !== void 0 && { [spacingProperty(property, "bottom")]: bottom === "auto" ? "auto" : (0, __charcoal_ui_utils.px)(theme.spacing[bottom] + (hasVerticalPadding ? cancelHalfLeadingPx : 0)) },
485
- ...right !== void 0 && { [spacingProperty(property, "right")]: right === "auto" ? "auto" : (0, __charcoal_ui_utils.px)(theme.spacing[right]) },
486
- ...left !== void 0 && { [spacingProperty(property, "left")]: left === "auto" ? "auto" : (0, __charcoal_ui_utils.px)(theme.spacing[left]) }
487
- };
488
- }
489
- return createInternal({
490
- toCSS,
491
- context: hasVerticalPadding ? { hasVerticalPadding: true } : {}
492
- });
493
- };
494
- function spacing(theme) {
495
- const spacingCss = createSpacingCss(theme);
496
- return defineProperties({}, spacingProperties, (spacingProperty$1) => defineMethodChains(spacingDirections, (modifiers) => spacingCss(spacingProperty$1, modifiers), {}));
497
- }
498
-
499
- //#endregion
500
- //#region src/builders/typography.ts
501
- const createTypographyCss = (theme) => (size$1, options = {}) => {
502
- const { preserveHalfLeading = false, monospace = false, bold = false } = options;
503
- const descriptor = theme.typography.size[size$1];
504
- const margin$1 = -(0, __charcoal_ui_utils.halfLeading)(descriptor);
505
- function toCSS(context) {
506
- return {
507
- fontSize: (0, __charcoal_ui_utils.px)(descriptor.fontSize),
508
- lineHeight: (0, __charcoal_ui_utils.px)(descriptor.lineHeight),
509
- ...monospace && { fontFamily: "monospace" },
510
- ...bold && { fontWeight: "bold" },
511
- ...shouldCancelHalfLeading(context) && {
512
- display: "flow-root",
513
- "&::before": {
514
- ...leadingCancel,
515
- marginTop: (0, __charcoal_ui_utils.px)(margin$1)
516
- },
517
- "&::after": {
518
- ...leadingCancel,
519
- marginBottom: (0, __charcoal_ui_utils.px)(margin$1)
520
- }
521
- }
522
- };
523
- }
524
- return createInternal({
525
- toCSS,
526
- context: !preserveHalfLeading ? { cancelHalfLeadingPx: margin$1 } : {}
527
- });
528
- };
529
- const leadingCancel = {
530
- display: "block",
531
- width: 0,
532
- height: 0,
533
- content: `''`
534
- };
535
- const typographyModifiers = [
536
- "monospace",
537
- "bold",
538
- "preserveHalfLeading"
539
- ];
540
- function typography$1(theme) {
541
- const typographyCss = createTypographyCss(theme);
542
- return defineProperties({}, ["typography"], (_) => (size$1) => definePropertyChains(typographyModifiers, (modifiers) => typographyCss(size$1, {
543
- preserveHalfLeading: modifiers.includes("preserveHalfLeading"),
544
- monospace: modifiers.includes("monospace"),
545
- bold: modifiers.includes("bold")
546
- })));
547
- }
548
-
549
- //#endregion
550
- //#region src/builders/o.ts
551
- /**
552
- * `theme(o => [...])` の `o` の部分を構築する
553
- *
554
- * @param theme テーマオブジェクト
555
- */
556
- function createO(theme) {
557
- return objectAssign(colors(theme), typography$1(theme), spacing(theme), size(theme), elementEffect(theme), border(theme), borderRadius(theme), outline(theme));
558
- }
559
-
560
- //#endregion
561
- //#region src/TokenInjector.tsx
562
- const GlobalStyle = styled_components.createGlobalStyle`
563
- ${({ themeMap, background }) => Object.entries(themeMap).map(([key, theme]) => key.startsWith("@media") ? styled_components.css`
564
- ${key} {
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@charcoal-ui/utils`);c=s(c);let l=require(`warning`);l=s(l);let u=require(`@charcoal-ui/foundation`);u=s(u);let d=require(`styled-components`);d=s(d);let f=require(`react/jsx-runtime`);f=s(f);let p=require(`@charcoal-ui/react`);p=s(p);function m(e){throw Error(arguments.length===0?`unreachable`:`unreachable (${JSON.stringify(e)})`)}const h=e=>e!=null;function g(...e){return Object.assign({},...e)}function _(e){return Object.keys(e)}function ee(e){return Array.isArray(e)?e:[e]}const v=Error("`theme` is invalid. `<ThemeProvider>` is not likely mounted.");function y(e,t){return function(n){if(!h(n.theme))throw v;let r=(0,c.filterObject)(e,h),i=Object.entries({...n.theme.effect,...t});return(0,c.flatMapObject)(r,(e,t)=>[[(0,c.customPropertyToken)(e),t],...i.map(([n,r])=>[(0,c.customPropertyToken)(e,[n]),(0,c.applyEffect)(t,[r])])])}}function b(e){return[`hover`,`press`,`disabled`].includes(e)}const x=e=>`var(${e})`;function S(e,t){return e===`hover`?{"&:hover":{[c.notDisabledSelector]:t}}:e===`press`?{"&:active":{[c.notDisabledSelector]:t}}:e===`disabled`?{[c.disabledSelector]:t}:m(e)}function C(...e){return e.join(`-`)}const w=Symbol(`internal`);function T({toCSS:e,context:t={}}){return{[w]:{toCSS:e,context:t}}}function E(e){return e[w]}const D=({cancelHalfLeadingPx:e,hasVerticalPadding:t=!1})=>e!==void 0&&!t;function O(e){return e.reduce((e,t)=>({...e,...E(t).context}),{})}function k(e){let t=O(e);return e.map(e=>E(e).toCSS(t))}const A=(e,t,n)=>Object.defineProperties(e,Object.fromEntries(t.map(e=>[e,{get:()=>n(e),enumerable:!0,configurable:!0}]))),te=(e,t,n)=>Object.defineProperties(e,Object.fromEntries(t.map(e=>[e,{value:(...t)=>n(e,...t),enumerable:!0,configurable:!0}]))),j=(e,t)=>A(e,Object.keys(t),e=>t[e]),M=(e,t)=>(function n(r){let i=e.filter(e=>!r.includes(e));return A(t(r),i,e=>i.length===0?m():n([...r,e]))})([]),ne=(e,t,...n)=>(function n(r){let i=e.filter(e=>!r.map(([e])=>e).includes(e));return te(t(r),i,(e,...t)=>i.length===0?m():n([...r,[e,...t]]))})([]),re=[`top`,`right`,`bottom`,`left`],ie=(e,t)=>{let n=t.length===0,r=`solid 1px ${x((0,c.customPropertyToken)(C(`border`,e.toString())))}`;return T({toCSS(){return{...n?{border:r}:t.reduce((e,t)=>({...e,[`border-${t}`]:r}),{})}}})};function ae(e){return j({},{border:A({},_(e.border),e=>M(re,t=>ie(e,t)))})}const oe=e=>t=>T({toCSS(){return{borderRadius:(0,c.px)(e.borderRadius[t])}}});function se(e){let t=oe(e);return j({},{borderRadius:e=>t(e)})}const N=.2;function ce(e){let t=(0,c.dur)(N),n=e=>({transition:e.map(e=>`${t} ${e}`).join(`, `)});function r({colorTransition:e=!1,backgroundColorTransition:t=!1,boxShadowTransition:r=!1}){return n([e?`color`:null,t?`background-color`:null,r?`box-shadow`:null].filter(h))}return T({toCSS:r})}function P(e){return e===`bg`?`background-color`:`color`}const le=e=>(e,t,n=[])=>{function r(){return{[P(e)]:x((0,c.customPropertyToken)(t.toString())),...n.filter(b).reduce((n,r)=>({...n,...S(r,{[P(e)]:x((0,c.customPropertyToken)(t.toString(),[r]))})}),{})}}return T({toCSS:r,context:n.length>0?e===`font`?{colorTransition:!0}:{backgroundColorTransition:!0}:{}})},F=e=>(t,n=[],r)=>{let i=(0,c.gradient)(r);function a(r){let a=!D(r),o=(0,c.dur)(N);return a&&n.length>0?{position:`relative`,zIndex:0,overflow:`hidden`,...n.filter(b).reduce((n,r)=>({...n,"&::before":{zIndex:-1,...I,transition:`${o} background-color`},"&::after":{zIndex:-2,...I,...i(e.gradientColor[t])},...S(r,{"&::before":{backgroundColor:(0,c.applyEffect)(null,e.effect[r]??[])}})}),{})}:((0,l.default)(n.length===0,`'Transition' will not be applied. You can get around this by specifying 'preserveHalfLeading' or both 'padding' and 'typography'.`),{...i(e.gradientColor[t]),...n.filter(b).reduce((n,r)=>({...n,...S(r,{...i((0,c.applyEffectToGradient)(e.effect[r]??[])(e.gradientColor[t]))})}),{})})}return T({toCSS:a})},I={content:`''`,display:`block`,position:`absolute`,width:`100%`,height:`100%`,top:0,left:0};function L(e){let t=_(e.color),n=_(e.effect),r=_(e.gradientColor),i=le(e),a=F(e);return j({},{bg:g(A({},t,e=>M(n,t=>i(`bg`,e,t))),A({},r,e=>t=>M(n,n=>a(e,n,t)))),font:A({},t,e=>M(n,t=>i(`font`,e,t)))})}const R=e=>(t=[])=>T({toCSS(){return t.filter(b).reduce((t,n)=>({...t,...S(n,{opacity:!Array.isArray(e.elementEffect[n])&&e.elementEffect[n]?.type===`opacity`?e.elementEffect[n]?.opacity:m()})}),{})}});function z(e){let t=_(e.elementEffect),n=R(e);return M(t,e=>n(e))}const B=[`focus`],V=(e,t)=>({boxShadow:`0 0 0 ${(0,c.px)(e)} ${t}`}),H=e=>(t,n)=>{let r=e.outline[t].weight,i=e.outline[t].color;return T({toCSS(){return n.includes(`focus`)?U(V(r,i)):{"&&":{[c.notDisabledSelector]:V(r,i)}}},context:{boxShadowTransition:!0}})},U=e=>({[c.notDisabledSelector]:{"&:focus, &:active":{outline:`none`,...e},"&:focus:not(:focus-visible), &:active:not(:focus-visible)":{outline:`none`},"&:focus-visible":{outline:`none`,...e}}});function W(e){let t=H(e);return j({},{outline:A({},_(e.outline),e=>M(B,n=>t(e,n)))})}const ue=[`width`,`height`],de=e=>(t,n)=>T({toCSS(){return{[t]:n===`auto`?`auto`:(0,c.px)(e.spacing[n])}}}),fe=e=>(e,t)=>T({toCSS(){return{[e]:t}}}),pe=e=>(t,n)=>T({toCSS(){return{[t]:(0,c.px)((0,u.columnSystem)(n,e.grid.unit.column,e.grid.unit.gutter))}}});function me(e){let t=de(e),n=pe(e),r=fe(e);return A({},ue,e=>j({},{px:n=>t(e,n),column:t=>n(e,t),auto:r(e,`auto`),full:r(e,`100%`)}))}const he=[`margin`,`padding`],ge=[`top`,`right`,`bottom`,`left`,`vertical`,`horizontal`,`all`];function G(e,t){return`${e}-${t}`}const _e=e=>(t,n)=>{let{top:r,right:i,bottom:a,left:o}=n.reduce((e,[t,n])=>(t===`all`?(e.top=n,e.right=n,e.bottom=n,e.left=n):t===`vertical`?(e.top=n,e.bottom=n):t===`horizontal`?(e.right=n,e.left=n):e[t]=n,e),{}),s=t===`padding`&&r!==void 0&&a!==void 0&&r!==`auto`&&a!==`auto`;function l({cancelHalfLeadingPx:n=0}){return{...r!==void 0&&{[G(t,`top`)]:r===`auto`?`auto`:(0,c.px)(e.spacing[r]+(s?n:0))},...a!==void 0&&{[G(t,`bottom`)]:a===`auto`?`auto`:(0,c.px)(e.spacing[a]+(s?n:0))},...i!==void 0&&{[G(t,`right`)]:i===`auto`?`auto`:(0,c.px)(e.spacing[i])},...o!==void 0&&{[G(t,`left`)]:o===`auto`?`auto`:(0,c.px)(e.spacing[o])}}}return T({toCSS:l,context:s?{hasVerticalPadding:!0}:{}})};function ve(e){let t=_e(e);return A({},he,e=>ne(ge,n=>t(e,n),{}))}const ye=e=>(t,n={})=>{let{preserveHalfLeading:r=!1,monospace:i=!1,bold:a=!1}=n,o=e.typography.size[t],s=-(0,c.halfLeading)(o);function l(e){return{fontSize:(0,c.px)(o.fontSize),lineHeight:(0,c.px)(o.lineHeight),...i&&{fontFamily:`monospace`},...a&&{fontWeight:`bold`},...D(e)&&{display:`flow-root`,"&::before":{...K,marginTop:(0,c.px)(s)},"&::after":{...K,marginBottom:(0,c.px)(s)}}}}return T({toCSS:l,context:r?{}:{cancelHalfLeadingPx:s}})},K={display:`block`,width:0,height:0,content:`''`},be=[`monospace`,`bold`,`preserveHalfLeading`];function xe(e){let t=ye(e);return A({},[`typography`],e=>e=>M(be,n=>t(e,{preserveHalfLeading:n.includes(`preserveHalfLeading`),monospace:n.includes(`monospace`),bold:n.includes(`bold`)})))}function Se(e){return g(L(e),xe(e),ve(e),me(e),z(e),ae(e),se(e),W(e))}const Ce=d.createGlobalStyle`
2
+ ${({themeMap:e,background:t})=>Object.entries(e).map(([e,n])=>e.startsWith(`@media`)?d.css`
3
+ ${e} {
565
4
  :root {
566
- ${background !== void 0 && styled_components.css`
567
- background-color: ${theme.color[background]};
5
+ ${t!==void 0&&d.css`
6
+ background-color: ${n.color[t]};
568
7
  `}
569
- ${defineColorVariableCSS(theme)}
8
+ ${q(n)}
570
9
  }
571
10
  }
572
- ` : styled_components.css`
11
+ `:d.css`
573
12
  /* stylelint-disable-next-line no-duplicate-selectors */
574
- ${key} {
575
- ${background !== void 0 && styled_components.css`
576
- background-color: ${theme.color[background]};
13
+ ${e} {
14
+ ${t!==void 0&&d.css`
15
+ background-color: ${n.color[t]};
577
16
  `}
578
- ${defineColorVariableCSS(theme)}
17
+ ${q(n)}
579
18
  }
580
19
  `)}
581
- `;
582
- function TokenInjector({ theme: themeMap, background }) {
583
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GlobalStyle, {
584
- themeMap,
585
- background
586
- });
587
- }
588
- const defineColorVariableCSS = (theme) => {
589
- const borders = (0, __charcoal_ui_utils.mapObject)(theme.border, (name, { color }) => [withPrefixes("border", name), color]);
590
- return toCSSVariables(defineThemeVariables({
591
- ...theme.color,
592
- ...borders
593
- })({ theme }));
594
- };
595
- function toCSSVariables(css$8) {
596
- return Object.entries(css$8).map(([varName, value]) => variableDefinition(varName, value.toString())).join(";");
597
- }
598
- const variableDefinition = (prop, value) => `${prop}: ${value}`;
599
-
600
- //#endregion
601
- //#region src/utils/typographyCss.ts
602
- const boldCss = styled_components.css`
20
+ `;function we({theme:e,background:t}){return(0,f.jsx)(Ce,{themeMap:e,background:t})}const q=e=>{let t=(0,c.mapObject)(e.border,(e,{color:t})=>[C(`border`,e),t]);return Te(y({...e.color,...t})({theme:e}))};function Te(e){return Object.entries(e).map(([e,t])=>Ee(e,t.toString())).join(`;`)}const Ee=(e,t)=>`${e}: ${t}`,De=d.css`
603
21
  font-weight: bold;
604
- `;
605
- const removeHalfLeadingCss = styled_components.css`
22
+ `,J=d.css`
606
23
  &::before {
607
24
  display: block;
608
25
  width: 0;
@@ -618,25 +35,13 @@ const removeHalfLeadingCss = styled_components.css`
618
35
  content: '';
619
36
  margin-bottom: -4px;
620
37
  }
621
- `;
622
- function typography(size$1, bold = false, preserveHalfLeading = false) {
623
- return styled_components.css`
624
- font-size: ${size$1}px;
625
- line-height: ${size$1 + 8}px;
38
+ `;function Oe(e,t=!1,n=!1){return d.css`
39
+ font-size: ${e}px;
40
+ line-height: ${e+8}px;
626
41
  display: flow-root;
627
- ${bold === true && boldCss}
628
- ${preserveHalfLeading !== true && removeHalfLeadingCss}
629
- `;
630
- }
631
-
632
- //#endregion
633
- //#region src/styles/focusVisibleFocusRingCss.ts
634
- /**
635
- * `&:focus:not(:focus-visible)` is backwards compatibility for legacy browsers.
636
- *
637
- * cf. https://github.com/WICG/focus-visible#backwards-compatibility
638
- */
639
- const focusVisibleFocusRingCss = styled_components.css`
42
+ ${t===!0&&De}
43
+ ${n!==!0&&J}
44
+ `}const Y=d.css`
640
45
  &:focus {
641
46
  outline: none;
642
47
  box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
@@ -647,253 +52,39 @@ const focusVisibleFocusRingCss = styled_components.css`
647
52
  &:focus-visible {
648
53
  box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
649
54
  }
650
- `;
651
-
652
- //#endregion
653
- //#region src/styles/disabledCss.ts
654
- const disabledCss = styled_components.css`
55
+ `,X=d.css`
655
56
  &:disabled,
656
57
  &[aria-disabled]:not([aria-disabled='false']) {
657
58
  opacity: 0.32;
658
59
  cursor: default;
659
60
  }
660
- `;
661
-
662
- //#endregion
663
- //#region src/styles/assertiveRingCss.ts
664
- const assertiveRingCss = styled_components.css`
61
+ `,Z=d.css`
665
62
  box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
666
- `;
667
-
668
- //#endregion
669
- //#region src/utils/helpers/pxIfNum.ts
670
- function pxIfNum(v) {
671
- if (v === void 0) return "";
672
- if (typeof v === "number") return `${v}px`;
673
- return v;
674
- }
675
-
676
- //#endregion
677
- //#region src/utils/margin.ts
678
- function margin(arg1, arg2, arg3, arg4) {
679
- return styled_components.css`
680
- margin: ${pxIfNum(arg1)} ${pxIfNum(arg2)} ${pxIfNum(arg3)} ${pxIfNum(arg4)};
681
- `;
682
- }
683
- function marginTop(v) {
684
- return styled_components.css`
685
- margin-top: ${pxIfNum(v)};
686
- `;
687
- }
688
- function marginBottom(v) {
689
- return styled_components.css`
690
- margin-bottom: ${pxIfNum(v)};
691
- `;
692
- }
693
- function marginLeft(v) {
694
- return styled_components.css`
695
- margin-left: ${pxIfNum(v)};
696
- `;
697
- }
698
- function marginRight(v) {
699
- return styled_components.css`
700
- margin-right: ${pxIfNum(v)};
701
- `;
702
- }
703
-
704
- //#endregion
705
- //#region src/utils/padding.ts
706
- function padding(arg1, arg2, arg3, arg4) {
707
- return styled_components.css`
708
- padding: ${arg1}px ${pxIfNum(arg2)} ${pxIfNum(arg3)} ${pxIfNum(arg4)};
709
- `;
710
- }
711
- function paddingTop(v) {
712
- return styled_components.css`
713
- padding-top: ${v}px;
714
- `;
715
- }
716
- function paddingBottom(v) {
717
- return styled_components.css`
718
- padding-bottom: ${v}px;
719
- `;
720
- }
721
- function paddingLeft(v) {
722
- return styled_components.css`
723
- padding-left: ${v}px;
724
- `;
725
- }
726
- function paddingRight(v) {
727
- return styled_components.css`
728
- padding-right: ${v}px;
729
- `;
730
- }
731
-
732
- //#endregion
733
- //#region src/utils/gap.ts
734
- function gap(v1, v2) {
735
- return styled_components.css`
736
- gap: ${v1}px ${pxIfNum(v2)};
737
- `;
738
- }
739
- function rowGap(v) {
740
- return styled_components.css`
741
- row-gap: ${v}px;
742
- `;
743
- }
744
- function columnGap(v) {
745
- return styled_components.css`
746
- column-gap: ${v}px;
747
- `;
748
- }
749
-
750
- //#endregion
751
- //#region src/utils/addThemeUtils.ts
752
- /**
753
- * Adds some utilities to the theme object.
754
- * They can be used as an alternative `createTheme`(`theme(o=>)`) for styling.
755
- */
756
- function addThemeUtils(theme) {
757
- return {
758
- ...theme,
759
- utils: {
760
- margin,
761
- marginTop,
762
- marginLeft,
763
- marginBottom,
764
- marginRight,
765
- padding,
766
- paddingTop,
767
- paddingLeft,
768
- paddingBottom,
769
- paddingRight,
770
- gap,
771
- rowGap,
772
- columnGap,
773
- typography,
774
- focusVisibleFocusRingCss,
775
- assertiveRingCss,
776
- disabledCss
777
- }
778
- };
779
- }
780
-
781
- //#endregion
782
- //#region src/index.ts
783
- const nonBlank = (value) => isPresent(value) && value !== false;
784
- /**
785
- * @deprecated
786
- * 実行時のパフォーマンスが低い問題があります。
787
- * ref. https://github.com/pixiv/charcoal/pull/377
788
- *
789
- * styled-components の theming 方法を推奨します。
790
- * ref. https://styled-components.com/docs/advanced#theming
791
- *
792
- * `theme(o => [...])` の `theme` ユーティリティを構築する
793
- *
794
- * @param _styled - DEPRECATED: styled-components の `styled` そのものを渡すとそれを元に型推論ができる。が、型引数を渡す方が型推論が高速になりやすい
795
- *
796
- * @example
797
- *
798
- * import styled from 'styled-components'
799
- * const theme = createTheme(styled)
800
- *
801
- * @example
802
- *
803
- * const theme = createTheme<DefaultTheme>()
804
- */
805
- function createTheme(_styled) {
806
- return function theme(specFn) {
807
- return function interpolate({ theme: theme$1 }) {
808
- if (!isPresent(theme$1)) throw noThemeProvider;
809
- return toCSSObjects([...wrapArray(
810
- /**
811
- * こう書いてはいけない
812
- *
813
- * ❌
814
- * ```ts
815
- * const o = createO(theme)
816
- * const declaration = spec(o)
817
- * ```
818
- *
819
- * `o` を一時変数に入れてしまうと型 `T` の具象化が行われるので関数内に書く
820
- */
821
- specFn(
822
- /** o = */
823
- createO(theme$1)
824
- )
825
- ), transition(theme$1)].filter(nonBlank));
826
- };
827
- };
828
- }
829
-
830
- //#endregion
831
- Object.defineProperty(exports, 'SetThemeScript', {
832
- enumerable: true,
833
- get: function () {
834
- return __charcoal_ui_react.SetThemeScript;
835
- }
836
- });
837
- exports.TokenInjector = TokenInjector;
838
- exports.addThemeUtils = addThemeUtils;
839
- exports.assertiveRingCss = assertiveRingCss;
840
- exports.createTheme = createTheme;
841
- exports.defineThemeVariables = defineThemeVariables;
842
- exports.disabledCss = disabledCss;
843
- exports.focusVisibleFocusRingCss = focusVisibleFocusRingCss;
844
- Object.defineProperty(exports, 'getThemeSync', {
845
- enumerable: true,
846
- get: function () {
847
- return __charcoal_ui_react.getThemeSync;
848
- }
849
- });
850
- Object.defineProperty(exports, 'makeSetThemeScriptCode', {
851
- enumerable: true,
852
- get: function () {
853
- return __charcoal_ui_react.makeSetThemeScriptCode;
854
- }
855
- });
856
- Object.defineProperty(exports, 'prefersColorScheme', {
857
- enumerable: true,
858
- get: function () {
859
- return __charcoal_ui_react.prefersColorScheme;
860
- }
861
- });
862
- exports.removeHalfLeadingCss = removeHalfLeadingCss;
863
- Object.defineProperty(exports, 'themeSelector', {
864
- enumerable: true,
865
- get: function () {
866
- return __charcoal_ui_react.themeSelector;
867
- }
868
- });
869
- Object.defineProperty(exports, 'themeSetter', {
870
- enumerable: true,
871
- get: function () {
872
- return __charcoal_ui_react.themeSetter;
873
- }
874
- });
875
- Object.defineProperty(exports, 'useLocalStorage', {
876
- enumerable: true,
877
- get: function () {
878
- return __charcoal_ui_react.useLocalStorage;
879
- }
880
- });
881
- Object.defineProperty(exports, 'useMedia', {
882
- enumerable: true,
883
- get: function () {
884
- return __charcoal_ui_react.useMedia;
885
- }
886
- });
887
- Object.defineProperty(exports, 'useTheme', {
888
- enumerable: true,
889
- get: function () {
890
- return __charcoal_ui_react.useTheme;
891
- }
892
- });
893
- Object.defineProperty(exports, 'useThemeSetter', {
894
- enumerable: true,
895
- get: function () {
896
- return __charcoal_ui_react.useThemeSetter;
897
- }
898
- });
63
+ `;function Q(e){return e===void 0?``:typeof e==`number`?`${e}px`:e}function ke(e,t,n,r){return d.css`
64
+ margin: ${Q(e)} ${Q(t)} ${Q(n)} ${Q(r)};
65
+ `}function Ae(e){return d.css`
66
+ margin-top: ${Q(e)};
67
+ `}function je(e){return d.css`
68
+ margin-bottom: ${Q(e)};
69
+ `}function Me(e){return d.css`
70
+ margin-left: ${Q(e)};
71
+ `}function Ne(e){return d.css`
72
+ margin-right: ${Q(e)};
73
+ `}function Pe(e,t,n,r){return d.css`
74
+ padding: ${e}px ${Q(t)} ${Q(n)} ${Q(r)};
75
+ `}function $(e){return d.css`
76
+ padding-top: ${e}px;
77
+ `}function Fe(e){return d.css`
78
+ padding-bottom: ${e}px;
79
+ `}function Ie(e){return d.css`
80
+ padding-left: ${e}px;
81
+ `}function Le(e){return d.css`
82
+ padding-right: ${e}px;
83
+ `}function Re(e,t){return d.css`
84
+ gap: ${e}px ${Q(t)};
85
+ `}function ze(e){return d.css`
86
+ row-gap: ${e}px;
87
+ `}function Be(e){return d.css`
88
+ column-gap: ${e}px;
89
+ `}function Ve(e){return{...e,utils:{margin:ke,marginTop:Ae,marginLeft:Me,marginBottom:je,marginRight:Ne,padding:Pe,paddingTop:$,paddingLeft:Ie,paddingBottom:Fe,paddingRight:Le,gap:Re,rowGap:ze,columnGap:Be,typography:Oe,focusVisibleFocusRingCss:Y,assertiveRingCss:Z,disabledCss:X}}}const He=e=>h(e)&&e!==!1;function Ue(e){return function(e){return function({theme:t}){if(!h(t))throw v;return k([...ee(e(Se(t))),ce(t)].filter(He))}}}Object.defineProperty(exports,`SetThemeScript`,{enumerable:!0,get:function(){return p.SetThemeScript}}),exports.TokenInjector=we,exports.addThemeUtils=Ve,exports.assertiveRingCss=Z,exports.createTheme=Ue,exports.defineThemeVariables=y,exports.disabledCss=X,exports.focusVisibleFocusRingCss=Y,Object.defineProperty(exports,`getThemeSync`,{enumerable:!0,get:function(){return p.getThemeSync}}),Object.defineProperty(exports,`makeSetThemeScriptCode`,{enumerable:!0,get:function(){return p.makeSetThemeScriptCode}}),Object.defineProperty(exports,`prefersColorScheme`,{enumerable:!0,get:function(){return p.prefersColorScheme}}),exports.removeHalfLeadingCss=J,Object.defineProperty(exports,`themeSelector`,{enumerable:!0,get:function(){return p.themeSelector}}),Object.defineProperty(exports,`themeSetter`,{enumerable:!0,get:function(){return p.themeSetter}}),Object.defineProperty(exports,`useLocalStorage`,{enumerable:!0,get:function(){return p.useLocalStorage}}),Object.defineProperty(exports,`useMedia`,{enumerable:!0,get:function(){return p.useMedia}}),Object.defineProperty(exports,`useTheme`,{enumerable:!0,get:function(){return p.useTheme}}),Object.defineProperty(exports,`useThemeSetter`,{enumerable:!0,get:function(){return p.useThemeSetter}});
899
90
  //# sourceMappingURL=index.cjs.map