floppy-disk 2.11.0 → 2.11.1-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floppy-disk",
3
- "version": "2.11.0",
3
+ "version": "2.11.1-alpha.2",
4
4
  "description": "FloppyDisk - lightweight, simple, and powerful state management library",
5
5
  "keywords": [
6
6
  "state",
@@ -41,22 +41,13 @@
41
41
  },
42
42
  "module": "./esm/index.js",
43
43
  "default": "./lib/index.js"
44
- },
45
- "./preact": {
46
- "types": "./lib/preact/index.d.ts",
47
- "import": {
48
- "types": "./esm/preact/index.d.ts",
49
- "default": "./esm/preact/index.js"
50
- },
51
- "module": "./esm/preact/index.js",
52
- "default": "./lib/preact/index.js"
53
44
  }
54
45
  },
55
46
  "scripts": {
56
47
  "prepare": "husky install",
57
48
  "build:cjs": "tsc -p tsconfig.prod.json",
58
49
  "build:es": "tsc -p tsconfig.prod.json -m esNext --outDir esm",
59
- "build": "pnpm clean && pnpm build:cjs && pnpm build:es",
50
+ "build": "yarn clean && yarn build:cjs && yarn build:es",
60
51
  "prebuild": "ts-node ./scripts/preact.ts",
61
52
  "clean": "rimraf lib esm",
62
53
  "format": "prettier --check .",
@@ -70,12 +61,16 @@
70
61
  "release": {
71
62
  "branches": [
72
63
  "main",
64
+ {
65
+ "name": "beta",
66
+ "prerelease": true
67
+ },
73
68
  {
74
69
  "name": "alpha",
75
70
  "prerelease": true
76
71
  },
77
72
  {
78
- "name": "beta",
73
+ "name": "experimental",
79
74
  "prerelease": true
80
75
  }
81
76
  ]
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { ComponentChildren } from 'preact';
3
- export declare const withContext: <T>(initFn: () => T) => readonly [({ children, onInitialize, }: {
4
- children: ComponentChildren;
5
- onInitialize?: ((value: T) => void) | undefined;
6
- }) => import("react").JSX.Element, () => T | null];
@@ -1,16 +0,0 @@
1
- import { createContext } from 'preact';
2
- import { useContext, useState } from 'preact/hooks';
3
- export const withContext = (initFn) => {
4
- const Context = createContext(null);
5
- const Provider = ({ children, onInitialize, }) => {
6
- const [value] = useState(() => {
7
- const store = initFn();
8
- onInitialize && onInitialize(store);
9
- return store;
10
- });
11
- // @ts-ignore
12
- return React.createElement(Context.Provider, { value: value }, children);
13
- };
14
- const useCurrentContext = () => useContext(Context);
15
- return [Provider, useCurrentContext];
16
- };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { ComponentChildren } from 'preact';
3
- export declare const withContext: <T>(initFn: () => T) => readonly [({ children, onInitialize, }: {
4
- children: ComponentChildren;
5
- onInitialize?: ((value: T) => void) | undefined;
6
- }) => import("react").JSX.Element, () => T | null];
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withContext = void 0;
4
- const preact_1 = require("preact");
5
- const hooks_1 = require("preact/hooks");
6
- const withContext = (initFn) => {
7
- const Context = (0, preact_1.createContext)(null);
8
- const Provider = ({ children, onInitialize, }) => {
9
- const [value] = (0, hooks_1.useState)(() => {
10
- const store = initFn();
11
- onInitialize && onInitialize(store);
12
- return store;
13
- });
14
- // @ts-ignore
15
- return React.createElement(Context.Provider, { value: value }, children);
16
- };
17
- const useCurrentContext = () => (0, hooks_1.useContext)(Context);
18
- return [Provider, useCurrentContext];
19
- };
20
- exports.withContext = withContext;