This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Converts a Robot state machine to D2 diagram syntax | |
| * | |
| * Generates a statechart-style visualization with: | |
| * - States, transitions (with event labels), and immediate transitions | |
| * - Guard conditions indicated with [...] notation (e.g., '[...] event') | |
| * - Current state highlighting, final state indicators, invoke state coloring | |
| * - Support for nested machines with recursive rendering | |
| * | |
| * @param {object} machine - A Robot state machine created with createMachine() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { | |
| title: 'existing text', | |
| isValid: true, | |
| isEditing: false | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { | |
| title: 'existing text', | |
| isValid: true | |
| }, | |
| reducers: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setTimeout(f, delay) { | |
| f() | |
| } | |
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mutate = require('xtend/mutable') | |
| const assert = require('assert') | |
| const xtend = require('xtend') | |
| function applyHook (arr, arg1, arg2, arg3, arg4, arg5) { | |
| arr.forEach(function (fn) { | |
| fn(arg1, arg2, arg3, arg4, arg5) | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { | |
| title: 'Set the title' | |
| }, | |
| reducers: { | |
| update: (data, state) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { | |
| title: 'Set the title' | |
| }, | |
| reducers: { | |
| update: (data, state) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| const debounce = require('debounce') | |
| const simulateWorkFor = (ms) => { | |
| const startTime = new Date().getTime() | |
| while (new Date().getTime() - startTime < ms) { | |
| // nothing | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| const debounce = require('debounce') | |
| const simulateWorkFor = (ms) => { | |
| const startTime = new Date().getTime() | |
| while (new Date().getTime() - startTime < ms) { | |
| // nothing | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const choo = require('choo') | |
| const html = require('choo/html') | |
| const app = choo() | |
| app.model({ | |
| state: { toggler: true }, | |
| reducers: { | |
| toggle: (action, state) => ({ toggler: !state.toggler }) | |
| } | |
| }) |
NewerOlder