@wow-two-beta/ui 0.0.72 → 0.0.73
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.
|
@@ -25,11 +25,19 @@ function reverseStops(gradient) {
|
|
|
25
25
|
const stops = gradient.stops.map((stop, i) => ({ ...stop, color: gradient.stops[last - i].color }));
|
|
26
26
|
return { ...gradient, stops };
|
|
27
27
|
}
|
|
28
|
+
function withAngle(gradient, angle) {
|
|
29
|
+
return gradient.type === GradientType.Linear ? { ...gradient, angle } : gradient;
|
|
30
|
+
}
|
|
31
|
+
function withRadius(gradient, radius) {
|
|
32
|
+
return gradient.type === GradientType.Radial ? { ...gradient, radius } : gradient;
|
|
33
|
+
}
|
|
28
34
|
var Gradient = {
|
|
29
35
|
withStop,
|
|
30
|
-
reverseStops
|
|
36
|
+
reverseStops,
|
|
37
|
+
withAngle,
|
|
38
|
+
withRadius
|
|
31
39
|
};
|
|
32
40
|
|
|
33
41
|
export { Gradient, GradientType, color_exports };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-Y572FCSC.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-Y572FCSC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/domain/color/index.ts","../src/domain/color/GradientType.ts","../src/domain/color/Gradient.ts"],"names":[],"mappings":";;;AAAA,IAAA,aAAA,GAAA;AAAA,QAAA,CAAA,aAAA,EAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,YAAA,EAAA,MAAA;AAAA,CAAA,CAAA;;;ACCO,IAAM,YAAA,GAAe;AAAA;AAAA,EAE1B,MAAA,EAAQ,QAAA;AAAA;AAAA,EAER,MAAA,EAAQ;AACV;;;AC8BA,SAAS,QAAA,CAAS,QAAA,EAAoB,KAAA,EAAe,KAAA,EAAyB;AAC5E,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,KAAO,CAAA,KAAM,KAAA,GAAQ,EAAE,GAAG,IAAA,EAAM,KAAA,KAAU,IAAK,CAAA;AACvF,EAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAM;AAC9B;AAGA,SAAS,aAAa,QAAA,EAA8B;AAClD,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,KAAA,CAAM,MAAA,GAAS,CAAA;AACrC,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAA,CAAI,CAAC,MAAM,CAAA,MAAO,EAAE,GAAG,IAAA,EAAM,OAAO,QAAA,CAAS,KAAA,CAAM,OAAO,CAAC,CAAA,CAAG,OAAM,CAAE,CAAA;AACnG,EAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAM;AAC9B;AAGA,SAAS,SAAA,CAAU,UAAoB,KAAA,EAAyB;AAC9D,EAAA,OAAO,QAAA,CAAS,SAAS,YAAA,CAAa,MAAA,GAAS,EAAE,GAAG,QAAA,EAAU,OAAM,GAAI,QAAA;AAC1E;AAGA,SAAS,UAAA,CAAW,UAAoB,MAAA,EAA0B;AAChE,EAAA,OAAO,QAAA,CAAS,SAAS,YAAA,CAAa,MAAA,GAAS,EAAE,GAAG,QAAA,EAAU,QAAO,GAAI,QAAA;AAC3E;AAGO,IAAM,QAAA,GAAW;AAAA,EACtB,QAAA;AAAA,EACA,YAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF","file":"chunk-Y572FCSC.js","sourcesContent":["// color — domain module. Pure color value-types + operations (no React, no upward deps).\n\nexport { GradientType } from './GradientType';\nexport { Gradient } from './Gradient';\nexport type {\n GradientStop,\n LinearGradient,\n RadialGradient,\n} from './Gradient';\n","/** Defines the foreground gradient projection — linear or radial. */\nexport const GradientType = {\n /** Refers to a linear (directional) gradient. */\n Linear: 'linear',\n /** Refers to a radial (center-out) gradient. */\n Radial: 'radial',\n} as const;\n\nexport type GradientType = (typeof GradientType)[keyof typeof GradientType];\n","import { GradientType } from './GradientType';\n\n/** Defines one color stop of a foreground gradient (the start / end of a two-stop fill). */\nexport interface GradientStop {\n /** The stop color, `#RRGGBB`. */\n color: string;\n /** The stop's position along the gradient, `0..1`. */\n offset: number;\n}\n\n/** Defines the shared gradient data — the color stops, independent of projection. */\ninterface GradientBase {\n /** The ordered color stops (two: start, end). */\n stops: GradientStop[];\n}\n\n/** Defines a linear (directional) gradient. */\nexport interface LinearGradient extends GradientBase {\n /** Discriminant — a linear projection. */\n type: typeof GradientType.Linear;\n /** Direction in degrees; `0` = left→right, `90` = top→bottom. */\n angle: number;\n}\n\n/** Defines a radial (center-out) gradient. */\nexport interface RadialGradient extends GradientBase {\n /** Discriminant — a radial projection. */\n type: typeof GradientType.Radial;\n /** Extent as a fraction (`0..1`) of the canvas half-size — smaller is tighter. */\n radius: number;\n}\n\n/** Defines a foreground gradient — a linear or radial projection over shared stops. */\nexport type Gradient = LinearGradient | RadialGradient;\n\n/** Returns the gradient with one stop's color replaced (by index). */\nfunction withStop(gradient: Gradient, index: number, color: string): Gradient {\n const stops = gradient.stops.map((stop, i) => (i === index ? { ...stop, color } : stop));\n return { ...gradient, stops };\n}\n\n/** Returns the gradient with its stop colors mirrored end-to-end, each offset kept — a symmetric flip for any stop count. */\nfunction reverseStops(gradient: Gradient): Gradient {\n const last = gradient.stops.length - 1;\n const stops = gradient.stops.map((stop, i) => ({ ...stop, color: gradient.stops[last - i]!.color }));\n return { ...gradient, stops };\n}\n\n/** Returns the gradient with its linear angle set (no-op on a radial gradient). */\nfunction withAngle(gradient: Gradient, angle: number): Gradient {\n return gradient.type === GradientType.Linear ? { ...gradient, angle } : gradient;\n}\n\n/** Returns the gradient with its radial radius set (no-op on a linear gradient). */\nfunction withRadius(gradient: Gradient, radius: number): Gradient {\n return gradient.type === GradientType.Radial ? { ...gradient, radius } : gradient;\n}\n\n/** Operations over a `Gradient` value — the companion to the `Gradient` type. */\nexport const Gradient = {\n withStop,\n reverseStops,\n withAngle,\n withRadius,\n};\n"]}
|
|
@@ -31,9 +31,15 @@ export type Gradient = LinearGradient | RadialGradient;
|
|
|
31
31
|
declare function withStop(gradient: Gradient, index: number, color: string): Gradient;
|
|
32
32
|
/** Returns the gradient with its stop colors mirrored end-to-end, each offset kept — a symmetric flip for any stop count. */
|
|
33
33
|
declare function reverseStops(gradient: Gradient): Gradient;
|
|
34
|
+
/** Returns the gradient with its linear angle set (no-op on a radial gradient). */
|
|
35
|
+
declare function withAngle(gradient: Gradient, angle: number): Gradient;
|
|
36
|
+
/** Returns the gradient with its radial radius set (no-op on a linear gradient). */
|
|
37
|
+
declare function withRadius(gradient: Gradient, radius: number): Gradient;
|
|
34
38
|
/** Operations over a `Gradient` value — the companion to the `Gradient` type. */
|
|
35
39
|
export declare const Gradient: {
|
|
36
40
|
withStop: typeof withStop;
|
|
37
41
|
reverseStops: typeof reverseStops;
|
|
42
|
+
withAngle: typeof withAngle;
|
|
43
|
+
withRadius: typeof withRadius;
|
|
38
44
|
};
|
|
39
45
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export { primitives_exports as primitives } from './chunk-NY7OZGNY.js';
|
|
|
21
21
|
import './chunk-SVSFK6TB.js';
|
|
22
22
|
import './chunk-PCRID2JL.js';
|
|
23
23
|
export { themes_exports as themes } from './chunk-EI7EKA2V.js';
|
|
24
|
-
export { color_exports as color } from './chunk-
|
|
24
|
+
export { color_exports as color } from './chunk-Y572FCSC.js';
|
|
25
25
|
import './chunk-DCHYNTHI.js';
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
27
27
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/domain/color/index.ts","../src/domain/color/GradientType.ts","../src/domain/color/Gradient.ts"],"names":[],"mappings":";;;AAAA,IAAA,aAAA,GAAA;AAAA,QAAA,CAAA,aAAA,EAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,YAAA,EAAA,MAAA;AAAA,CAAA,CAAA;;;ACCO,IAAM,YAAA,GAAe;AAAA;AAAA,EAE1B,MAAA,EAAQ,QAAA;AAAA;AAAA,EAER,MAAA,EAAQ;AACV;;;AC8BA,SAAS,QAAA,CAAS,QAAA,EAAoB,KAAA,EAAe,KAAA,EAAyB;AAC5E,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,KAAO,CAAA,KAAM,KAAA,GAAQ,EAAE,GAAG,IAAA,EAAM,KAAA,KAAU,IAAK,CAAA;AACvF,EAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAM;AAC9B;AAGA,SAAS,aAAa,QAAA,EAA8B;AAClD,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,KAAA,CAAM,MAAA,GAAS,CAAA;AACrC,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAA,CAAI,CAAC,MAAM,CAAA,MAAO,EAAE,GAAG,IAAA,EAAM,OAAO,QAAA,CAAS,KAAA,CAAM,OAAO,CAAC,CAAA,CAAG,OAAM,CAAE,CAAA;AACnG,EAAA,OAAO,EAAE,GAAG,QAAA,EAAU,KAAA,EAAM;AAC9B;AAGO,IAAM,QAAA,GAAW;AAAA,EACtB,QAAA;AAAA,EACA;AACF","file":"chunk-DQGWGXDZ.js","sourcesContent":["// color — domain module. Pure color value-types + operations (no React, no upward deps).\n\nexport { GradientType } from './GradientType';\nexport { Gradient } from './Gradient';\nexport type {\n GradientStop,\n LinearGradient,\n RadialGradient,\n} from './Gradient';\n","/** Defines the foreground gradient projection — linear or radial. */\nexport const GradientType = {\n /** Refers to a linear (directional) gradient. */\n Linear: 'linear',\n /** Refers to a radial (center-out) gradient. */\n Radial: 'radial',\n} as const;\n\nexport type GradientType = (typeof GradientType)[keyof typeof GradientType];\n","import { GradientType } from './GradientType';\n\n/** Defines one color stop of a foreground gradient (the start / end of a two-stop fill). */\nexport interface GradientStop {\n /** The stop color, `#RRGGBB`. */\n color: string;\n /** The stop's position along the gradient, `0..1`. */\n offset: number;\n}\n\n/** Defines the shared gradient data — the color stops, independent of projection. */\ninterface GradientBase {\n /** The ordered color stops (two: start, end). */\n stops: GradientStop[];\n}\n\n/** Defines a linear (directional) gradient. */\nexport interface LinearGradient extends GradientBase {\n /** Discriminant — a linear projection. */\n type: typeof GradientType.Linear;\n /** Direction in degrees; `0` = left→right, `90` = top→bottom. */\n angle: number;\n}\n\n/** Defines a radial (center-out) gradient. */\nexport interface RadialGradient extends GradientBase {\n /** Discriminant — a radial projection. */\n type: typeof GradientType.Radial;\n /** Extent as a fraction (`0..1`) of the canvas half-size — smaller is tighter. */\n radius: number;\n}\n\n/** Defines a foreground gradient — a linear or radial projection over shared stops. */\nexport type Gradient = LinearGradient | RadialGradient;\n\n/** Returns the gradient with one stop's color replaced (by index). */\nfunction withStop(gradient: Gradient, index: number, color: string): Gradient {\n const stops = gradient.stops.map((stop, i) => (i === index ? { ...stop, color } : stop));\n return { ...gradient, stops };\n}\n\n/** Returns the gradient with its stop colors mirrored end-to-end, each offset kept — a symmetric flip for any stop count. */\nfunction reverseStops(gradient: Gradient): Gradient {\n const last = gradient.stops.length - 1;\n const stops = gradient.stops.map((stop, i) => ({ ...stop, color: gradient.stops[last - i]!.color }));\n return { ...gradient, stops };\n}\n\n/** Operations over a `Gradient` value — the companion to the `Gradient` type. */\nexport const Gradient = {\n withStop,\n reverseStops,\n};\n"]}
|