xxf_react 0.3.7 → 0.3.8

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.
@@ -1,7 +1,4 @@
1
1
  export * from './ScrollToCenter';
2
2
  export * from './Reload';
3
- export * from '../layout/resize/core/ResizeObserverHook';
4
- export * from '../layout/resize/core/SizedLayoutContext';
5
- export * from '../layout/resize/impl/SizedLayout';
6
- export * from '../layout/resize/impl/SizedContainer';
3
+ export * from './url-placholder';
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,0CAA0C,CAAA;AACxD,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,sCAAsC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
@@ -1,7 +1,4 @@
1
1
  'use client';
2
2
  export * from './ScrollToCenter';
3
3
  export * from './Reload';
4
- export * from '../layout/resize/core/ResizeObserverHook';
5
- export * from '../layout/resize/core/SizedLayoutContext';
6
- export * from '../layout/resize/impl/SizedLayout';
7
- export * from '../layout/resize/impl/SizedContainer';
4
+ export * from './url-placholder';
@@ -0,0 +1,14 @@
1
+ export declare const placeholderHost = "https://placehold.co";
2
+ /**
3
+ * 占位图
4
+ * */
5
+ export interface PlaceholderProps {
6
+ text?: string;
7
+ backgroundColor?: string;
8
+ textColor?: string;
9
+ }
10
+ /**
11
+ * 生成占位图 URL
12
+ */
13
+ export declare function urlPlaceholder(width: number, height: number, props?: PlaceholderProps): string;
14
+ //# sourceMappingURL=url-placholder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-placholder.d.ts","sourceRoot":"","sources":["../../src/utils/url-placholder.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,yBAAyB,CAAA;AAErD;;KAEK;AACL,MAAM,WAAW,gBAAgB;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,gBAAqB,GAC7B,MAAM,CAgBR"}
@@ -0,0 +1,17 @@
1
+ export const placeholderHost = "https://placehold.co";
2
+ /**
3
+ * 生成占位图 URL
4
+ */
5
+ export function urlPlaceholder(width, height, props = {}) {
6
+ const { text, backgroundColor, textColor } = props;
7
+ // 拼尺寸
8
+ const sizePart = `${width}x${height}`;
9
+ // 拼颜色参数(可选)
10
+ let colorPart = "";
11
+ if (backgroundColor && textColor) {
12
+ colorPart = `/${backgroundColor.replace("#", "")}/${textColor.replace("#", "")}`;
13
+ }
14
+ // 拼文字,如果没有 text 就显示默认尺寸
15
+ const textPart = `?text=${encodeURIComponent(text !== null && text !== void 0 ? text : `${width}x${height}`)}`;
16
+ return `https://placehold.co/${sizePart}${colorPart}${textPart}`;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xxf_react",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",