@contember/utilities 1.2.7 → 1.3.0-alpha.11
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/development/assert-types/AssertionError.cjs +9 -0
- package/dist/development/assert-types/AssertionError.cjs.map +1 -0
- package/dist/development/assert-types/AssertionError.js.map +1 -1
- package/dist/development/assert-types/Predicates.cjs +7 -0
- package/dist/development/assert-types/Predicates.cjs.map +1 -0
- package/dist/development/assert-types/Predicates.js +2 -103
- package/dist/development/assert-types/Predicates.js.map +1 -1
- package/dist/development/assert-types/assert.cjs +10 -0
- package/dist/development/assert-types/assert.cjs.map +1 -0
- package/dist/development/assert-types/assertNever.cjs +7 -0
- package/dist/development/assert-types/assertNever.cjs.map +1 -0
- package/dist/development/class-name/colorSchemeClassName.cjs +12 -0
- package/dist/development/class-name/colorSchemeClassName.cjs.map +1 -0
- package/dist/development/class-name/colorSchemeClassName.js +1 -5
- package/dist/development/class-name/colorSchemeClassName.js.map +1 -1
- package/dist/development/class-name/constants.cjs +7 -0
- package/dist/development/class-name/constants.cjs.map +1 -0
- package/dist/development/class-name/constants.js +1 -1
- package/dist/development/class-name/constants.js.map +1 -1
- package/dist/development/class-name/deduplicateClassName.cjs +7 -0
- package/dist/development/class-name/deduplicateClassName.cjs.map +1 -0
- package/dist/development/class-name/filterThemedClassName.cjs +46 -0
- package/dist/development/class-name/filterThemedClassName.cjs.map +1 -0
- package/dist/development/class-name/filterThemedClassName.js +8 -30
- package/dist/development/class-name/filterThemedClassName.js.map +1 -1
- package/dist/development/class-name/flatClassNameList.cjs +16 -0
- package/dist/development/class-name/flatClassNameList.cjs.map +1 -0
- package/dist/development/class-name/listClassName.cjs +9 -0
- package/dist/development/class-name/listClassName.cjs.map +1 -0
- package/dist/development/class-name/themeClassName.cjs +18 -0
- package/dist/development/class-name/themeClassName.cjs.map +1 -0
- package/dist/development/class-name/themeClassName.js +7 -7
- package/dist/development/class-name/themeClassName.js.map +1 -1
- package/dist/development/css-utilities/px.cjs +7 -0
- package/dist/development/css-utilities/px.cjs.map +1 -0
- package/dist/development/css-utilities/px.js.map +1 -1
- package/dist/development/data-utilities/dateToStringWithoutTimezone.cjs +20 -0
- package/dist/development/data-utilities/dateToStringWithoutTimezone.cjs.map +1 -0
- package/dist/development/data-utilities/dateToStringWithoutTimezone.js +20 -0
- package/dist/development/data-utilities/dateToStringWithoutTimezone.js.map +1 -0
- package/dist/development/deprecate/deprecate.cjs +6 -0
- package/dist/development/deprecate/deprecate.cjs.map +1 -0
- package/dist/development/deprecate/deprecate.js.map +1 -1
- package/dist/development/dom/dataAttribute.cjs +13 -0
- package/dist/development/dom/dataAttribute.cjs.map +1 -0
- package/dist/development/dom/getElementDimensions.cjs +22 -0
- package/dist/development/dom/getElementDimensions.cjs.map +1 -0
- package/dist/development/dom/getSizeFromResizeObserverEntry.cjs +24 -0
- package/dist/development/dom/getSizeFromResizeObserverEntry.cjs.map +1 -0
- package/dist/development/dom/shouldCancelStart.cjs +29 -0
- package/dist/development/dom/shouldCancelStart.cjs.map +1 -0
- package/dist/development/dom/shouldCancelStart.js +29 -0
- package/dist/development/dom/shouldCancelStart.js.map +1 -0
- package/dist/development/dom/stateDataAttributes.cjs +11 -0
- package/dist/development/dom/stateDataAttributes.cjs.map +1 -0
- package/dist/development/dom/stateDataAttributes.js.map +1 -1
- package/dist/development/dom/svgSizeProps.cjs +15 -0
- package/dist/development/dom/svgSizeProps.cjs.map +1 -0
- package/dist/development/dom/svgSizeProps.js.map +1 -1
- package/dist/development/functional/omit.cjs +15 -0
- package/dist/development/functional/omit.cjs.map +1 -0
- package/dist/development/functional/omit.js.map +1 -1
- package/dist/development/functional/pick.cjs +15 -0
- package/dist/development/functional/pick.cjs.map +1 -0
- package/dist/development/functional/pick.js.map +1 -1
- package/dist/development/functional/range.cjs +7 -0
- package/dist/development/functional/range.cjs.map +1 -0
- package/dist/development/index.cjs +56 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +6 -44
- package/dist/development/index.js.map +1 -1
- package/dist/development/string-utilities/kebabCase.cjs +8 -0
- package/dist/development/string-utilities/kebabCase.cjs.map +1 -0
- package/dist/production/assert-types/AssertionError.cjs +9 -0
- package/dist/production/assert-types/AssertionError.cjs.map +1 -0
- package/dist/production/assert-types/AssertionError.js.map +1 -1
- package/dist/production/assert-types/Predicates.cjs +7 -0
- package/dist/production/assert-types/Predicates.cjs.map +1 -0
- package/dist/production/assert-types/Predicates.js +2 -103
- package/dist/production/assert-types/Predicates.js.map +1 -1
- package/dist/production/assert-types/assert.cjs +10 -0
- package/dist/production/assert-types/assert.cjs.map +1 -0
- package/dist/production/assert-types/assertNever.cjs +7 -0
- package/dist/production/assert-types/assertNever.cjs.map +1 -0
- package/dist/production/class-name/colorSchemeClassName.cjs +12 -0
- package/dist/production/class-name/colorSchemeClassName.cjs.map +1 -0
- package/dist/production/class-name/colorSchemeClassName.js +1 -5
- package/dist/production/class-name/colorSchemeClassName.js.map +1 -1
- package/dist/production/class-name/constants.cjs +7 -0
- package/dist/production/class-name/constants.cjs.map +1 -0
- package/dist/production/class-name/constants.js +1 -1
- package/dist/production/class-name/constants.js.map +1 -1
- package/dist/production/class-name/deduplicateClassName.cjs +7 -0
- package/dist/production/class-name/deduplicateClassName.cjs.map +1 -0
- package/dist/production/class-name/filterThemedClassName.cjs +46 -0
- package/dist/production/class-name/filterThemedClassName.cjs.map +1 -0
- package/dist/production/class-name/filterThemedClassName.js +8 -30
- package/dist/production/class-name/filterThemedClassName.js.map +1 -1
- package/dist/production/class-name/flatClassNameList.cjs +16 -0
- package/dist/production/class-name/flatClassNameList.cjs.map +1 -0
- package/dist/production/class-name/listClassName.cjs +9 -0
- package/dist/production/class-name/listClassName.cjs.map +1 -0
- package/dist/production/class-name/themeClassName.cjs +18 -0
- package/dist/production/class-name/themeClassName.cjs.map +1 -0
- package/dist/production/class-name/themeClassName.js +7 -7
- package/dist/production/class-name/themeClassName.js.map +1 -1
- package/dist/production/css-utilities/px.cjs +7 -0
- package/dist/production/css-utilities/px.cjs.map +1 -0
- package/dist/production/css-utilities/px.js.map +1 -1
- package/dist/production/data-utilities/dateToStringWithoutTimezone.cjs +20 -0
- package/dist/production/data-utilities/dateToStringWithoutTimezone.cjs.map +1 -0
- package/dist/production/data-utilities/dateToStringWithoutTimezone.js +20 -0
- package/dist/production/data-utilities/dateToStringWithoutTimezone.js.map +1 -0
- package/dist/production/deprecate/deprecate.cjs +6 -0
- package/dist/production/deprecate/deprecate.cjs.map +1 -0
- package/dist/production/deprecate/deprecate.js.map +1 -1
- package/dist/production/dom/dataAttribute.cjs +13 -0
- package/dist/production/dom/dataAttribute.cjs.map +1 -0
- package/dist/production/dom/getElementDimensions.cjs +22 -0
- package/dist/production/dom/getElementDimensions.cjs.map +1 -0
- package/dist/production/dom/getSizeFromResizeObserverEntry.cjs +24 -0
- package/dist/production/dom/getSizeFromResizeObserverEntry.cjs.map +1 -0
- package/dist/production/dom/shouldCancelStart.cjs +29 -0
- package/dist/production/dom/shouldCancelStart.cjs.map +1 -0
- package/dist/production/dom/shouldCancelStart.js +29 -0
- package/dist/production/dom/shouldCancelStart.js.map +1 -0
- package/dist/production/dom/stateDataAttributes.cjs +11 -0
- package/dist/production/dom/stateDataAttributes.cjs.map +1 -0
- package/dist/production/dom/stateDataAttributes.js.map +1 -1
- package/dist/production/dom/svgSizeProps.cjs +15 -0
- package/dist/production/dom/svgSizeProps.cjs.map +1 -0
- package/dist/production/dom/svgSizeProps.js.map +1 -1
- package/dist/production/functional/omit.cjs +15 -0
- package/dist/production/functional/omit.cjs.map +1 -0
- package/dist/production/functional/omit.js.map +1 -1
- package/dist/production/functional/pick.cjs +15 -0
- package/dist/production/functional/pick.cjs.map +1 -0
- package/dist/production/functional/pick.js.map +1 -1
- package/dist/production/functional/range.cjs +7 -0
- package/dist/production/functional/range.cjs.map +1 -0
- package/dist/production/index.cjs +56 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +6 -44
- package/dist/production/index.js.map +1 -1
- package/dist/production/string-utilities/kebabCase.cjs +8 -0
- package/dist/production/string-utilities/kebabCase.cjs.map +1 -0
- package/dist/types/assert-types/Predicates.d.ts +0 -25
- package/dist/types/assert-types/Predicates.d.ts.map +1 -1
- package/dist/types/assert-types/types.d.ts +0 -3
- package/dist/types/assert-types/types.d.ts.map +1 -1
- package/dist/types/class-name/colorSchemeClassName.d.ts +3 -6
- package/dist/types/class-name/colorSchemeClassName.d.ts.map +1 -1
- package/dist/types/class-name/constants.d.ts +0 -18
- package/dist/types/class-name/constants.d.ts.map +1 -1
- package/dist/types/class-name/filterThemedClassName.d.ts +2 -2
- package/dist/types/class-name/filterThemedClassName.d.ts.map +1 -1
- package/dist/types/class-name/index.d.ts +0 -1
- package/dist/types/class-name/index.d.ts.map +1 -1
- package/dist/types/class-name/themeClassName.d.ts +6 -15
- package/dist/types/class-name/themeClassName.d.ts.map +1 -1
- package/dist/types/class-name/types.d.ts +0 -4
- package/dist/types/class-name/types.d.ts.map +1 -1
- package/dist/types/css-utilities/px.d.ts +6 -4
- package/dist/types/css-utilities/px.d.ts.map +1 -1
- package/dist/types/data-utilities/dateToStringWithoutTimezone.d.ts +4 -0
- package/dist/types/data-utilities/dateToStringWithoutTimezone.d.ts.map +1 -0
- package/dist/types/data-utilities/index.d.ts +2 -0
- package/dist/types/data-utilities/index.d.ts.map +1 -0
- package/dist/types/deprecate/index.d.ts +0 -1
- package/dist/types/deprecate/index.d.ts.map +1 -1
- package/dist/types/dom/index.d.ts +1 -3
- package/dist/types/dom/index.d.ts.map +1 -1
- package/dist/types/dom/shouldCancelStart.d.ts +4 -0
- package/dist/types/dom/shouldCancelStart.d.ts.map +1 -0
- package/dist/types/functional/index.d.ts +0 -2
- package/dist/types/functional/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/string-utilities/index.d.ts +0 -2
- package/dist/types/string-utilities/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/Narrow.d.ts +1 -2
- package/dist/types/types/Narrow.d.ts.map +1 -1
- package/dist/types/types/PolymorphicRefs.d.ts +2 -1
- package/dist/types/types/PolymorphicRefs.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +0 -9
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/assert-types/Predicates.ts +1 -86
- package/src/assert-types/types.ts +0 -4
- package/src/class-name/colorSchemeClassName.ts +5 -12
- package/src/class-name/constants.ts +1 -19
- package/src/class-name/filterThemedClassName.ts +14 -41
- package/src/class-name/index.ts +0 -1
- package/src/class-name/themeClassName.ts +11 -37
- package/src/class-name/types.ts +0 -10
- package/src/css-utilities/px.ts +0 -7
- package/src/data-utilities/dateToStringWithoutTimezone.ts +18 -0
- package/src/data-utilities/index.ts +1 -0
- package/src/deprecate/deprecate.ts +1 -1
- package/src/deprecate/index.ts +0 -1
- package/src/dom/index.ts +1 -3
- package/src/dom/shouldCancelStart.ts +32 -0
- package/src/functional/index.ts +0 -2
- package/src/index.ts +1 -0
- package/src/string-utilities/index.ts +0 -2
- package/src/types/Narrow.ts +1 -3
- package/src/types/PolymorphicRefs.ts +3 -1
- package/src/types/index.ts +0 -21
- package/dist/development/class-name/stateClassName.js +0 -11
- package/dist/development/class-name/stateClassName.js.map +0 -1
- package/dist/development/deprecate/fallback.js +0 -11
- package/dist/development/deprecate/fallback.js.map +0 -1
- package/dist/development/dom/getMatchingParentElement.js +0 -17
- package/dist/development/dom/getMatchingParentElement.js.map +0 -1
- package/dist/development/dom/isScrollable.js +0 -22
- package/dist/development/dom/isScrollable.js.map +0 -1
- package/dist/development/dom/parseTransformMatrix.js +0 -29
- package/dist/development/dom/parseTransformMatrix.js.map +0 -1
- package/dist/development/functional/extend.js +0 -33
- package/dist/development/functional/extend.js.map +0 -1
- package/dist/development/functional/setHasOneOf.js +0 -7
- package/dist/development/functional/setHasOneOf.js.map +0 -1
- package/dist/development/string-utilities/capitalize.js +0 -7
- package/dist/development/string-utilities/capitalize.js.map +0 -1
- package/dist/development/string-utilities/trimString.js +0 -8
- package/dist/development/string-utilities/trimString.js.map +0 -1
- package/dist/production/class-name/stateClassName.js +0 -11
- package/dist/production/class-name/stateClassName.js.map +0 -1
- package/dist/production/deprecate/fallback.js +0 -11
- package/dist/production/deprecate/fallback.js.map +0 -1
- package/dist/production/dom/getMatchingParentElement.js +0 -17
- package/dist/production/dom/getMatchingParentElement.js.map +0 -1
- package/dist/production/dom/isScrollable.js +0 -22
- package/dist/production/dom/isScrollable.js.map +0 -1
- package/dist/production/dom/parseTransformMatrix.js +0 -29
- package/dist/production/dom/parseTransformMatrix.js.map +0 -1
- package/dist/production/functional/extend.js +0 -33
- package/dist/production/functional/extend.js.map +0 -1
- package/dist/production/functional/setHasOneOf.js +0 -7
- package/dist/production/functional/setHasOneOf.js.map +0 -1
- package/dist/production/string-utilities/capitalize.js +0 -7
- package/dist/production/string-utilities/capitalize.js.map +0 -1
- package/dist/production/string-utilities/trimString.js +0 -8
- package/dist/production/string-utilities/trimString.js.map +0 -1
- package/dist/types/class-name/stateClassName.d.ts +0 -19
- package/dist/types/class-name/stateClassName.d.ts.map +0 -1
- package/dist/types/deprecate/fallback.d.ts +0 -2
- package/dist/types/deprecate/fallback.d.ts.map +0 -1
- package/dist/types/dom/getMatchingParentElement.d.ts +0 -2
- package/dist/types/dom/getMatchingParentElement.d.ts.map +0 -1
- package/dist/types/dom/isScrollable.d.ts +0 -7
- package/dist/types/dom/isScrollable.d.ts.map +0 -1
- package/dist/types/dom/parseTransformMatrix.d.ts +0 -15
- package/dist/types/dom/parseTransformMatrix.d.ts.map +0 -1
- package/dist/types/functional/extend.d.ts +0 -5
- package/dist/types/functional/extend.d.ts.map +0 -1
- package/dist/types/functional/setHasOneOf.d.ts +0 -2
- package/dist/types/functional/setHasOneOf.d.ts.map +0 -1
- package/dist/types/string-utilities/capitalize.d.ts +0 -2
- package/dist/types/string-utilities/capitalize.d.ts.map +0 -1
- package/dist/types/string-utilities/trimString.d.ts +0 -9
- package/dist/types/string-utilities/trimString.d.ts.map +0 -1
- package/dist/types/types/Any.d.ts +0 -4
- package/dist/types/types/Any.d.ts.map +0 -1
- package/dist/types/types/DeepPartial.d.ts +0 -4
- package/dist/types/types/DeepPartial.d.ts.map +0 -1
- package/dist/types/types/NonNullableRequired.d.ts +0 -4
- package/dist/types/types/NonNullableRequired.d.ts.map +0 -1
- package/dist/types/types/ObjectKeyValue.d.ts +0 -4
- package/dist/types/types/ObjectKeyValue.d.ts.map +0 -1
- package/dist/types/types/Primitive.d.ts +0 -2
- package/dist/types/types/Primitive.d.ts.map +0 -1
- package/dist/types/types/RequiredDeepPlainObject.d.ts +0 -4
- package/dist/types/types/RequiredDeepPlainObject.d.ts.map +0 -1
- package/dist/types/types/Try.d.ts +0 -2
- package/dist/types/types/Try.d.ts.map +0 -1
- package/dist/types/types/TypeofStringLiteral.d.ts +0 -2
- package/dist/types/types/TypeofStringLiteral.d.ts.map +0 -1
- package/src/class-name/stateClassName.ts +0 -32
- package/src/deprecate/fallback.ts +0 -7
- package/src/dom/getMatchingParentElement.ts +0 -13
- package/src/dom/isScrollable.ts +0 -24
- package/src/dom/parseTransformMatrix.ts +0 -35
- package/src/functional/extend.ts +0 -37
- package/src/functional/setHasOneOf.ts +0 -3
- package/src/string-utilities/capitalize.ts +0 -3
- package/src/string-utilities/trimString.ts +0 -12
- package/src/types/Any.ts +0 -3
- package/src/types/DeepPartial.ts +0 -7
- package/src/types/NonNullableRequired.ts +0 -1
- package/src/types/ObjectKeyValue.ts +0 -1
- package/src/types/Primitive.ts +0 -1
- package/src/types/RequiredDeepPlainObject.ts +0 -3
- package/src/types/Try.ts +0 -4
- package/src/types/TypeofStringLiteral.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Predicates.js","sources":["../../../src/assert-types/Predicates.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Predicates.js","sources":["../../../src/assert-types/Predicates.ts"],"sourcesContent":["export function isNonNegativeNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && value >= 0\n}\n"],"names":[],"mappings":"AAAO,SAAS,oBAAoB,OAAiC;AAC7D,SAAA,OAAO,UAAU,YAAY,SAAS;AAC9C;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const AssertionError = require("./AssertionError.cjs");
|
|
4
|
+
function assert(that = void 0, value, predicate) {
|
|
5
|
+
if (!predicate(value)) {
|
|
6
|
+
throw new AssertionError.AssertionError(value, that);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.assert = assert;
|
|
10
|
+
//# sourceMappingURL=assert.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.cjs","sources":["../../../src/assert-types/assert.ts"],"sourcesContent":["import { AssertionError } from './AssertionError'\nimport { Predicate } from './types'\n\nexport function assert<\n\tIn,\n\tOut extends In\n>(\n\tthat: string | undefined = undefined,\n\tvalue: In,\n\tpredicate: Predicate<In, Out>, // (value: In) => value is Out,\n): asserts value is Out {\n\tif (!predicate(value)) {\n\t\tthrow new AssertionError(value, that)\n\t}\n}\n"],"names":["AssertionError"],"mappings":";;;AAGO,SAAS,OAIf,OAA2B,QAC3B,OACA,WACuB;AACnB,MAAA,CAAC,UAAU,KAAK,GAAG;AAChB,UAAA,IAAIA,eAAe,eAAA,OAAO,IAAI;AAAA,EACrC;AACD;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function assertNever(_) {
|
|
4
|
+
throw new Error("Exhaustive Error: This line should never be reached.");
|
|
5
|
+
}
|
|
6
|
+
exports.assertNever = assertNever;
|
|
7
|
+
//# sourceMappingURL=assertNever.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertNever.cjs","sources":["../../../src/assert-types/assertNever.ts"],"sourcesContent":["export function assertNever(_: never): never {\n\tthrow new Error('Exhaustive Error: This line should never be reached.')\n}\n"],"names":[],"mappings":";;AAAO,SAAS,YAAY,GAAiB;AACtC,QAAA,IAAI,MAAM,sDAAsD;AACvE;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const constants = require("./constants.cjs");
|
|
4
|
+
function colorSchemeClassName(scheme) {
|
|
5
|
+
return typeof scheme === "string" ? `scheme-${scheme}` : void 0;
|
|
6
|
+
}
|
|
7
|
+
function isColorSchemeClassName(value) {
|
|
8
|
+
return constants.COLOR_SCHEME_CLASS_NAME_REG_EXP.test(value);
|
|
9
|
+
}
|
|
10
|
+
exports.colorSchemeClassName = colorSchemeClassName;
|
|
11
|
+
exports.isColorSchemeClassName = isColorSchemeClassName;
|
|
12
|
+
//# sourceMappingURL=colorSchemeClassName.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorSchemeClassName.cjs","sources":["../../../src/class-name/colorSchemeClassName.ts"],"sourcesContent":["import { COLOR_SCHEME_CLASS_NAME_REG_EXP } from './constants'\n\n/**\n * Returns a string with a color scheme class name, prefixed with `scheme-`\n *\n * @param scheme - Color scheme name\n * @returns A color scheme class name\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n *\n * return (\n * \t<div className={colorScheme}>\n * \t\t<button className={controlsThemeClassName}>Click me</button>\n * \t</div>\n *\n * // renders:\n * // <div class=\"scheme-system\">\n * // \t<button class=\"scheme-system theme-default-controls theme-danger-controls:hover\">Click me</button>\n * // </div>\n * ```\n */\nexport function colorSchemeClassName(scheme: string): string\nexport function colorSchemeClassName(scheme: string | null | undefined): string | undefined\nexport function colorSchemeClassName(scheme: string | null | undefined): string | undefined {\n\treturn typeof scheme === 'string' ? `scheme-${scheme}` : undefined\n}\n\n/**\n * Tests if a string is a color scheme CSS class\n * @param value - String to test\n * @returns `true` if the string is a color scheme CSS class\n * @internal\n */\nexport function isColorSchemeClassName(value: string) {\n\treturn COLOR_SCHEME_CLASS_NAME_REG_EXP.test(value)\n}\n"],"names":["COLOR_SCHEME_CLASS_NAME_REG_EXP"],"mappings":";;;AA0BO,SAAS,qBAAqB,QAAuD;AAC3F,SAAO,OAAO,WAAW,WAAW,UAAU,MAAM,KAAK;AAC1D;AAQO,SAAS,uBAAuB,OAAe;AAC9C,SAAAA,UAAA,gCAAgC,KAAK,KAAK;AAClD;;;"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { COLOR_SCHEME_CLASS_NAME_REG_EXP } from "./constants.js";
|
|
2
2
|
function colorSchemeClassName(scheme) {
|
|
3
|
-
|
|
4
|
-
return `scheme-${scheme}`;
|
|
5
|
-
} else {
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
3
|
+
return typeof scheme === "string" ? `scheme-${scheme}` : void 0;
|
|
8
4
|
}
|
|
9
5
|
function isColorSchemeClassName(value) {
|
|
10
6
|
return COLOR_SCHEME_CLASS_NAME_REG_EXP.test(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorSchemeClassName.js","sources":["../../../src/class-name/colorSchemeClassName.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"colorSchemeClassName.js","sources":["../../../src/class-name/colorSchemeClassName.ts"],"sourcesContent":["import { COLOR_SCHEME_CLASS_NAME_REG_EXP } from './constants'\n\n/**\n * Returns a string with a color scheme class name, prefixed with `scheme-`\n *\n * @param scheme - Color scheme name\n * @returns A color scheme class name\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n *\n * return (\n * \t<div className={colorScheme}>\n * \t\t<button className={controlsThemeClassName}>Click me</button>\n * \t</div>\n *\n * // renders:\n * // <div class=\"scheme-system\">\n * // \t<button class=\"scheme-system theme-default-controls theme-danger-controls:hover\">Click me</button>\n * // </div>\n * ```\n */\nexport function colorSchemeClassName(scheme: string): string\nexport function colorSchemeClassName(scheme: string | null | undefined): string | undefined\nexport function colorSchemeClassName(scheme: string | null | undefined): string | undefined {\n\treturn typeof scheme === 'string' ? `scheme-${scheme}` : undefined\n}\n\n/**\n * Tests if a string is a color scheme CSS class\n * @param value - String to test\n * @returns `true` if the string is a color scheme CSS class\n * @internal\n */\nexport function isColorSchemeClassName(value: string) {\n\treturn COLOR_SCHEME_CLASS_NAME_REG_EXP.test(value)\n}\n"],"names":[],"mappings":";AA0BO,SAAS,qBAAqB,QAAuD;AAC3F,SAAO,OAAO,WAAW,WAAW,UAAU,MAAM,KAAK;AAC1D;AAQO,SAAS,uBAAuB,OAAe;AAC9C,SAAA,gCAAgC,KAAK,KAAK;AAClD;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\w-]+?)(?:-(?<scope>content|controls))?$/;
|
|
4
|
+
const COLOR_SCHEME_CLASS_NAME_REG_EXP = /^scheme-(?<colorScheme>[a-z0-9]|[a-z0-9]+[a-z-]+[a-z])$/;
|
|
5
|
+
exports.COLOR_SCHEME_CLASS_NAME_REG_EXP = COLOR_SCHEME_CLASS_NAME_REG_EXP;
|
|
6
|
+
exports.THEME_CLASS_NAME_REG_EXP = THEME_CLASS_NAME_REG_EXP;
|
|
7
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../../src/class-name/constants.ts"],"sourcesContent":["/**\n * RegExp that matches theme class names\n *\n * @internal\n *\n * If theme is `default` then it will match:\n *\n * - theme-default\n * - theme-default-content\n * - theme-default-controls\n *\n * If theme is `brand-color` then it will match:\n *\n * - theme-brand-color\n * - theme-brand-color-content\n * - theme-brand-color-controls\n */\n\nexport const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\\w-]+?)(?:-(?<scope>content|controls))?$/\n\n/**\n * Regular expression for testing if a string is a color scheme CSS class\n * @internal\n */\nexport const COLOR_SCHEME_CLASS_NAME_REG_EXP = /^scheme-(?<colorScheme>[a-z0-9]|[a-z0-9]+[a-z-]+[a-z])$/\n"],"names":[],"mappings":";;AAkBO,MAAM,2BAA2B;AAMjC,MAAM,kCAAkC;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\w-]+?)(?:-(?<scope>content|controls))
|
|
1
|
+
const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\w-]+?)(?:-(?<scope>content|controls))?$/;
|
|
2
2
|
const COLOR_SCHEME_CLASS_NAME_REG_EXP = /^scheme-(?<colorScheme>[a-z0-9]|[a-z0-9]+[a-z-]+[a-z])$/;
|
|
3
3
|
export {
|
|
4
4
|
COLOR_SCHEME_CLASS_NAME_REG_EXP,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../src/class-name/constants.ts"],"sourcesContent":["/**\n * RegExp that matches theme class names\n *\n * @internal\n *\n * If theme is `default` then it will match:\n *\n * - theme-default\n * - theme-default
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/class-name/constants.ts"],"sourcesContent":["/**\n * RegExp that matches theme class names\n *\n * @internal\n *\n * If theme is `default` then it will match:\n *\n * - theme-default\n * - theme-default-content\n * - theme-default-controls\n *\n * If theme is `brand-color` then it will match:\n *\n * - theme-brand-color\n * - theme-brand-color-content\n * - theme-brand-color-controls\n */\n\nexport const THEME_CLASS_NAME_REG_EXP = /^theme-(?<name>[\\w-]+?)(?:-(?<scope>content|controls))?$/\n\n/**\n * Regular expression for testing if a string is a color scheme CSS class\n * @internal\n */\nexport const COLOR_SCHEME_CLASS_NAME_REG_EXP = /^scheme-(?<colorScheme>[a-z0-9]|[a-z0-9]+[a-z-]+[a-z])$/\n"],"names":[],"mappings":"AAkBO,MAAM,2BAA2B;AAMjC,MAAM,kCAAkC;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function deduplicateClassName(classNameArray) {
|
|
4
|
+
return [...new Set(classNameArray)];
|
|
5
|
+
}
|
|
6
|
+
exports.deduplicateClassName = deduplicateClassName;
|
|
7
|
+
//# sourceMappingURL=deduplicateClassName.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deduplicateClassName.cjs","sources":["../../../src/class-name/deduplicateClassName.ts"],"sourcesContent":["export function deduplicateClassName(classNameArray: string[]): string[] {\n\treturn [...new Set(classNameArray)]\n}\n"],"names":[],"mappings":";;AAAO,SAAS,qBAAqB,gBAAoC;AACxE,SAAO,CAAC,GAAG,IAAI,IAAI,cAAc,CAAC;AACnC;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const colorSchemeClassName = require("./colorSchemeClassName.cjs");
|
|
4
|
+
const constants = require("./constants.cjs");
|
|
5
|
+
const flatClassNameList = require("./flatClassNameList.cjs");
|
|
6
|
+
const themeClassName = require("./themeClassName.cjs");
|
|
7
|
+
function filterThemedClassName(nestedClassName, defaultColorSchemeContext) {
|
|
8
|
+
const theme = { content: void 0, controls: void 0 };
|
|
9
|
+
let colorScheme = void 0;
|
|
10
|
+
const flatClassName = flatClassNameList.flatClassNameList(nestedClassName).map((className) => {
|
|
11
|
+
if (colorSchemeClassName.isColorSchemeClassName(className)) {
|
|
12
|
+
colorScheme = className;
|
|
13
|
+
return void 0;
|
|
14
|
+
}
|
|
15
|
+
const match = className.match(constants.THEME_CLASS_NAME_REG_EXP);
|
|
16
|
+
if (match) {
|
|
17
|
+
const name = match.groups.name;
|
|
18
|
+
const scope = match.groups.scope;
|
|
19
|
+
if (!scope) {
|
|
20
|
+
theme.content = name;
|
|
21
|
+
theme.controls = name;
|
|
22
|
+
} else if (scope === "content") {
|
|
23
|
+
theme.content = name;
|
|
24
|
+
} else if (scope === "controls") {
|
|
25
|
+
theme.controls = name;
|
|
26
|
+
} else {
|
|
27
|
+
throw new Error(`Unknown theme scope: ${scope}`);
|
|
28
|
+
}
|
|
29
|
+
return void 0;
|
|
30
|
+
} else {
|
|
31
|
+
return className;
|
|
32
|
+
}
|
|
33
|
+
}).filter(Boolean);
|
|
34
|
+
const themeClassNames = [];
|
|
35
|
+
const content = themeClassName.contentThemeClassName(theme.content);
|
|
36
|
+
const controls = themeClassName.controlsThemeClassName(theme.controls);
|
|
37
|
+
themeClassNames.push(content, controls);
|
|
38
|
+
const flatThemedClassName = flatClassNameList.flatClassNameList(themeClassNames);
|
|
39
|
+
if (flatThemedClassName.length > 0 || colorScheme) {
|
|
40
|
+
return [colorScheme ?? defaultColorSchemeContext, ...flatThemedClassName, ...flatClassName];
|
|
41
|
+
} else {
|
|
42
|
+
return flatClassName;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.filterThemedClassName = filterThemedClassName;
|
|
46
|
+
//# sourceMappingURL=filterThemedClassName.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterThemedClassName.cjs","sources":["../../../src/class-name/filterThemedClassName.ts"],"sourcesContent":["import { isColorSchemeClassName } from './colorSchemeClassName'\nimport { THEME_CLASS_NAME_REG_EXP } from './constants'\nimport { flatClassNameList } from './flatClassNameList'\nimport { contentThemeClassName, controlsThemeClassName } from './themeClassName'\nimport { NestedClassName } from './types'\n\nexport type ThemeConfig = { content: string | undefined, controls: string | undefined }\n\nexport function filterThemedClassName(\n\tnestedClassName: NestedClassName,\n\tdefaultColorSchemeContext: string,\n) {\n\tconst theme: ThemeConfig = { content: undefined, controls: undefined }\n\tlet colorScheme: string | undefined = undefined\n\n\tconst flatClassName = flatClassNameList(nestedClassName).map(className => {\n\t\tif (isColorSchemeClassName(className)) {\n\t\t\tcolorScheme = className\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst match = className.match(THEME_CLASS_NAME_REG_EXP)\n\n\t\tif (match) {\n\t\t\tconst name = match.groups!.name\n\t\t\tconst scope = match.groups!.scope\n\n\t\t\tif (!scope) {\n\t\t\t\ttheme.content = name\n\t\t\t\ttheme.controls = name\n\t\t\t} else if (scope === 'content') {\n\t\t\t\ttheme.content = name\n\t\t\t} else if (scope === 'controls') {\n\t\t\t\ttheme.controls = name\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Unknown theme scope: ${scope}`)\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn className\n\t\t}\n\t}).filter(Boolean) as string[]\n\n\tconst themeClassNames: (string | undefined)[] = []\n\n\tconst content = contentThemeClassName(theme.content)\n\tconst controls = controlsThemeClassName(theme.controls)\n\n\tthemeClassNames.push(content, controls)\n\n\tconst flatThemedClassName = flatClassNameList(themeClassNames)\n\n\tif (flatThemedClassName.length > 0 || colorScheme) {\n\t\treturn [colorScheme ?? defaultColorSchemeContext, ...flatThemedClassName, ...flatClassName]\n\t} else {\n\t\treturn flatClassName\n\t}\n}\n"],"names":["flatClassNameList","isColorSchemeClassName","THEME_CLASS_NAME_REG_EXP","contentThemeClassName","controlsThemeClassName"],"mappings":";;;;;;AAQgB,SAAA,sBACf,iBACA,2BACC;AACD,QAAM,QAAqB,EAAE,SAAS,QAAW,UAAU;AAC3D,MAAI,cAAkC;AAEtC,QAAM,gBAAgBA,kBAAAA,kBAAkB,eAAe,EAAE,IAAI,CAAa,cAAA;AACrE,QAAAC,qBAAAA,uBAAuB,SAAS,GAAG;AACxB,oBAAA;AACP,aAAA;AAAA,IACR;AAEM,UAAA,QAAQ,UAAU,MAAMC,UAAwB,wBAAA;AAEtD,QAAI,OAAO;AACJ,YAAA,OAAO,MAAM,OAAQ;AACrB,YAAA,QAAQ,MAAM,OAAQ;AAE5B,UAAI,CAAC,OAAO;AACX,cAAM,UAAU;AAChB,cAAM,WAAW;AAAA,MAAA,WACP,UAAU,WAAW;AAC/B,cAAM,UAAU;AAAA,MAAA,WACN,UAAU,YAAY;AAChC,cAAM,WAAW;AAAA,MAAA,OACX;AACN,cAAM,IAAI,MAAM,wBAAwB,KAAK,EAAE;AAAA,MAChD;AAEO,aAAA;AAAA,IAAA,OACD;AACC,aAAA;AAAA,IACR;AAAA,EAAA,CACA,EAAE,OAAO,OAAO;AAEjB,QAAM,kBAA0C,CAAA;AAE1C,QAAA,UAAUC,eAAAA,sBAAsB,MAAM,OAAO;AAC7C,QAAA,WAAWC,eAAAA,uBAAuB,MAAM,QAAQ;AAEtC,kBAAA,KAAK,SAAS,QAAQ;AAEhC,QAAA,sBAAsBJ,oCAAkB,eAAe;AAEzD,MAAA,oBAAoB,SAAS,KAAK,aAAa;AAClD,WAAO,CAAC,eAAe,2BAA2B,GAAG,qBAAqB,GAAG,aAAa;AAAA,EAAA,OACpF;AACC,WAAA;AAAA,EACR;AACD;;"}
|
|
@@ -4,7 +4,6 @@ import { flatClassNameList } from "./flatClassNameList.js";
|
|
|
4
4
|
import { contentThemeClassName, controlsThemeClassName } from "./themeClassName.js";
|
|
5
5
|
function filterThemedClassName(nestedClassName, defaultColorSchemeContext) {
|
|
6
6
|
const theme = { content: void 0, controls: void 0 };
|
|
7
|
-
const stateThemes = {};
|
|
8
7
|
let colorScheme = void 0;
|
|
9
8
|
const flatClassName = flatClassNameList(nestedClassName).map((className) => {
|
|
10
9
|
if (isColorSchemeClassName(className)) {
|
|
@@ -15,30 +14,15 @@ function filterThemedClassName(nestedClassName, defaultColorSchemeContext) {
|
|
|
15
14
|
if (match) {
|
|
16
15
|
const name = match.groups.name;
|
|
17
16
|
const scope = match.groups.scope;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
stateThemes[state].content = name;
|
|
26
|
-
} else if (scope === "controls") {
|
|
27
|
-
stateThemes[state].controls = name;
|
|
28
|
-
} else {
|
|
29
|
-
throw new Error(`Unknown theme scope: ${scope}`);
|
|
30
|
-
}
|
|
17
|
+
if (!scope) {
|
|
18
|
+
theme.content = name;
|
|
19
|
+
theme.controls = name;
|
|
20
|
+
} else if (scope === "content") {
|
|
21
|
+
theme.content = name;
|
|
22
|
+
} else if (scope === "controls") {
|
|
23
|
+
theme.controls = name;
|
|
31
24
|
} else {
|
|
32
|
-
|
|
33
|
-
theme.content = name;
|
|
34
|
-
theme.controls = name;
|
|
35
|
-
} else if (scope === "content") {
|
|
36
|
-
theme.content = name;
|
|
37
|
-
} else if (scope === "controls") {
|
|
38
|
-
theme.controls = name;
|
|
39
|
-
} else {
|
|
40
|
-
throw new Error(`Unknown theme scope: ${scope}`);
|
|
41
|
-
}
|
|
25
|
+
throw new Error(`Unknown theme scope: ${scope}`);
|
|
42
26
|
}
|
|
43
27
|
return void 0;
|
|
44
28
|
} else {
|
|
@@ -49,12 +33,6 @@ function filterThemedClassName(nestedClassName, defaultColorSchemeContext) {
|
|
|
49
33
|
const content = contentThemeClassName(theme.content);
|
|
50
34
|
const controls = controlsThemeClassName(theme.controls);
|
|
51
35
|
themeClassNames.push(content, controls);
|
|
52
|
-
for (const state in stateThemes) {
|
|
53
|
-
const { content: content2, controls: controls2 } = stateThemes[state];
|
|
54
|
-
const contentClassName = contentThemeClassName(content2, state);
|
|
55
|
-
const controlsClassName = controlsThemeClassName(controls2, state);
|
|
56
|
-
themeClassNames.push(contentClassName, controlsClassName);
|
|
57
|
-
}
|
|
58
36
|
const flatThemedClassName = flatClassNameList(themeClassNames);
|
|
59
37
|
if (flatThemedClassName.length > 0 || colorScheme) {
|
|
60
38
|
return [colorScheme ?? defaultColorSchemeContext, ...flatThemedClassName, ...flatClassName];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterThemedClassName.js","sources":["../../../src/class-name/filterThemedClassName.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"filterThemedClassName.js","sources":["../../../src/class-name/filterThemedClassName.ts"],"sourcesContent":["import { isColorSchemeClassName } from './colorSchemeClassName'\nimport { THEME_CLASS_NAME_REG_EXP } from './constants'\nimport { flatClassNameList } from './flatClassNameList'\nimport { contentThemeClassName, controlsThemeClassName } from './themeClassName'\nimport { NestedClassName } from './types'\n\nexport type ThemeConfig = { content: string | undefined, controls: string | undefined }\n\nexport function filterThemedClassName(\n\tnestedClassName: NestedClassName,\n\tdefaultColorSchemeContext: string,\n) {\n\tconst theme: ThemeConfig = { content: undefined, controls: undefined }\n\tlet colorScheme: string | undefined = undefined\n\n\tconst flatClassName = flatClassNameList(nestedClassName).map(className => {\n\t\tif (isColorSchemeClassName(className)) {\n\t\t\tcolorScheme = className\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst match = className.match(THEME_CLASS_NAME_REG_EXP)\n\n\t\tif (match) {\n\t\t\tconst name = match.groups!.name\n\t\t\tconst scope = match.groups!.scope\n\n\t\t\tif (!scope) {\n\t\t\t\ttheme.content = name\n\t\t\t\ttheme.controls = name\n\t\t\t} else if (scope === 'content') {\n\t\t\t\ttheme.content = name\n\t\t\t} else if (scope === 'controls') {\n\t\t\t\ttheme.controls = name\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Unknown theme scope: ${scope}`)\n\t\t\t}\n\n\t\t\treturn undefined\n\t\t} else {\n\t\t\treturn className\n\t\t}\n\t}).filter(Boolean) as string[]\n\n\tconst themeClassNames: (string | undefined)[] = []\n\n\tconst content = contentThemeClassName(theme.content)\n\tconst controls = controlsThemeClassName(theme.controls)\n\n\tthemeClassNames.push(content, controls)\n\n\tconst flatThemedClassName = flatClassNameList(themeClassNames)\n\n\tif (flatThemedClassName.length > 0 || colorScheme) {\n\t\treturn [colorScheme ?? defaultColorSchemeContext, ...flatThemedClassName, ...flatClassName]\n\t} else {\n\t\treturn flatClassName\n\t}\n}\n"],"names":[],"mappings":";;;;AAQgB,SAAA,sBACf,iBACA,2BACC;AACD,QAAM,QAAqB,EAAE,SAAS,QAAW,UAAU;AAC3D,MAAI,cAAkC;AAEtC,QAAM,gBAAgB,kBAAkB,eAAe,EAAE,IAAI,CAAa,cAAA;AACrE,QAAA,uBAAuB,SAAS,GAAG;AACxB,oBAAA;AACP,aAAA;AAAA,IACR;AAEM,UAAA,QAAQ,UAAU,MAAM,wBAAwB;AAEtD,QAAI,OAAO;AACJ,YAAA,OAAO,MAAM,OAAQ;AACrB,YAAA,QAAQ,MAAM,OAAQ;AAE5B,UAAI,CAAC,OAAO;AACX,cAAM,UAAU;AAChB,cAAM,WAAW;AAAA,MAAA,WACP,UAAU,WAAW;AAC/B,cAAM,UAAU;AAAA,MAAA,WACN,UAAU,YAAY;AAChC,cAAM,WAAW;AAAA,MAAA,OACX;AACN,cAAM,IAAI,MAAM,wBAAwB,KAAK,EAAE;AAAA,MAChD;AAEO,aAAA;AAAA,IAAA,OACD;AACC,aAAA;AAAA,IACR;AAAA,EAAA,CACA,EAAE,OAAO,OAAO;AAEjB,QAAM,kBAA0C,CAAA;AAE1C,QAAA,UAAU,sBAAsB,MAAM,OAAO;AAC7C,QAAA,WAAW,uBAAuB,MAAM,QAAQ;AAEtC,kBAAA,KAAK,SAAS,QAAQ;AAEhC,QAAA,sBAAsB,kBAAkB,eAAe;AAEzD,MAAA,oBAAoB,SAAS,KAAK,aAAa;AAClD,WAAO,CAAC,eAAe,2BAA2B,GAAG,qBAAqB,GAAG,aAAa;AAAA,EAAA,OACpF;AACC,WAAA;AAAA,EACR;AACD;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const assertNever = require("../assert-types/assertNever.cjs");
|
|
4
|
+
function flatClassNameList(className) {
|
|
5
|
+
if (!className) {
|
|
6
|
+
return [];
|
|
7
|
+
} else if (typeof className === "string") {
|
|
8
|
+
return className.split(" ").filter(Boolean);
|
|
9
|
+
} else if (Array.isArray(className)) {
|
|
10
|
+
return className.flatMap(flatClassNameList);
|
|
11
|
+
} else {
|
|
12
|
+
assertNever.assertNever();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.flatClassNameList = flatClassNameList;
|
|
16
|
+
//# sourceMappingURL=flatClassNameList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatClassNameList.cjs","sources":["../../../src/class-name/flatClassNameList.ts"],"sourcesContent":["import { assertNever } from '../assert-types'\nimport { NestedClassName } from './types'\n\nexport function flatClassNameList(className: NestedClassName): string[] {\n\tif (!className) {\n\t\treturn []\n\t} else if (typeof className === 'string') {\n\t\treturn className.split(' ').filter(Boolean)\n\t} else if (Array.isArray(className)) {\n\t\treturn className.flatMap(flatClassNameList)\n\t} else {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconsole.error(`Unexpected className: ${JSON.stringify(className)}`)\n\t\t}\n\n\t\tassertNever(className)\n\t}\n}\n"],"names":["assertNever"],"mappings":";;;AAGO,SAAS,kBAAkB,WAAsC;AACvE,MAAI,CAAC,WAAW;AACf,WAAO;EAAC,WACE,OAAO,cAAc,UAAU;AACzC,WAAO,UAAU,MAAM,GAAG,EAAE,OAAO,OAAO;AAAA,EAChC,WAAA,MAAM,QAAQ,SAAS,GAAG;AAC7B,WAAA,UAAU,QAAQ,iBAAiB;AAAA,EAAA,OACpC;AAKNA,gBAAAA,YAAqB;AAAA,EACtB;AACD;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const deduplicateClassName = require("./deduplicateClassName.cjs");
|
|
4
|
+
const flatClassNameList = require("./flatClassNameList.cjs");
|
|
5
|
+
function listClassName(list) {
|
|
6
|
+
return deduplicateClassName.deduplicateClassName(flatClassNameList.flatClassNameList(list)).join(" ");
|
|
7
|
+
}
|
|
8
|
+
exports.listClassName = listClassName;
|
|
9
|
+
//# sourceMappingURL=listClassName.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listClassName.cjs","sources":["../../../src/class-name/listClassName.ts"],"sourcesContent":["import { deduplicateClassName } from './deduplicateClassName'\nimport { flatClassNameList } from './flatClassNameList'\nimport { NestedClassName } from './types'\n\n/**\n * Combines a list of class names into a single string, even nested\n *\n * @param list - List of class names\n * @returns Combined class names as string\n */\nexport function listClassName(list: NestedClassName) {\n\treturn deduplicateClassName(flatClassNameList(list)).join(' ')\n}\n"],"names":["deduplicateClassName","flatClassNameList"],"mappings":";;;;AAUO,SAAS,cAAc,MAAuB;AACpD,SAAOA,qBAAAA,qBAAqBC,kBAAAA,kBAAkB,IAAI,CAAC,EAAE,KAAK,GAAG;AAC9D;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function contentThemeClassName(theme) {
|
|
4
|
+
return theme ? `theme-${theme}-content` : void 0;
|
|
5
|
+
}
|
|
6
|
+
function controlsThemeClassName(theme) {
|
|
7
|
+
return theme ? `theme-${theme}-controls` : void 0;
|
|
8
|
+
}
|
|
9
|
+
function themeClassName(theme) {
|
|
10
|
+
return [
|
|
11
|
+
contentThemeClassName(theme),
|
|
12
|
+
controlsThemeClassName(theme)
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
exports.contentThemeClassName = contentThemeClassName;
|
|
16
|
+
exports.controlsThemeClassName = controlsThemeClassName;
|
|
17
|
+
exports.themeClassName = themeClassName;
|
|
18
|
+
//# sourceMappingURL=themeClassName.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeClassName.cjs","sources":["../../../src/class-name/themeClassName.ts"],"sourcesContent":["/**\n * Returns a string with a content theme class name, prefixed with `theme-` and suffixed with `-content`\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for content\n * @returns A content theme class name\n *\n * @see {@link controlsThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const contentThemeClassName = contentThemeClassName('default')\n * // ^ 'theme-default-content'\n *\n * return (\n * \t<div className={`${colorScheme} ${contentThemeClassName}`}>\n * \t\t<button className={`${colorScheme} ${dangerOnMouseOverTheme}`}>Delete</button>\n * \t</div>\n * )\n * ```\n */\nexport function contentThemeClassName(theme: string | null | undefined): string | undefined {\n\treturn theme ? `theme-${theme}-content` : undefined\n}\n\n/**\n * Returns a string with a controls theme class name, prefixed with `theme-` and suffixed with `-controls`\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for controls\n * @returns A controls theme class name\n *\n * @see {@link contentThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const contentThemeClassName = contentThemeClassName('default')\n * // ^ 'theme-default-content'\n *\n * return (\n * \t<div className={`${colorScheme} ${contentThemeClassName}`}>\n * \t\t<button className={`${colorScheme} ${dangerOnMouseOverTheme}`}>Delete</button>\n * \t</div>\n * )\n * ```\n */\nexport function controlsThemeClassName(theme: string | null | undefined): string | undefined {\n\treturn theme ? `theme-${theme}-controls` : undefined\n}\n\n/**\n * Returns a tuple with a content theme class name and a controls theme class name, prefixed with `theme-` and suffixed with `-content` and `-controls` respectively\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for content and controls\n * @returns A tuple with a content theme class name and a controls theme class name\n *\n * @see {@link contentThemeClassName}\n * @see {@link controlsThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const errorTheme = themeClassName('danger').join(' ')\n * // ^ 'theme-danger-content theme-danger-controls'\n *\n * return (\n * \t<div className={`${colorScheme} ${errorTheme}`}>File not found</div>\n * )\n * ```\n */\nexport function themeClassName(\n\ttheme: string | null | undefined,\n) {\n\treturn [\n\t\tcontentThemeClassName(theme),\n\t\tcontrolsThemeClassName(theme),\n\t] as const\n}\n"],"names":[],"mappings":";;AAyBO,SAAS,sBAAsB,OAAsD;AACpF,SAAA,QAAQ,SAAS,KAAK,aAAa;AAC3C;AA2BO,SAAS,uBAAuB,OAAsD;AACrF,SAAA,QAAQ,SAAS,KAAK,cAAc;AAC5C;AA0BO,SAAS,eACf,OACC;AACM,SAAA;AAAA,IACN,sBAAsB,KAAK;AAAA,IAC3B,uBAAuB,KAAK;AAAA,EAAA;AAE9B;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function contentThemeClassName(theme
|
|
2
|
-
return theme ? `theme-${theme}-content
|
|
1
|
+
function contentThemeClassName(theme) {
|
|
2
|
+
return theme ? `theme-${theme}-content` : void 0;
|
|
3
3
|
}
|
|
4
|
-
function controlsThemeClassName(theme
|
|
5
|
-
return theme ? `theme-${theme}-controls
|
|
4
|
+
function controlsThemeClassName(theme) {
|
|
5
|
+
return theme ? `theme-${theme}-controls` : void 0;
|
|
6
6
|
}
|
|
7
|
-
function themeClassName(theme
|
|
7
|
+
function themeClassName(theme) {
|
|
8
8
|
return [
|
|
9
|
-
contentThemeClassName(theme
|
|
10
|
-
controlsThemeClassName(theme
|
|
9
|
+
contentThemeClassName(theme),
|
|
10
|
+
controlsThemeClassName(theme)
|
|
11
11
|
];
|
|
12
12
|
}
|
|
13
13
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeClassName.js","sources":["../../../src/class-name/themeClassName.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"themeClassName.js","sources":["../../../src/class-name/themeClassName.ts"],"sourcesContent":["/**\n * Returns a string with a content theme class name, prefixed with `theme-` and suffixed with `-content`\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for content\n * @returns A content theme class name\n *\n * @see {@link controlsThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const contentThemeClassName = contentThemeClassName('default')\n * // ^ 'theme-default-content'\n *\n * return (\n * \t<div className={`${colorScheme} ${contentThemeClassName}`}>\n * \t\t<button className={`${colorScheme} ${dangerOnMouseOverTheme}`}>Delete</button>\n * \t</div>\n * )\n * ```\n */\nexport function contentThemeClassName(theme: string | null | undefined): string | undefined {\n\treturn theme ? `theme-${theme}-content` : undefined\n}\n\n/**\n * Returns a string with a controls theme class name, prefixed with `theme-` and suffixed with `-controls`\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for controls\n * @returns A controls theme class name\n *\n * @see {@link contentThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const contentThemeClassName = contentThemeClassName('default')\n * // ^ 'theme-default-content'\n *\n * return (\n * \t<div className={`${colorScheme} ${contentThemeClassName}`}>\n * \t\t<button className={`${colorScheme} ${dangerOnMouseOverTheme}`}>Delete</button>\n * \t</div>\n * )\n * ```\n */\nexport function controlsThemeClassName(theme: string | null | undefined): string | undefined {\n\treturn theme ? `theme-${theme}-controls` : undefined\n}\n\n/**\n * Returns a tuple with a content theme class name and a controls theme class name, prefixed with `theme-` and suffixed with `-content` and `-controls` respectively\n *\n * IMPORTANT: Make sure to use color scheme class in combination with theme class names.\n *\n * @param theme - Theme name basis for content and controls\n * @returns A tuple with a content theme class name and a controls theme class name\n *\n * @see {@link contentThemeClassName}\n * @see {@link controlsThemeClassName}\n * @see {@link (colorSchemeClassName:3)}\n *\n * @example\n * ```tsx\n * const colorScheme = colorSchemeClassName('system')\n * // ^ 'scheme-system'\n * const errorTheme = themeClassName('danger').join(' ')\n * // ^ 'theme-danger-content theme-danger-controls'\n *\n * return (\n * \t<div className={`${colorScheme} ${errorTheme}`}>File not found</div>\n * )\n * ```\n */\nexport function themeClassName(\n\ttheme: string | null | undefined,\n) {\n\treturn [\n\t\tcontentThemeClassName(theme),\n\t\tcontrolsThemeClassName(theme),\n\t] as const\n}\n"],"names":[],"mappings":"AAyBO,SAAS,sBAAsB,OAAsD;AACpF,SAAA,QAAQ,SAAS,KAAK,aAAa;AAC3C;AA2BO,SAAS,uBAAuB,OAAsD;AACrF,SAAA,QAAQ,SAAS,KAAK,cAAc;AAC5C;AA0BO,SAAS,eACf,OACC;AACM,SAAA;AAAA,IACN,sBAAsB,KAAK;AAAA,IAC3B,uBAAuB,KAAK;AAAA,EAAA;AAE9B;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function px(value) {
|
|
4
|
+
return typeof value === "number" && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + "px" : "";
|
|
5
|
+
}
|
|
6
|
+
exports.px = px;
|
|
7
|
+
//# sourceMappingURL=px.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"px.cjs","sources":["../../../src/css-utilities/px.ts"],"sourcesContent":["/**\n * Converts a value to a string in the format '10px'\n *\n * @param value - The value to convert to a string.\n * @returns Returns a string in the format '10px' or '' when value is falsy.\n */\nexport function px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\n"],"names":[],"mappings":";;AAMO,SAAS,GAAgD,OAAmB;AAClF,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"px.js","sources":["../../../src/css-utilities/px.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"px.js","sources":["../../../src/css-utilities/px.ts"],"sourcesContent":["/**\n * Converts a value to a string in the format '10px'\n *\n * @param value - The value to convert to a string.\n * @returns Returns a string in the format '10px' or '' when value is falsy.\n */\nexport function px<V extends number | false | null | undefined>(value?: V): string {\n\treturn typeof value === 'number' && !(isNaN(value) || value === Infinity || value === -Infinity) ? value + 'px' : ''\n}\n"],"names":[],"mappings":"AAMO,SAAS,GAAgD,OAAmB;AAClF,SAAO,OAAO,UAAU,YAAY,EAAE,MAAM,KAAK,KAAK,UAAU,YAAY,UAAU,aAAa,QAAQ,OAAO;AACnH;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dateToStringWithoutTimezone = (date, { includeTime } = {}) => {
|
|
4
|
+
const [year, month, day] = [
|
|
5
|
+
date.getFullYear(),
|
|
6
|
+
(date.getMonth() + 1).toFixed(0).padStart(2, "0"),
|
|
7
|
+
date.getDate().toFixed(0).padStart(2, "0")
|
|
8
|
+
];
|
|
9
|
+
let serialized = `${year}-${month}-${day}`;
|
|
10
|
+
if (includeTime) {
|
|
11
|
+
const [hours, minutes] = [
|
|
12
|
+
date.getHours().toFixed(0).padStart(2, "0"),
|
|
13
|
+
date.getMinutes().toFixed(0).padStart(2, "0")
|
|
14
|
+
];
|
|
15
|
+
serialized += ` ${hours}:${minutes}`;
|
|
16
|
+
}
|
|
17
|
+
return serialized;
|
|
18
|
+
};
|
|
19
|
+
exports.dateToStringWithoutTimezone = dateToStringWithoutTimezone;
|
|
20
|
+
//# sourceMappingURL=dateToStringWithoutTimezone.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateToStringWithoutTimezone.cjs","sources":["../../../src/data-utilities/dateToStringWithoutTimezone.ts"],"sourcesContent":["export const dateToStringWithoutTimezone = (date: Date, { includeTime }: { includeTime?: boolean } = {}): string => {\n\tconst [year, month, day] = [\n\t\tdate.getFullYear(),\n\t\t(date.getMonth() + 1).toFixed(0).padStart(2, '0'),\n\t\tdate.getDate().toFixed(0).padStart(2, '0'),\n\t]\n\tlet serialized = `${year}-${month}-${day}`\n\n\tif (includeTime) {\n\t\tconst [hours, minutes] = [\n\t\t\tdate.getHours().toFixed(0).padStart(2, '0'),\n\t\t\tdate.getMinutes().toFixed(0).padStart(2, '0'),\n\t\t]\n\t\tserialized += ` ${hours}:${minutes}`\n\t}\n\n\treturn serialized\n}\n"],"names":[],"mappings":";;AAAO,MAAM,8BAA8B,CAAC,MAAY,EAAE,YAAY,IAA+B,CAAA,MAAe;AACnH,QAAM,CAAC,MAAM,OAAO,GAAG,IAAI;AAAA,IAC1B,KAAK,YAAY;AAAA,KAChB,KAAK,SAAa,IAAA,GAAG,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAChD,KAAK,UAAU,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,EAAA;AAE1C,MAAI,aAAa,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG;AAExC,MAAI,aAAa;AACV,UAAA,CAAC,OAAO,OAAO,IAAI;AAAA,MACxB,KAAK,WAAW,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,MAC1C,KAAK,aAAa,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAAA;AAE/B,kBAAA,IAAI,KAAK,IAAI,OAAO;AAAA,EACnC;AAEO,SAAA;AACR;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const dateToStringWithoutTimezone = (date, { includeTime } = {}) => {
|
|
2
|
+
const [year, month, day] = [
|
|
3
|
+
date.getFullYear(),
|
|
4
|
+
(date.getMonth() + 1).toFixed(0).padStart(2, "0"),
|
|
5
|
+
date.getDate().toFixed(0).padStart(2, "0")
|
|
6
|
+
];
|
|
7
|
+
let serialized = `${year}-${month}-${day}`;
|
|
8
|
+
if (includeTime) {
|
|
9
|
+
const [hours, minutes] = [
|
|
10
|
+
date.getHours().toFixed(0).padStart(2, "0"),
|
|
11
|
+
date.getMinutes().toFixed(0).padStart(2, "0")
|
|
12
|
+
];
|
|
13
|
+
serialized += ` ${hours}:${minutes}`;
|
|
14
|
+
}
|
|
15
|
+
return serialized;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
dateToStringWithoutTimezone
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=dateToStringWithoutTimezone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateToStringWithoutTimezone.js","sources":["../../../src/data-utilities/dateToStringWithoutTimezone.ts"],"sourcesContent":["export const dateToStringWithoutTimezone = (date: Date, { includeTime }: { includeTime?: boolean } = {}): string => {\n\tconst [year, month, day] = [\n\t\tdate.getFullYear(),\n\t\t(date.getMonth() + 1).toFixed(0).padStart(2, '0'),\n\t\tdate.getDate().toFixed(0).padStart(2, '0'),\n\t]\n\tlet serialized = `${year}-${month}-${day}`\n\n\tif (includeTime) {\n\t\tconst [hours, minutes] = [\n\t\t\tdate.getHours().toFixed(0).padStart(2, '0'),\n\t\t\tdate.getMinutes().toFixed(0).padStart(2, '0'),\n\t\t]\n\t\tserialized += ` ${hours}:${minutes}`\n\t}\n\n\treturn serialized\n}\n"],"names":[],"mappings":"AAAO,MAAM,8BAA8B,CAAC,MAAY,EAAE,YAAY,IAA+B,CAAA,MAAe;AACnH,QAAM,CAAC,MAAM,OAAO,GAAG,IAAI;AAAA,IAC1B,KAAK,YAAY;AAAA,KAChB,KAAK,SAAa,IAAA,GAAG,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAChD,KAAK,UAAU,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,EAAA;AAE1C,MAAI,aAAa,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG;AAExC,MAAI,aAAa;AACV,UAAA,CAAC,OAAO,OAAO,IAAI;AAAA,MACxB,KAAK,WAAW,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,MAC1C,KAAK,aAAa,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAAA;AAE/B,kBAAA,IAAI,KAAK,IAAI,OAAO;AAAA,EACnC;AAEO,SAAA;AACR;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecate.cjs","sources":["../../../src/deprecate/deprecate.ts"],"sourcesContent":["import { SemverString } from './types'\n\n/**\n * Logs a deprecation warning if the assertion is `false`.\n * @internal\n *\n * @param removal - Version when the deprecated feature will be removed\n * @param condition - Condition under which the deprecation warning will be logged\n * @param deprecated - Name of the deprecated feature\n * @param replacement - Name of the feature that replaces the deprecated feature\n *\n * @example\n * ```ts\n * const { visible } = props\n * deprecate(visible !== 'default', '1.3.0', '\"default\"', '\"hidden\"')\n * // Logs: Use of \"default\" is deprecated and might be removed in the next release. Use \"hidden\" instead.\n * ```\n */\nexport function deprecate(removal: SemverString, condition: boolean, deprecated: string, replacement: string | null): void {\n\tif (condition === true) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst shouldThrow = Boolean(import.meta.env.VITE_CONTEMBER_ADMIN_STRICT_DEPRECATIONS)\n\n\t\t\tif (shouldThrow) {\n\t\t\t\tthrow new Error(`Support for ${deprecated} was planned to be removed in the ${removal} release.${replacement ? ` Replace it with ${replacement} instead.` : 'Remove it.'}`)\n\t\t\t} else {\n\t\t\t\tconsole.warn(`Use of ${deprecated} is deprecated and might be removed in the next release.${replacement ? ` Use ${replacement} instead.` : ' There is no replacement.'}`)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAkBO,SAAS,UAAU,SAAuB,WAAoB,YAAoB,aAAkC;AAY3H;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecate.js","sources":["../../../src/deprecate/deprecate.ts"],"sourcesContent":["import { SemverString } from './types'\n\n/**\n * Logs a deprecation warning if the assertion is `false`.\n * @internal\n *\n * @param removal - Version when the deprecated feature will be removed\n * @param condition - Condition under which the deprecation warning will be logged\n * @param deprecated - Name of the deprecated feature\n * @param replacement - Name of the feature that replaces the deprecated feature\n *\n * @example\n * ```ts\n * const { visible } = props\n * deprecate(visible !== 'default', '1.3.0', '\"default\"', '\"hidden\"')\n * // Logs: Use of \"default\" is deprecated and might be removed in the next release. Use \"hidden\" instead.\n * ```\n */\nexport function deprecate(removal: SemverString, condition: boolean, deprecated: string, replacement: string | null): void {\n\tif (condition === true) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst shouldThrow = Boolean(import.meta.env.VITE_CONTEMBER_ADMIN_STRICT_DEPRECATIONS)\n\n\t\t\tif (shouldThrow) {\n\t\t\t\tthrow new Error(`Support for ${deprecated} was planned to be removed in the ${removal} release.${replacement ? ` Replace it with ${replacement} instead.` : 'Remove it.'}`)\n\t\t\t} else {\n\t\t\t\tconsole.warn(`Use of ${deprecated} is deprecated and might be removed in the next release.${replacement ? ` Use ${replacement} instead.` : 'There is no replacement.'}`)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAkBO,SAAS,UAAU,SAAuB,WAAoB,YAAoB,aAAkC;AAY3H;"}
|
|
1
|
+
{"version":3,"file":"deprecate.js","sources":["../../../src/deprecate/deprecate.ts"],"sourcesContent":["import { SemverString } from './types'\n\n/**\n * Logs a deprecation warning if the assertion is `false`.\n * @internal\n *\n * @param removal - Version when the deprecated feature will be removed\n * @param condition - Condition under which the deprecation warning will be logged\n * @param deprecated - Name of the deprecated feature\n * @param replacement - Name of the feature that replaces the deprecated feature\n *\n * @example\n * ```ts\n * const { visible } = props\n * deprecate(visible !== 'default', '1.3.0', '\"default\"', '\"hidden\"')\n * // Logs: Use of \"default\" is deprecated and might be removed in the next release. Use \"hidden\" instead.\n * ```\n */\nexport function deprecate(removal: SemverString, condition: boolean, deprecated: string, replacement: string | null): void {\n\tif (condition === true) {\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst shouldThrow = Boolean(import.meta.env.VITE_CONTEMBER_ADMIN_STRICT_DEPRECATIONS)\n\n\t\t\tif (shouldThrow) {\n\t\t\t\tthrow new Error(`Support for ${deprecated} was planned to be removed in the ${removal} release.${replacement ? ` Replace it with ${replacement} instead.` : 'Remove it.'}`)\n\t\t\t} else {\n\t\t\t\tconsole.warn(`Use of ${deprecated} is deprecated and might be removed in the next release.${replacement ? ` Use ${replacement} instead.` : ' There is no replacement.'}`)\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAkBO,SAAS,UAAU,SAAuB,WAAoB,YAAoB,aAAkC;AAY3H;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function dataAttribute(value) {
|
|
4
|
+
if (value === false || value === void 0 || value === null) {
|
|
5
|
+
return void 0;
|
|
6
|
+
} else if (value === true) {
|
|
7
|
+
return "";
|
|
8
|
+
} else {
|
|
9
|
+
return String(value);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.dataAttribute = dataAttribute;
|
|
13
|
+
//# sourceMappingURL=dataAttribute.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataAttribute.cjs","sources":["../../../src/dom/dataAttribute.ts"],"sourcesContent":["export function dataAttribute(value: unknown): string | true | undefined {\n\tif (value === false || value === undefined || value === null) {\n\t\treturn undefined\n\t} else if (value === true) {\n\t\t// Closest to HTML: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes\n\t\t// React issue: https://github.com/facebook/react/issues/24812\n\t\treturn ''\n\t} else {\n\t\treturn String(value)\n\t}\n}\n"],"names":[],"mappings":";;AAAO,SAAS,cAAc,OAA2C;AACxE,MAAI,UAAU,SAAS,UAAU,UAAa,UAAU,MAAM;AACtD,WAAA;AAAA,EAAA,WACG,UAAU,MAAM;AAGnB,WAAA;AAAA,EAAA,OACD;AACN,WAAO,OAAO,KAAK;AAAA,EACpB;AACD;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getElementDimensionsCallback(element, callback) {
|
|
4
|
+
const observer = new IntersectionObserver((entries, observer2) => {
|
|
5
|
+
if (entries.length === 1) {
|
|
6
|
+
callback(entries[0].boundingClientRect);
|
|
7
|
+
} else {
|
|
8
|
+
const entry = entries.find((entry2) => entry2.boundingClientRect.width > 0 || entry2.boundingClientRect.height > 0) || entries[0];
|
|
9
|
+
callback(entry.boundingClientRect);
|
|
10
|
+
}
|
|
11
|
+
observer2.disconnect();
|
|
12
|
+
});
|
|
13
|
+
observer.observe(element);
|
|
14
|
+
}
|
|
15
|
+
function getElementDimensions(element) {
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
getElementDimensionsCallback(element, resolve);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.getElementDimensions = getElementDimensions;
|
|
21
|
+
exports.getElementDimensionsCallback = getElementDimensionsCallback;
|
|
22
|
+
//# sourceMappingURL=getElementDimensions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getElementDimensions.cjs","sources":["../../../src/dom/getElementDimensions.ts"],"sourcesContent":["/**\n * Calls the callback with the element's dimensions.\n *\n * @param element - The element to observe for dimensions\n * @param callback - The callback to call with the element's dimensions\n */\nexport function getElementDimensionsCallback(\n\telement: HTMLElement,\n\tcallback: (dimensions: DOMRectReadOnly) => void,\n) {\n\tconst observer = new IntersectionObserver((entries, observer) => {\n\t\tif (entries.length === 1) {\n\t\t\tcallback(entries[0].boundingClientRect)\n\t\t} else {\n\t\t\tconst entry = entries.find(entry => entry.boundingClientRect.width > 0 || entry.boundingClientRect.height > 0) || entries[0]\n\t\t\tcallback(entry.boundingClientRect)\n\t\t}\n\n\t\tobserver.disconnect()\n\t})\n\n\tobserver.observe(element)\n}\n\n/**\n * Returns a promise that resolves with the element's dimensions.\n * @param element - The element to observe for dimensions\n * @returns A promise that resolves with the element's dimensions\n */\nexport function getElementDimensions(\n\telement: HTMLElement,\n): Promise<DOMRectReadOnly> {\n\treturn new Promise(resolve => {\n\t\tgetElementDimensionsCallback(element, resolve)\n\t})\n}\n"],"names":["observer","entry"],"mappings":";;AAMgB,SAAA,6BACf,SACA,UACC;AACD,QAAM,WAAW,IAAI,qBAAqB,CAAC,SAASA,cAAa;AAC5D,QAAA,QAAQ,WAAW,GAAG;AAChB,eAAA,QAAQ,CAAC,EAAE,kBAAkB;AAAA,IAAA,OAChC;AACN,YAAM,QAAQ,QAAQ,KAAK,CAAAC,WAASA,OAAM,mBAAmB,QAAQ,KAAKA,OAAM,mBAAmB,SAAS,CAAC,KAAK,QAAQ,CAAC;AAC3H,eAAS,MAAM,kBAAkB;AAAA,IAClC;AAEAD,cAAS,WAAW;AAAA,EAAA,CACpB;AAED,WAAS,QAAQ,OAAO;AACzB;AAOO,SAAS,qBACf,SAC2B;AACpB,SAAA,IAAI,QAAQ,CAAW,YAAA;AAC7B,iCAA6B,SAAS,OAAO;AAAA,EAAA,CAC7C;AACF;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getSizeFromResizeObserverEntryFactory(box) {
|
|
4
|
+
return function getSizeFromResizeObserverEntry(entry) {
|
|
5
|
+
const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
|
|
6
|
+
if (boxSize) {
|
|
7
|
+
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
|
|
8
|
+
return formatBoxSize.reduce(
|
|
9
|
+
(previous, { inlineSize, blockSize }) => ({
|
|
10
|
+
width: previous.width + inlineSize,
|
|
11
|
+
height: previous.height + blockSize
|
|
12
|
+
}),
|
|
13
|
+
{ height: 0, width: 0 }
|
|
14
|
+
);
|
|
15
|
+
} else {
|
|
16
|
+
return {
|
|
17
|
+
width: entry.contentRect.width,
|
|
18
|
+
height: entry.contentRect.height
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.getSizeFromResizeObserverEntryFactory = getSizeFromResizeObserverEntryFactory;
|
|
24
|
+
//# sourceMappingURL=getSizeFromResizeObserverEntry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSizeFromResizeObserverEntry.cjs","sources":["../../../src/dom/getSizeFromResizeObserverEntry.ts"],"sourcesContent":["export function getSizeFromResizeObserverEntryFactory(box: ResizeObserverOptions['box']) {\n\treturn function getSizeFromResizeObserverEntry(entry: ResizeObserverEntry): { height: number, width: number } {\n\t\tconst boxSize = box === 'border-box'\n\t\t\t? entry.borderBoxSize\n\t\t\t: box === 'content-box'\n\t\t\t\t? entry.contentBoxSize\n\t\t\t\t: entry.devicePixelContentBoxSize\n\n\t\tif (boxSize) {\n\t\t\tconst formatBoxSize: ResizeObserverSize[] = Array.isArray(boxSize) ? boxSize : [boxSize]\n\n\t\t\treturn formatBoxSize.reduce(\n\t\t\t\t(previous, { inlineSize, blockSize }) => ({\n\t\t\t\t\twidth: previous.width + inlineSize,\n\t\t\t\t\theight: previous.height + blockSize,\n\t\t\t\t}),\n\t\t\t\t{ height: 0, width: 0 },\n\t\t\t)\n\t\t} else {\n\t\t\treturn {\n\t\t\t\twidth: entry.contentRect.width,\n\t\t\t\theight: entry.contentRect.height,\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAAO,SAAS,sCAAsC,KAAmC;AACjF,SAAA,SAAS,+BAA+B,OAA+D;AACvG,UAAA,UAAU,QAAQ,eACrB,MAAM,gBACN,QAAQ,gBACP,MAAM,iBACN,MAAM;AAEV,QAAI,SAAS;AACZ,YAAM,gBAAsC,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAEvF,aAAO,cAAc;AAAA,QACpB,CAAC,UAAU,EAAE,YAAY,iBAAiB;AAAA,UACzC,OAAO,SAAS,QAAQ;AAAA,UACxB,QAAQ,SAAS,SAAS;AAAA,QAAA;AAAA,QAE3B,EAAE,QAAQ,GAAG,OAAO,EAAE;AAAA,MAAA;AAAA,IACvB,OACM;AACC,aAAA;AAAA,QACN,OAAO,MAAM,YAAY;AAAA,QACzB,QAAQ,MAAM,YAAY;AAAA,MAAA;AAAA,IAE5B;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const interactiveElements = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT", "OPTION", "BUTTON"]);
|
|
4
|
+
const shouldCancelStart = (event) => {
|
|
5
|
+
if (!(event.target instanceof Element)) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
let el = event.target;
|
|
9
|
+
while (el) {
|
|
10
|
+
if (el instanceof Element) {
|
|
11
|
+
if (interactiveElements.has(el.tagName)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (el.sortableHandle === true) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (el.getAttribute("data-slate-void") === "true") {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (el instanceof HTMLElement && el.contentEditable === "true") {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
el = el.parentNode;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
exports.shouldCancelStart = shouldCancelStart;
|
|
29
|
+
//# sourceMappingURL=shouldCancelStart.cjs.map
|