Compare commits

..

3 Commits

Author SHA1 Message Date
49ee54539f cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2026-06-28 16:23:09 +03:00
3829ce9764 cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2026-06-28 16:04:45 +03:00
8b5f156816 removed slot's <content/>...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2026-06-28 16:01:17 +03:00
3 changed files with 28 additions and 98 deletions

26
v3/package-lock.json generated
View File

@ -13,10 +13,12 @@
"ig-actions": "*",
"ig-features": "*",
"ig-object": "*",
"ig-test": "*",
"ig-types": "*",
"requirejs": "*",
"uuid": "*"
},
"devDependencies": {
"ig-test": "*"
}
},
"node_modules/balanced-match": {
@ -44,6 +46,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.1.90"
@ -53,12 +56,14 @@
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true,
"license": "MIT"
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true,
"license": "ISC"
},
"node_modules/glob": {
@ -91,6 +96,7 @@
"version": "2.17.2",
"resolved": "https://registry.npmjs.org/ig-argv/-/ig-argv-2.17.2.tgz",
"integrity": "sha512-EGm3Sx1vo9gnQKh2CJKdyNyY0IsKljz2zTUt1SV3BrErtRvFz3WuH5ltoD0ErSEUmyY5mtOklTrFSmXqA2joLQ==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"ig-object": "^5.4.16"
@ -100,6 +106,7 @@
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.6.0.tgz",
"integrity": "sha512-5MAUWSwfHKQNrgLroXxBHjlhrhVbhzlVqvUcfMDjUeK/ufWQ9THE0HDcvhfu+YrPfRjTR2QpD2Ygp+2H4O0C6g==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/ig-doc": {
@ -141,9 +148,10 @@
"license": "BSD-3-Clause"
},
"node_modules/ig-test": {
"version": "1.6.7",
"resolved": "https://registry.npmjs.org/ig-test/-/ig-test-1.6.7.tgz",
"integrity": "sha512-+gHKSemPMbMk+UjDaY74BwYmxWh1tRPa6vnoDf8aauXaFdoYkYLKM6lhEB5koerTXK69M9aPw609o7r91O5Z6Q==",
"version": "1.6.9",
"resolved": "https://registry.npmjs.org/ig-test/-/ig-test-1.6.9.tgz",
"integrity": "sha512-4XpSQjMDhogxrbtKvIHyoV750MZSOKOEz/Yg1UM5cwwTloAfCUgZWqMe+3KADCF4Ncqb9Bgdowf/cfvM0Pn3eg==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"colors": "1.4.0",
@ -159,12 +167,14 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT"
},
"node_modules/ig-test/node_modules/brace-expansion": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
"integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
@ -176,6 +186,7 @@
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
"dev": true,
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
@ -196,12 +207,14 @@
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/ig-object/-/ig-object-5.6.0.tgz",
"integrity": "sha512-5MAUWSwfHKQNrgLroXxBHjlhrhVbhzlVqvUcfMDjUeK/ufWQ9THE0HDcvhfu+YrPfRjTR2QpD2Ygp+2H4O0C6g==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/ig-test/node_modules/minimatch": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
"integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
@ -226,6 +239,7 @@
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"license": "ISC",
"dependencies": {
"once": "^1.3.0",
@ -236,6 +250,7 @@
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true,
"license": "ISC"
},
"node_modules/lru-cache": {
@ -281,6 +296,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"wrappy": "1"
@ -290,6 +306,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
@ -341,6 +358,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
}
}

View File

