clarify what jxr actually is and what can it do #52

Open
opened 2022-10-08 15:27:48 +00:00 by utopiah · 12 comments
Owner

Basically relying on eval() thus able to run JavaScript within the current scope.

parseJXR() takes a string representing the code and expand shorthands including :

  • Xs starting the following command in X seconds
  • qs selector returing a querySelector(selector)
  • sa attribute value for setAttribute(attribute, value)
  • obsv for newNoteFromObservableCell()
  • lg for addGltfFromURLAsTarget()

These shorthands are relatively verbose functions that are estimated to be quite useful in this specific context of having text and code in a spacial environment, editable with a virtual and optionally physical keyboard.

Basically relying on `eval()` thus able to run JavaScript within the current scope. `parseJXR()` takes a string representing the code and expand shorthands including : * `Xs` starting the following command in X seconds * `qs selector` returing a `querySelector(selector)` * `sa attribute value` for `setAttribute(attribute, value)` * `obsv` for `newNoteFromObservableCell()` * `lg` for `addGltfFromURLAsTarget()` These shorthands are relatively verbose functions that are estimated to be quite useful in this specific context of having text and code in a spacial environment, editable with a virtual and optionally physical keyboard.
utopiah added the documentation label 2022-10-08 15:27:48 +00:00
Author
Owner

Note that interpretAny() requires a backend and thus is executed with a different scope. It allows code that is not JavaScript to be executed. Examples include containers with other languages e.g Bash, Python or Julia.

See https://twitter.com/utopiah/status/1533064468292419585

For now the result is only displayed and is only from text to text. See https://twitter.com/utopiah/status/1562501178495082496 suggesting toDataURL() for other kind of contents.

Note that `interpretAny()` requires a backend and thus is executed with a different scope. It allows code that is not JavaScript to be executed. Examples include containers with other languages e.g Bash, Python or Julia. See https://twitter.com/utopiah/status/1533064468292419585 For now the result is only displayed and is only from text to text. See https://twitter.com/utopiah/status/1562501178495082496 suggesting `toDataURL()` for other kind of contents.
Author
Owner

Consider minimizing syntax and instead rely on provenance.

For example instead of relying on e.g ./ as suggested in #50 rely instead on the presence of the webdav class.

Consider minimizing syntax and instead rely on provenance. For example instead of relying on e.g `./` as suggested in https://git.benetou.fr/utopiah/text-code-xr-engine/issues/50 rely instead on the presence of the `webdav` class.
Author
Owner

Rely on spacialized interaction specific keywords e.g

  • lastpinched
  • nextpinched
  • draggedon
Rely on spacialized interaction specific keywords e.g * lastpinched * nextpinched * draggedon
Author
Owner

Provide syntax highlighting.

Provide syntax highlighting.
Author
Owner

Existing

  • DOM element selectedElement
  • DOM element : lastPointSketch from draw()
  • string array : commandhistory
  • DOM element array : groupSelection
  • DOM element array : targets
Existing * DOM element `selectedElement` * DOM element : `lastPointSketch` from `draw()` * string array : `commandhistory` * DOM element array : `groupSelection` * DOM element array : `targets`
Author
Owner

Search for DSL (domain specific language) on text or text manipulation, ideally spatially.

Potential example https://dougengelbart.org/images/about/augment/chart-viewspecs.htm (arguable)

Search for DSL (domain specific language) on text or text manipulation, ideally spatially. Potential example https://dougengelbart.org/images/about/augment/chart-viewspecs.htm (arguable)
Author
Owner
See also `<a-console>` helpers https://github.com/kylebakerio/a-console/blob/master/a-console.js#L307 for https://github.com/kylebakerio/a-console#live-coding
Author
Owner

Responsive programming as a design principle, cf https://fabien.benetou.fr/Languages/OwnConcepts#ResponsiveProgramming , i.e surfacing the code itself, creating an affordance back.

Responsive programming as a design principle, cf https://fabien.benetou.fr/Languages/OwnConcepts#ResponsiveProgramming , i.e surfacing the code itself, creating an affordance back.
Author
Owner

See the onreleased event introduced in list-editing branch https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/list-editing/index.html#L86

See the `onreleased` event introduced in list-editing branch https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/list-editing/index.html#L86
Author
Owner

Example for clipboard jxr qs #billboard sa scale 1 1 1

Example for clipboard `jxr qs #billboard sa scale 1 1 1`
Author
Owner

Consider the generalization with e.g going from onreleased to onpinched. Maybe it could become an optional parameter for the jxr component, namely when to actually execute.

Note that for now executing is done with the secondary pinch whereas those 2 events are done on primary pinch.

Consider the generalization with e.g going from `onreleased` to `onpinched`. Maybe it could become an optional parameter for the jxr component, namely when to actually execute. Note that for now executing is done with the secondary pinch whereas those 2 events are done on primary pinch.
Author
Owner

Examples of more complex usage e.g

sphereEl.setAttribute("onpicked", "window.pfb = selectedElements.at(-1).element.getAttribute('position').clone();")
sphereEl.setAttribute("onreleased", "twoPosToBox(window.pfb, selectedElements.at(-1).element.getAttribute('position'),'"+generatorName+"');")

// or emitting with event details

newEl.setAttribute("onreleased", 'document.querySelector("['+generatorName+']").emit("check",{color:"'+color+'"})')

// then in event this.userSeq.push(evt.detail.color)

via https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/game-multiple-levels/jxr-core.js#L166

from https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/game-multiple-levels/

Examples of more complex usage e.g ```javascript sphereEl.setAttribute("onpicked", "window.pfb = selectedElements.at(-1).element.getAttribute('position').clone();") sphereEl.setAttribute("onreleased", "twoPosToBox(window.pfb, selectedElements.at(-1).element.getAttribute('position'),'"+generatorName+"');") // or emitting with event details newEl.setAttribute("onreleased", 'document.querySelector("['+generatorName+']").emit("check",{color:"'+color+'"})') // then in event this.userSeq.push(evt.detail.color) ``` via https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/game-multiple-levels/jxr-core.js#L166 from https://git.benetou.fr/utopiah/text-code-xr-engine/src/branch/game-multiple-levels/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: utopiah/text-code-xr-engine#52