added backup and email client
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
var l=require("goober");let e=l.css.bind({g:1});exports.createGlobalStyles=function(){const e=l.styled.call({g:1},"div").apply(null,arguments);return function(l){return e(l),null}},exports.glob=e;
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{css as n,styled as l}from"goober";let o=n.bind({g:1});function r(){const n=l.call({g:1},"div").apply(null,arguments);return function(l){return n(l),null}}export{r as createGlobalStyles,o as glob};
|
||||
+1
@@ -0,0 +1 @@
|
||||
import{css as n,styled as l}from"goober";let o=n.bind({g:1});function r(){const n=l.call({g:1},"div").apply(null,arguments);return function(l){return n(l),null}}export{r as createGlobalStyles,o as glob};
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("goober")):"function"==typeof define&&define.amd?define(["exports","goober"],o):o((e||self).gooberGlobal={},e.goober)}(this,function(e,o){let n=o.css.bind({g:1});e.createGlobalStyles=function(){const e=o.styled.call({g:1},"div").apply(null,arguments);return function(o){return e(o),null}},e.glob=n});
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { Properties as CSSProperties } from 'csstype';
|
||||
import { Theme, DefaultTheme } from 'goober';
|
||||
|
||||
export = gooberGlobal;
|
||||
|
||||
export as namespace gooberGlobal;
|
||||
|
||||
declare namespace gooberGlobal {
|
||||
interface CSSAttribute extends CSSProperties {
|
||||
[key: string]: CSSAttribute | string | number | undefined;
|
||||
}
|
||||
|
||||
function createGlobalStyles(
|
||||
tag: CSSAttribute | TemplateStringsArray | string,
|
||||
...props: Array<
|
||||
| string
|
||||
| number
|
||||
| ((props: Theme<DefaultTheme>) => CSSAttribute | string | number | false | undefined)
|
||||
>
|
||||
): Function;
|
||||
function glob(
|
||||
tag: CSSAttribute | TemplateStringsArray | string,
|
||||
...props: Array<string | number>
|
||||
): void;
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "goober-global",
|
||||
"amdName": "gooberGlobal",
|
||||
"version": "0.0.1",
|
||||
"description": "The createGlobalStyles addon function for goober",
|
||||
"sideEffects": false,
|
||||
"main": "dist/goober-global.cjs",
|
||||
"module": "dist/goober-global.esm.js",
|
||||
"umd:main": "dist/goober-global.umd.js",
|
||||
"source": "src/index.js",
|
||||
"unpkg": "dist/goober-global.umd.js",
|
||||
"types": "./global.d.ts",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && microbundle --entry src/index.js --name gooberGlobal --no-sourcemap --generateTypes false",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cristianbote/goober.git",
|
||||
"directory": "global"
|
||||
},
|
||||
"author": "Cristian <botecristian@yahoo.com>",
|
||||
"keywords": [
|
||||
"goober",
|
||||
"styled",
|
||||
"global"
|
||||
],
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"goober": "^2.0.29"
|
||||
},
|
||||
"devDependencies": {
|
||||
"goober": "^2.0.29",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`createGlobalStyles regular 1`] = `" html, body{background:dodgerblue;}"`;
|
||||
|
||||
exports[`createGlobalStyles regular 2`] = `"<div></div>"`;
|
||||
|
||||
exports[`createGlobalStyles with theme 1`] = `"html, body{margin:0;background:blue;}"`;
|
||||
|
||||
exports[`createGlobalStyles with theme 2`] = `"<div></div>"`;
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { glob, createGlobalStyles } from '../index';
|
||||
import { css, setup } from 'goober';
|
||||
|
||||
jest.mock('goober', () => ({
|
||||
css: jest.fn().mockReturnValue('css()')
|
||||
}));
|
||||
|
||||
describe('global', () => {
|
||||
beforeEach(() => {
|
||||
css.mockClear();
|
||||
});
|
||||
|
||||
it('type', () => {
|
||||
expect(typeof glob).toEqual('function');
|
||||
expect(typeof createGlobalStyles).toEqual('function');
|
||||
});
|
||||
|
||||
it('glob', () => {
|
||||
glob`a:b`;
|
||||
expect(css).toBeCalledWith(['a:b']);
|
||||
});
|
||||
});
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
import { h, createContext, render } from 'preact';
|
||||
import { useContext } from 'preact/hooks';
|
||||
import { setup, extractCss } from 'goober';
|
||||
import { createGlobalStyles } from '../index';
|
||||
|
||||
describe('createGlobalStyles', () => {
|
||||
it('regular', () => {
|
||||
setup(h);
|
||||
|
||||
const target = document.createElement('div');
|
||||
|
||||
const GlobalStyle = createGlobalStyles`
|
||||
html, body {
|
||||
background: dodgerblue;
|
||||
}
|
||||
`;
|
||||
|
||||
render(
|
||||
<div>
|
||||
<GlobalStyle />
|
||||
</div>,
|
||||
target
|
||||
);
|
||||
|
||||
expect(extractCss()).toMatchSnapshot();
|
||||
expect(target.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('with theme', () => {
|
||||
const ThemeContext = createContext();
|
||||
const useTheme = () => useContext(ThemeContext);
|
||||
|
||||
setup(h, null, useTheme);
|
||||
|
||||
const target = document.createElement('div');
|
||||
|
||||
const GlobalStyle = createGlobalStyles`
|
||||
html, body {
|
||||
margin: 0;
|
||||
background: ${(props) => props.theme.color};
|
||||
}
|
||||
`;
|
||||
|
||||
render(
|
||||
<ThemeContext.Provider value={{ color: 'blue' }}>
|
||||
<div>
|
||||
<GlobalStyle />
|
||||
</div>
|
||||
</ThemeContext.Provider>,
|
||||
target
|
||||
);
|
||||
|
||||
expect(extractCss()).toMatchSnapshot();
|
||||
expect(target.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import { css, styled } from 'goober';
|
||||
|
||||
/**
|
||||
* CSS Global function to declare global styles
|
||||
* @type {Function}
|
||||
*/
|
||||
export let glob = css.bind({ g: 1 });
|
||||
|
||||
/**
|
||||
* Creates the global styles component to be used as part of your tree.
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function createGlobalStyles() {
|
||||
const fn = styled.call({ g: 1 }, 'div').apply(null, arguments);
|
||||
|
||||
/**
|
||||
* This is the actual component that gets rendered.
|
||||
*/
|
||||
return function GlobalStyles(props) {
|
||||
// Call the above styled.
|
||||
fn(props);
|
||||
|
||||
// Returns a hole.
|
||||
return null;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user