Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperapp V2 #726

Merged
merged 82 commits into from May 4, 2019
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7f3bed4
V2
jorgebucaran Jul 9, 2018
2b3d856
onRemove,onDestroy
jorgebucaran Jul 9, 2018
2258200
Retouch dispatch.
jorgebucaran Jul 13, 2018
ac1bb7d
fix: render bug when root element changes; close #744
jorgebucaran Aug 24, 2018
b4e7f37
fix: update subs to use new signature
jorgebucaran Aug 27, 2018
df89651
feature: use tuple signature
jorgebucaran Sep 4, 2018
8c46658
chore: bump deps
jorgebucaran Sep 6, 2018
510081d
fix: improve isSameAction
jorgebucaran Sep 6, 2018
3d7cd38
fix: shallow check for props of parameterized actions passed to subs
jorgebucaran Sep 6, 2018
567d923
fix: make text node type same as Node.TEXT_NODE (#776)
frenzzy Nov 2, 2018
e9d6757
Fix headless mode (#798)
mrozbarry Feb 15, 2019
d563302
Commit dirty tree in order to publish
jorgebucaran Feb 15, 2019
9f334a4
Alpha
jorgebucaran Feb 15, 2019
5177d9a
Update effect and subscription signatures (#802)
mrozbarry Feb 20, 2019
c292165
Merge branch 'V2' of https://github.com/jorgebucaran/hyperapp into V2
jorgebucaran Feb 20, 2019
be6855d
Remove year from copyright
jorgebucaran Feb 20, 2019
79f0324
Update dependencies
jorgebucaran Feb 20, 2019
9c89237
2.0.0-alpha.1
jorgebucaran Feb 20, 2019
d63de6e
Fix error in Getting Started example.
jorgebucaran Feb 20, 2019
3b40b64
Fix bug referencing the cancel function in the internal sub tuple.
okwolf Feb 21, 2019
89421ad
2.0.0-alpha.2
jorgebucaran Feb 21, 2019
900a0c6
Implement Lazy (#777)
SkaterDad Feb 25, 2019
caa84ce
Remove ts smoke tests
jorgebucaran Feb 27, 2019
274fb1e
Hide logo
jorgebucaran Feb 27, 2019
6a3a36e
Remove babelderdash
jorgebucaran Feb 27, 2019
d7f33e5
Add nested subs back; hot swap parameterized props
jorgebucaran Feb 27, 2019
4c95944
Add declarative class prop builder
jorgebucaran Feb 27, 2019
9ee9443
2.0.0-alpha.3
jorgebucaran Feb 27, 2019
7d5ee8a
Fix regression in Lazy calling undefined function
jorgebucaran Feb 28, 2019
801d529
2.0.0-alpha.4
jorgebucaran Feb 28, 2019
5e9acea
2.0.0-alpha.5
jorgebucaran Feb 28, 2019
227f281
2.0.0-alpha.6
jorgebucaran Feb 28, 2019
8bba316
Remove helpless comment
jorgebucaran Feb 28, 2019
981ad3a
Use empty object as state if init is undefined
jorgebucaran Mar 1, 2019
2cbaa7d
Add effect batching
jorgebucaran Mar 3, 2019
6eb6cac
2.0.0-alpha.7
jorgebucaran Mar 3, 2019
50fb5ac
Refactor defer
jorgebucaran Mar 3, 2019
085fa7d
DEFAULT_NODE
jorgebucaran Mar 3, 2019
68c158a
Remove lifecycle events
jorgebucaran Mar 3, 2019
0ff0c75
Refactor createClass; remove hasOwnProp check
jorgebucaran Mar 3, 2019
d7d6750
Refactor variables
jorgebucaran Mar 3, 2019
23b1619
2.0.0-alpha.8
jorgebucaran Mar 3, 2019
8a81c4d
Fix bug with Lazy when used in JSX (#812)
SkaterDad Mar 5, 2019
153167f
Change component signature back to (props, children) (#814)
frenzzy Mar 5, 2019
f453572
Golf element.events handling code
jorgebucaran Mar 5, 2019
c4a00e7
Simplify updateProperty
jorgebucaran Mar 5, 2019
9f1c6cc
Don't write "key" attributes to the DOM
jorgebucaran Mar 5, 2019
714686e
Refactor; more golfing
jorgebucaran Mar 6, 2019
6efe4ac
Refactor batched subs/fx; shave more bytes
jorgebucaran Mar 7, 2019
b352b66
Make state {} by default
jorgebucaran Mar 8, 2019
a4fb92e
Bump deps; remove ts stuff
jorgebucaran Mar 8, 2019
732a838
Rename batch to flatten; other cosmetic changes
jorgebucaran Mar 8, 2019
77c3fda
2.0.0-alpha.9
jorgebucaran Mar 8, 2019
c486729
Diff subscription arrays of different length
jorgebucaran Mar 13, 2019
651e05a
Inline create map to patch
jorgebucaran Mar 13, 2019
f9f922c
2.0.0-alpha.10
jorgebucaran Mar 13, 2019
ff3142e
Remove unused test file
jorgebucaran Mar 13, 2019
8202d92
Use rollup's --no-esModule
jorgebucaran Mar 13, 2019
17350bb
Remove prettier dev dep
jorgebucaran Mar 13, 2019
78c06a3
Back to all lower DOM events
jorgebucaran Mar 15, 2019
64437a8
Avoid nested if
jorgebucaran Mar 15, 2019
e912814
Expand Getting Started; add tentative outline
jorgebucaran Mar 16, 2019
220e449
Add Taking it up a notch and Putting it all together sections
jorgebucaran Mar 18, 2019
9377814
Implement to-do app code; add tentative section
jorgebucaran Mar 19, 2019
c7ae927
Use rAF with fallback to setTimeout to defer rendering
jorgebucaran Mar 30, 2019
8874ad3
Combine recycleElement and recycleChild into one
jorgebucaran Mar 30, 2019
16f6d0c
Fix bug in elements using selected attribute
jorgebucaran Apr 2, 2019
ff920d5
Create Dispatch Decorator (#822)
mrozbarry Apr 25, 2019
d7239d6
Consolidate custom/default payload into one argument (#830)
jorgebucaran Apr 25, 2019
76cef85
Support passive events & preventDefault/stopPropagation options
jorgebucaran Apr 25, 2019
f7a6674
eventCb鈫抏ventProxy
jorgebucaran Apr 25, 2019
4a2c2f0
Support a text node as root element
jorgebucaran Apr 25, 2019
6784b46
who wants more docs?
jorgebucaran Apr 25, 2019
64d0e86
Refactor: no breaking changes
jorgebucaran Apr 26, 2019
e953662
Codegolf Lazy
jorgebucaran Apr 30, 2019
9e7eca4
Refactor, more codegolf
jorgebucaran Apr 30, 2019
9d2561e
More docs
jorgebucaran May 1, 2019
17ee081
Refactor variable names
jorgebucaran May 2, 2019
2c0b364
Bug fix: track the root node
jorgebucaran May 2, 2019
d61f34e
More docs
jorgebucaran May 2, 2019
70dad04
Hyperapp 尾
jorgebucaran May 2, 2019
b5c3cc5
Fix bug in createClass using unknown variable (#834)
shooontan May 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
108 changes: 21 additions & 87 deletions hyperapp.d.ts
@@ -1,100 +1,34 @@
export as namespace hyperapp

/** @namespace [VDOM] */
export type Children = VNode | string | number | null

/** The VDOM representation of an Element.
*
* @memberOf [VDOM]
*/
export interface VNode<Attributes = {}> {
nodeName: string
attributes?: Attributes
children: Array<VNode | string>
key: string
export enum VNodeType {
DEFAULT = 0,
RECYCLED_NODE,
TEXT_NODE,
}

/** A Component is a function that returns a custom VNode or View.
*
* @memberOf [VDOM]
*/
export interface Component<Attributes = {}, State = {}, Actions = {}> {
(attributes: Attributes, children: Array<VNode | string>):
| VNode<Attributes>
| View<State, Actions>
export interface VNode<Props = {}> {
name: string,
props: Props,
children: Array<VNode>
element: Element,
key: string,
type: VNodeType
}

/**
* Possibles children types
*/
export type Children = VNode | string | number | null

/** The soft way to create a VNode.
* @param name An element name or a Component function
* @param attributes Any valid HTML atributes, events, styles, and meta data
* @param children The children of the VNode
* @returns A VNode tree.
*
* @memberOf [VDOM]
*/
export function h<Attributes>(
nodeName: Component<Attributes, any, any> | string,
attributes?: Attributes,
* Create a new virtual DOM node. A virtual DOM is a description of what a DOM should look like using a tree of virtual nodes.
* @param name The name of an Element or a function that returns a virtual DOM node.
* @param props HTML props, SVG props, DOM events, Lifecycle Events, and Keys.
* @param children The element's child nodes.
*/
export function h<Props>(
name: string,
props?: Props | null,
...children: Array<Children | Children[]>
): VNode<Attributes>

/** @namespace [App] */

/** The result of an action.
*
* @memberOf [App]
*/
export type ActionResult<State> = Partial<State> | Promise<any> | null | void

/** The interface for a single action implementation.
*
* @memberOf [App]
*/
export type ActionType<State, Actions> = (
data?: any
) =>
| ((state: State, actions: Actions) => ActionResult<State>)
| ActionResult<State>

/** The interface for the actions tree implementation.
*
* @memberOf [App]
*/
export type ActionsType<State, Actions> = {
[P in keyof Actions]:
| ActionType<State, Actions>
| ActionsType<any, Actions[P]>
}

/** The view function describes the application UI as a tree of VNodes.
* @returns A VNode tree.
* @memberOf [App]
*/
export interface View<State, Actions> {
(state: State, actions: Actions): VNode<object>
}

/** The app() call creates and renders a new application.
*
* @param state The state object.
* @param actions The actions object implementation.
* @param view The view function.
* @param container The DOM element where the app will be rendered to.
* @returns The actions wired to the application.
* @memberOf [App]
*/
export function app<State, Actions>(
state: State,
actions: ActionsType<State, Actions>,
view: View<State, Actions>,
container: Element | null
): Actions
): VNode<Props>

/** @namespace [JSX] */

declare global {
namespace JSX {
Expand Down
16 changes: 8 additions & 8 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "hyperapp",
"description": "1 kB JavaScript framework for building web applications.",
"version": "1.2.6",
"description": "JavaScript micro-framework for building web applications.",
"version": "2.0.0-beta.0",
"main": "dist/hyperapp.js",
"module": "src/index.js",
"typings": "hyperapp.d.ts",
Expand Down Expand Up @@ -43,12 +43,12 @@
},
"devDependencies": {
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-env": "^1.6.1",
"jest": "^22.4.3",
"prettier": "^1.11.1",
"rollup": "^0.57.1",
"typescript": "2.8.1",
"uglify-js": "3.3.16"
"babel-preset-env": "^1.7.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use latest babel 7 packages ?

I have recently tried using rollup and parceljs for bundling one of my library and finally i ennded up using webpack 4.15.x because i wanted to use latest babel packages as descibed below:

    "@babel/cli": "^7.0.0-beta.51",
    "@babel/core": "^7.0.0-beta.51",
    "@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.51",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0-beta.51",
    "@babel/preset-env": "^7.0.0-beta.51",
    "@babel/preset-react": "^7.0.0-beta.51",

If rollup is finalised for V2 then ignore this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgebucaran I would not anticipate babel 7 leaving beta soon. They have many open issues.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying that! @ggassmann

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"jest": "^23.5.0",
"prettier": "^1.14.2",
"rollup": "^0.65.2",
"typescript": "3.0.3",
"uglify-js": "3.4.9"
},
"prettier": {
"semi": false
Expand Down