@ -1286,16 +1286,6 @@ module.parser = {
// This also works for cases where slots override slots they
// are contained in, this will not lead to recursion.
//
// XXX do we actually need <content/>??
// <slot slot>
// <slot slot.content/>
// </slot>
// XXX do we show a slot with unfilled content???
// ...what's the point in having <content>, can't is just
// be replaced by a slot?
// ...content + hidden allows us not just to fill a slot
// but to also place it...
// XXX revise/document how shown/hidden work...
// XXX revise the use of hidden/shown use mechanic and if it's
// needed...
slot: Macro(
@ -1321,50 +1311,22 @@ module.parser = {
: name in slots)
// set slot value...
// XXX simplify this...
var stack = []
slots[name]
&& stack.push(slots[name])
delete slots[name]
text = text ?
parser.expand(this, text ?? [], state)
: text
if(body && text){
stack.push(body)
var slot = text
} else {
var slot = body ?? text }
var original = slot
slots[name]
&& stack.unshift(slot)
slot = slots[name] ??= slot
// handle <content/>...
for(prev of stack.reverse()){
// get the first <content/>
// NOTE: this is a flat search because we can't
// have indirect nesting (see: .group(..))
for(var i in prev){
if(typeof(prev[i]) != 'string'
&& prev[i].name == 'content'){
break }
i = null }
i != null
&& (prev[i].value = [...slot])
&& slot.splice(0, slot.length,
...prev
// remove nested slot handlers...
// XXX do we need this???
.filter(function(e){
return typeof(e) != 'function'
|| e.slot != name }) ) }
slots[name] = slot
return hidden ?
''
: Object.assign(
function(st){
return ((st ?? state).slots ?? {})[name]
?? original },
?? slot },
{slot: name}) }) }),
'content': ['slot'],
//

View File

@ -54,24 +54,8 @@ test.Setups({
...ins.map(function(e){
return e + '<slot slot>third</slot>' }),
'third' ] },
slot_content_empty: function(assert){
return [
'@slot(slot body="[[ <content/> ]]")',
'<slot slot>[[ <content/> ]]</slot>',
'[[ ]]' ] },
slot_content_default: function(assert){
return [
'@slot(slot default body="[[ <content/> ]]")',
'<slot slot default>[[ <content/> ]]</slot>',
'[[ default ]]' ] },
slot_content_fill: function(assert){
var ins = this.slot_content_default(assert)
var expect = ins.pop()
return [
...ins.map(function(i){
return i +'@slot(slot value)' }),
expect.replace('default', 'value') ] },
// XXX these are an alternative to <content/>...
slot_nested: function(assert){
return [
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot.content value)',
@ -81,42 +65,7 @@ test.Setups({
'<slot slot>[[ <slot slot.content/> ]]</slot>@slot(slot value)',
'value' ] },
// XXX the question with the next tow is:
// should body override or nest?
// ...both are logical but in either case the result should be
// consistent.
//
// XXX should the new body/content override or expand the original???
slot_content_content: function(assert){
var ins = this.slot_content_default(assert)
var expect = ins.pop()
return [
...ins.map(function(i){
return i +'@slot(slot body="(( @content() ))")' }),
// XXX should this override the default above???
//expect.replace('default', '(( default ))') ] },
expect.replace('default', '(( ))') ] },
slot_content_content_content: function(assert){
var ins = this.slot_content_content(assert)
var expect = ins.pop()
return [
...ins.map(function(i){
return i +'@slot(slot body="<< @content() >>")' }),
// XXX should this override the default above???
//expect.replace('default', '(( default ))') ] },
expect.replace('(( ))', '(( << >> ))') ] },
// XXX if we are expanding (see above) why are we overriding here???
slot_content_content_fill: function(assert){
var ins = this.slot_content_content(assert)
var expect = ins.pop()
return [
...ins.map(function(i){
return i +'@slot(slot value)' }),
expect.replace('(( ))', '(( value ))') ] },
//expect.replace('(( ))', 'value') ] },
//
/* XXX SHOWN_HIDDEN
// XXX these need to be revised...
// ...do we actually need hidden/shown???
//
@ -146,6 +95,7 @@ test.Setups({
...ins.map(function(i){
return i +'@slot(slot shown)' }),
'' ] },
//*/
})