Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Dec 13, 2023
1 parent a4cbc64 commit f9c5efe
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 24 deletions.
42 changes: 42 additions & 0 deletions demo/Example2f.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Example 2d</title>
<script type=importmap>
{
"imports": {
"be-enhanced/": "../node_modules/be-enhanced/",
"be-exporting/": "../node_modules/be-exporting/",
"be-hive/": "../node_modules/be-hive/",
"be-linked/": "../node_modules/be-linked/",
"be-observant/": "../node_modules/be-observant/",
"be-value-added/": "../node_modules/be-value-added/",
"mount-observer/": "../node_modules/mount-observer/",
"trans-render/": "../node_modules/trans-render/",
"xtal-element/": "../node_modules/xtal-element/"
}
}
</script>
</head>
<body>
<form itemscope>
<link itemprop=isHappy href=https://schema.org/True>
<input type=checkbox name=isWealthy>
<div contenteditable id=liberated>abc</div>
...

<any-element itemprop=isInNirvana
onload="({
prop1: isHappy && !isWealthy && liberated?.length > 17,
prop2: liberated?.blink()
})"
enh-by-be-computed='from $isHappy, @isWealthy, #liberated, and assign result to $0+beScoped.'></any-element>
</form>
<script type=module>
import '../be-computed.js';
import '../any-element/any-element.js';
</script>
</body>
</html>
45 changes: 33 additions & 12 deletions prsFrom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,64 @@ import { tryParse } from 'be-enhanced/cpu.js';
import { lispToCamel } from 'trans-render/lib/lispToCamel.js';
const previousScriptElementExpression = String.raw `(?<!\\)previousScriptElementExpression`;
const attrContainingExpression = String.raw `(?<attrContainingExpression>[\w]+)`;
const passingInDependencies = String.raw `PassingIn(?<dependencies>.*)`;
const Expression = String.raw `(?<!\\)Expression`;
const reValueStatement = [
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},PassingIn(?<dependencies>.*),AndAssignResult`),
regExp: new RegExp(String.raw `^${previousScriptElementExpression},${passingInDependencies},AndAssignResult`),
defaultVals: {
previousElementScriptElement: true,
assignResult: true
assignResult: true,
matchIdx: 0,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)Expression,PassingIn(?<dependencies>.*),AndAssignResult`),
regExp: new RegExp(String.raw `^${attrContainingExpression}${Expression},${passingInDependencies},AndAssignResult`),
defaultVals: {
assignResult: true
assignResult: true,
matchIdx: 1,
}
},
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},${passingInDependencies}`),
defaultVals: {
previousElementScriptElement: true,
matchIdx: 2,
}
},
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},PassingIn(?<dependencies>.*)`),
defaultVals: { previousElementScriptElement: true }
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)ExportOf(?<importName>[\w]+)(?<!\\),${passingInDependencies}`),
defaultVals: {
matchIdx: 3,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)ExportOf(?<importName>[\w]+)(?<!\\),PassingIn(?<dependencies>.*)`),
defaultVals: {}
regExp: new RegExp(String.raw `^${attrContainingExpression}${Expression},${passingInDependencies}`),
defaultVals: {
matchIdx: 4,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)Expression,PassingIn(?<dependencies>.*)`),
defaultVals: {}
regExp: new RegExp(String.raw `^(?<dependencies>.*),AndAssignResultTo\$0(?<localProp>[\w\+]+)`),
defaultVals: {
assignResult: true,
onloadOrPreviousElementScriptElement: true,
matchIdx: 5,
}
},
{
regExp: new RegExp(String.raw `^(?<dependencies>.*),AndAssignResult`),
defaultVals: {
assignResult: true,
onloadOrPreviousElementScriptElement: true
onloadOrPreviousElementScriptElement: true,
matchIdx: 6,
}
},
{
regExp: new RegExp(String.raw `^(?<dependencies>.*)`),
defaultVals: {
onloadOrPreviousElementScriptElement: true
onloadOrPreviousElementScriptElement: true,
matchIdx: 7,
}
}
];
Expand Down
45 changes: 33 additions & 12 deletions prsFrom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,64 @@ import {lispToCamel} from 'trans-render/lib/lispToCamel.js';

const previousScriptElementExpression = String.raw `(?<!\\)previousScriptElementExpression`;
const attrContainingExpression = String.raw `(?<attrContainingExpression>[\w]+)`;
const passingInDependencies = String.raw `PassingIn(?<dependencies>.*)`;
const Expression = String.raw `(?<!\\)Expression`;
const reValueStatement: RegExpOrRegExpExt<ComputeStatement>[] = [
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},PassingIn(?<dependencies>.*),AndAssignResult`),
regExp: new RegExp(String.raw `^${previousScriptElementExpression},${passingInDependencies},AndAssignResult`),
defaultVals:{
previousElementScriptElement: true,
assignResult: true
assignResult: true,
matchIdx: 0,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)Expression,PassingIn(?<dependencies>.*),AndAssignResult`),
regExp: new RegExp(String.raw `^${attrContainingExpression}${Expression},${passingInDependencies},AndAssignResult`),
defaultVals:{
assignResult: true
assignResult: true,
matchIdx: 1,
}
},
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},${passingInDependencies}`),
defaultVals:{
previousElementScriptElement: true,
matchIdx: 2,
}
},
{
regExp: new RegExp(String.raw `^${previousScriptElementExpression},PassingIn(?<dependencies>.*)`),
defaultVals:{previousElementScriptElement: true}
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)ExportOf(?<importName>[\w]+)(?<!\\),${passingInDependencies}`),
defaultVals: {
matchIdx: 3,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)ExportOf(?<importName>[\w]+)(?<!\\),PassingIn(?<dependencies>.*)`),
defaultVals: {}
regExp: new RegExp(String.raw `^${attrContainingExpression}${Expression},${passingInDependencies}`),
defaultVals: {
matchIdx: 4,
}
},
{
regExp: new RegExp(String.raw `^${attrContainingExpression}(?<!\\)Expression,PassingIn(?<dependencies>.*)`),
defaultVals: {}
regExp: new RegExp(String.raw `^(?<dependencies>.*),AndAssignResultTo\$0(?<localProp>[\w\+]+)`),
defaultVals:{
assignResult: true,
onloadOrPreviousElementScriptElement: true,
matchIdx: 5,
}
},
{
regExp: new RegExp(String.raw `^(?<dependencies>.*),AndAssignResult`),
defaultVals:{
assignResult: true,
onloadOrPreviousElementScriptElement: true
onloadOrPreviousElementScriptElement: true,
matchIdx: 6,
}
},
{
regExp: new RegExp(String.raw `^(?<dependencies>.*)`),
defaultVals: {
onloadOrPreviousElementScriptElement: true
onloadOrPreviousElementScriptElement: true,
matchIdx: 7,
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ export interface ComputeStatement{
dependencies?: string,
args?: Array<Arg>,
assignResult?: boolean,
localProp?: string,
matchIdx?: number,
}

0 comments on commit f9c5efe

Please sign in to comment.