@camp.dev/bones 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -106
- package/package.json +4 -36
- package/src/css/bones.css +1008 -134
- package/dist/core/attributes.d.mts +0 -25
- package/dist/core/attributes.mjs +0 -36
- package/dist/css/auto.css +0 -1105
- package/dist/css/bones.css +0 -197
- package/dist/element/boundary.d.mts +0 -26
- package/dist/element/boundary.mjs +0 -220
- package/dist/element/index.d.mts +0 -14
- package/dist/element/index.mjs +0 -6
- package/dist/element/measure.mjs +0 -99
- package/dist/element/overlay.mjs +0 -184
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +0 -2
- package/dist/react/boundary.d.mts +0 -40
- package/dist/react/boundary.mjs +0 -21
- package/dist/react/create-bones.d.mts +0 -23
- package/dist/react/create-bones.mjs +0 -69
- package/dist/react/index.d.mts +0 -4
- package/dist/react/index.mjs +0 -4
- package/dist/server/bootstrap.d.mts +0 -4
- package/dist/server/bootstrap.mjs +0 -3
- package/dist/server/index.d.mts +0 -17
- package/dist/server/index.mjs +0 -57
- package/src/css/auto.css +0 -1105
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/core/attributes.d.ts
|
|
2
|
-
type BoneType = "text" | "block" | "container";
|
|
3
|
-
declare const MIN_MAX_BRAND: unique symbol;
|
|
4
|
-
interface MinMax {
|
|
5
|
-
readonly [MIN_MAX_BRAND]: true;
|
|
6
|
-
readonly min: number;
|
|
7
|
-
readonly max: number;
|
|
8
|
-
}
|
|
9
|
-
declare function minMax(min: number, max: number): MinMax;
|
|
10
|
-
declare function isMinMax(value: unknown): value is MinMax;
|
|
11
|
-
interface BoneOptions {
|
|
12
|
-
length?: number | MinMax;
|
|
13
|
-
contained?: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface BoneAttributes {
|
|
16
|
-
"data-bone": BoneType;
|
|
17
|
-
"aria-busy": true;
|
|
18
|
-
src?: string;
|
|
19
|
-
style?: Record<string, number>;
|
|
20
|
-
}
|
|
21
|
-
declare const TRANSPARENT_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
22
|
-
declare function resolveLength(length: number | MinMax | undefined, callIndex: number): number | undefined;
|
|
23
|
-
declare function boneAttributes(type: BoneType, options?: BoneOptions, callIndex?: number): BoneAttributes;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { BoneAttributes, BoneOptions, BoneType, MinMax, TRANSPARENT_PIXEL, boneAttributes, isMinMax, minMax, resolveLength };
|
package/dist/core/attributes.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//#region src/core/attributes.ts
|
|
2
|
-
const MIN_MAX_BRAND = Symbol("minMax");
|
|
3
|
-
function minMax(min, max) {
|
|
4
|
-
return {
|
|
5
|
-
[MIN_MAX_BRAND]: true,
|
|
6
|
-
min,
|
|
7
|
-
max
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
function isMinMax(value) {
|
|
11
|
-
return typeof value === "object" && value !== null && MIN_MAX_BRAND in value;
|
|
12
|
-
}
|
|
13
|
-
const TRANSPARENT_PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
14
|
-
function resolveLength(length, callIndex) {
|
|
15
|
-
if (length == null) return void 0;
|
|
16
|
-
if (typeof length === "number") return length;
|
|
17
|
-
const range = length.max - length.min + 1;
|
|
18
|
-
return length.min + (callIndex * 7 + 3) % range;
|
|
19
|
-
}
|
|
20
|
-
function boneAttributes(type, options, callIndex = 0) {
|
|
21
|
-
const attrs = {
|
|
22
|
-
"data-bone": type,
|
|
23
|
-
"aria-busy": true
|
|
24
|
-
};
|
|
25
|
-
if (type === "text") {
|
|
26
|
-
const style = {};
|
|
27
|
-
if (options?.contained) style["--bone-contained"] = 1;
|
|
28
|
-
const length = resolveLength(options?.length, callIndex);
|
|
29
|
-
if (length) style["--bone-length"] = length;
|
|
30
|
-
if (Object.keys(style).length > 0) attrs.style = style;
|
|
31
|
-
}
|
|
32
|
-
if (type === "block") attrs.src = TRANSPARENT_PIXEL;
|
|
33
|
-
return attrs;
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { TRANSPARENT_PIXEL, boneAttributes, isMinMax, minMax, resolveLength };
|