1
3
Fork
You've already forked decker-xdc
3
No description
  • C 54.7%
  • JavaScript 33.5%
  • Awk 10%
  • Shell 0.7%
  • HTML 0.5%
  • Other 0.5%
2025年03月08日 23:47:54 +01:00
c make c-lil's 'in' primitive construct a rudimentary hashset before probing for membership; this can help avoid embarrassing quadratic performance when comparing large vectors with only a modest increase in complexity. At some point in the future we could do even better by using hashmaps for all dictionary lookups and possibly pre-computing recursive hashes for immutable collections during their construction. 2025年03月08日 08:33:51 -08:00
docs introduce image.bounds, which computes a bounding box for the nonzero pixels of an image. This offers both significant speedup to and significant reduction in code for a variety of image-trimming scenarios that have arisen so far in the wild, with enough versatility to handle cases like trimming individual edges or trimming a group of images identically. 2024年12月26日 13:44:07 -08:00
examples Add Webxdc card with a chat ( #12 ) 2025年03月08日 22:47:10 +00:00
images initial checkin for release 2022年10月27日 18:27:47 -07:00
js Merge remote-tracking branch 'upstream/main' 2025年03月08日 23:47:54 +01:00
scripts Zip file if saving as .xdc ( #7 ) 2025年03月03日 03:13:15 +00:00
syntax Accept leading underscores and question marks in codemirror syntax 2024年08月29日 11:16:26 +02:00
tests make c-lil's 'in' primitive construct a rudimentary hashset before probing for membership; this can help avoid embarrassing quadratic performance when comparing large vectors with only a modest increase in complexity. At some point in the future we could do even better by using hashmaps for all dictionary lookups and possibly pre-computing recursive hashes for immutable collections during their construction. 2025年03月08日 08:33:51 -08:00
tools correct crashes or invalid results for random selection from an empty collection, per #113 . Went with behavior consistent with outdexing. 2025年03月05日 08:26:34 -08:00
.gitignore Add web-decker-xdc make target 2025年03月02日 18:57:16 +01:00
apelilt.sh correct signed/unsigned goofiness in image.merge[] and also generalize this operation to support the * operator. 2024年07月24日 17:09:08 -07:00
Decker.desktop Add MIME type to Decker.desktop 2024年11月23日 17:32:42 -08:00
icon_32x32.png check in the Decker app icon, per #84 2024年03月21日 12:18:56 -07:00
icon_64x64.png Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
icon_128x128.png Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
icon_192x192.png Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
icon_256x256.png Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
icon_512x512.png Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
LICENSE.txt initial checkin for release 2022年10月27日 18:27:47 -07:00
Makefile Enable danger.js API ( #10 ) 2025年03月03日 04:42:07 +00:00
Readme.md Add Webxdc card with a chat ( #12 ) 2025年03月08日 22:47:10 +00:00
shell.nix Add nix build method 2023年10月25日 15:33:37 +08:00
VERSION version bump to v1.53 2024年12月19日 15:14:09 -08:00
x-decker.xml Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00
xdg-install.sh Add XDG icons, mimetypes and launcher 2024年09月27日 10:10:48 -05:00

Decker

NOTE

This is a fork of of the original repository at GitHub. It leverages the original Web-Decker application with features from the Webxdc Javascript API. See section below for more details.

Decker is a multimedia platform for creating and sharing interactive documents, with sound, images, hypertext, and scripted behavior.

Decker, complete with toolbars

You can learn more about Decker on my website, on the community forum, or you can just dive in and try it online. Periodic binary releases of Decker for MacOS and Windows are available on Itch.io.

If you're interested in Lil, Decker's scripting language, you can access documentation and play with it in your browser at trylil.

Web-Decker

Decker is available as a web application (written in vanilla JavaScript) which is distributed as a single freestanding HTML file. Web-Decker can be built with a make script. The test suite uses Node.js:

make testjs
make web-decker
make runweb # (optional) open in your default browser

webxdc

The following functionality has been added in addition to the standard functionality of Web-Decker:

  • webxdc.sendToChat() is called whenever any text file or binary file is saved, e.g. during any of the following actions:
    • File > Save As... > Save in main window
    • File > Export Image... > Save in main window
    • File > Properties... > Protect... > Save in main window
    • File > Export Script... in script editor (Select Card > Script... from main window)
  • webxdc.importFiles() is called whenever any text file or binary file is opened, e.g. during any of the following actions:
    • File > Open... in main window
    • File > Import Image... in main window
    • File > Resources... > Choose... in main window
    • File > Import Script... in script editor (Select Card > Script... from main window)

danger.js API (see "The Danger Zone" section) is enabled in this repository for .html and .xdc builds. We don't want to restrict Webxdc users from using JavaScript APIs because .xdcs are already sandboxed. You can test this by opening Decker > Listener and evaluating danger.js["5+5"]. It should return 10 and not 0.

Built-in deck "The Decker Tour" is modified to include an example of using Webxdc APIs via danger.js.

An event listener on beforeunload was added to this code base to prevent a user from accidentally closing the app with unsaved changes. However for this to work properly we removed two calls to mark_dirty() to prevent the app from ending up in an unsaved state directly after load. See https://github.com/JohnEarnest/Decker/issues/112 for more information on this.

Native-Decker

Decker is also available as a native application, written in C. Building Native-Decker from source requires:

  • a c compiler and libc
  • the xxd utility (standard with MacOS and most *nix distros)
  • SDL2
  • SDL2_image

On MacOS, BSD, or Linux, fetch the appropriate SDL2 packages and then build with make. This has also been reported to build and run successfully under WSL:

brew install sdl2 sdl2_image # MacOS/Homebrew
sudo apt install libsdl2-2.0-0 libsdl2-dev libsdl2-image-dev # Debian
nix-shell # Nix
make lilt # (optional) command-line tools
make docs # (optional) build documentation (requires Lilt)
make decker # build decker itself
make test # (optional) regression test suite
sudo make install # (optional) install lilt, decker, and lil syntax profiles

If SDL2 is not available, Native-Decker can also be built with reduced functionality against SDL1.2 and a corresponding version of SDL_image. This compatibility shim is presently designed with the OLPC XO-4 and its default Fedora 18 OS image in mind; expect to do some tinkering with the makefile for other platforms:

sudo yum install SDL-devel SDL_image-devel
make decker

Lilt

Decker's scripting language, Lil, is available as a standalone interpreter, with extended IO functionality to make it suitable for general-purpose programming and scripting: this package is called Lilt. Lilt only requires libc and xxd to build from source:

make lilt

Lilt can be used to programmatically create, inspect, and manipulate decks, as well as package them as Web-Decker self-executing documents:

$ lilt
 d:readdeck["examples/decks/color.deck"]
<deck>
 d.card:d.cards.colhex
<card>
 d.card.widgets.hex.text:"FFAA00"
"FFAA00"
 d.card.widgets.hex.event["change"]
0
 d.card.widgets.rgb.text
"16755200"
 writedeck["color.html" d]
1

You can build Lilt against Cosmopolitan Libc, producing a single binary that will run on most popular operating systems:

$ ./apelilt.sh
successfully compiled lilt.com
running tests against ./lilt.com...
all interpreter tests passed.
all dom tests passed.
all roundtrip tests passed.
$ sh ./lilt.com
 range 10
(0,1,2,3,4,5,6,7,8,9)

There is also an alternative Lil interpreter, Lila, which only requires a compliant implementation of the AWK language:

$ awk -f tools/awk/lila.awk
 sys.platform
"awk"
 2*range 10
(0,2,4,6,8,10,12,14,16,18)

The Danger Zone

Decker normally sandboxes the execution of scripts within decks to prevent low-level access to the host computer and ensure parity between the capabilities of Web-Decker and Native-Decker. Both implementations offer opt-in APIs for performing more "dangerous" or non-portable operations called The Danger Zone.

When building Native-Decker from source, you can enable The Danger Zone by defining the DANGER_ZONE preprocessor flag:

FLAGS:=$(FLAGS) -DDANGER_ZONE

A "dangerous" build of Native-Decker can export "dangerous" Web-Decker builds. You can also temporarily enable The Danger Zone for Web-Decker by calling the endanger() function from your browser's JavaScript console or modifying the DANGEROUS=0 constant in the .html file to DANGEROUS=1. The Forbidden Library offers a suite of bindings for useful JavaScript APIs based on this interface.

Contributing

The Decker project is released under the MIT license. Any contributions to this repository are understood to fall under the same license.

  • Bug fixes and typo corrections are always welcome.
  • Bug reports must include simple steps for reproduction and clearly indicate the OS and/or web browser where the bug arises.
  • PRs should match the style of existing code.
  • PRs should be as small as possible, and must not contain bundled unrelated changes.
  • PRs must include updates for both the C and JavaScript versions of Decker (or its associated tools) whenever relevant.
  • PRs must include updates for documentation (see: the docs directory) wherever relevant.
  • PRs must pass the entire test suite (see: make test/make testjs).
  • When modifying the JavaScript version of Decker, please test your changes in multiple web browsers and avoid using bleeding-edge features. As a rule of thumb, if it didn't exist 5 years ago, don't use it now. If it only works in Chrome, it's better not to do it at all.
  • When modifying the C version of Decker, avoid generating warnings and do not use compiler-specific features such as GCC extensions.

Please refrain from submitting Pull Requests to this repository containing new features without first discussing their inclusion in an Issue. Decker is intended to be small, simple, and cozy. There are an infinite number of features that could potentially be added, but creative constraints are also valuable. If you have a differing vision, feel empowered to explore it in your own fork of the project- that's what permissive licenses are for.