更新前端静态网页获取方式,放弃使用后端获取api

This commit is contained in:
2025-09-09 10:47:51 +08:00
parent 6889ca37e5
commit 44a4f1bae1
25558 changed files with 2463152 additions and 153 deletions

View File

@@ -0,0 +1,41 @@
{
"name": "goober-should-forward-prop",
"amdName": "gooberForwardProp",
"version": "0.0.1",
"description": "The shouldForwardProp addon function for goober",
"sideEffects": false,
"main": "./dist/goober-should-forward-prop.cjs",
"module": "./dist/goober-should-forward-prop.esm.js",
"umd:main": "./dist/goober-should-forward-prop.umd.js",
"source": "./src/index.js",
"unpkg": "./dist/goober-should-forward-prop.umd.js",
"types": "./should-forward-prop.d.ts",
"type": "module",
"scripts": {
"build": "rm -rf dist && microbundle --entry src/index.js --name gooberForwardProp --no-sourcemap --generateTypes false",
"test": "jest --setupFiles ./jest.setup.js"
},
"repository": {
"type": "git",
"url": "https://github.com/cristianbote/goober.git",
"directory": "should-forward-prop"
},
"author": "Jonas De Vrient <devrient.jonas@gmail.com>",
"keywords": [
"goober",
"styled",
"should-forward-prop"
],
"license": "MIT",
"peerDependencies": {
"goober": "^2.0.18"
},
"devDependencies": {
"microbundle": "^0.14.2",
"jest": "^24.1.0",
"preact": "^10.5.6",
"@babel/plugin-transform-react-jsx": "^7.7.0",
"@babel/preset-env": "^7.3.1",
"babel-jest": "^24.1.0"
}
}

View File

@@ -0,0 +1,9 @@
export = gooberShouldForwardProp;
export as namespace shouldForwardProp;
declare namespace gooberShouldForwardProp {
type ForwardPropFunction = (prop: string) => boolean;
function shouldForwardProp(fwdProp: ForwardPropFunction): (props: object) => undefined;
}

View File

@@ -0,0 +1,25 @@
import { css } from 'goober';
import { shouldForwardProp } from '../index';
describe('shouldForwardProp', () => {
it('type', () => {
expect(typeof shouldForwardProp).toEqual('function');
});
it('shouldForwardProp', () => {
const fn = shouldForwardProp((prop) => {
// Filter out props prefixed with '$'
return prop[0] !== '$';
});
const props = {
color: 'red',
$shouldAnimate: true
};
// 'render'
fn(props);
expect(props).toEqual({ color: 'red' });
});
});

View File

@@ -0,0 +1,19 @@
/**
* Should forward prop utility function
* @param {Function} filterPropFunction The flter function
*/
export function shouldForwardProp(filterPropFunction) {
/**
* The forward props function passed to `setup`
* @param {object} props
*/
function forwardProp(props) {
for (let p in props) {
if (!filterPropFunction(p)) {
delete props[p];
}
}
}
return forwardProp;
}