rettangoli-ui 0.1.0-rc2 → 0.1.0-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -27
- package/dist/rettangoli-iife-layout.min.js +118 -45
- package/dist/rettangoli-iife-ui.min.js +86 -65
- package/package.json +11 -4
- package/src/common/BaseElement.js +182 -0
- package/src/common.js +190 -0
- package/src/components/dialog/dialog.handlers.js +5 -0
- package/src/components/dialog/dialog.store.js +24 -0
- package/src/components/dialog/dialog.view.yaml +41 -0
- package/src/components/dropdownMenu/dropdownMenu.handlers.js +5 -0
- package/src/components/dropdownMenu/dropdownMenu.store.js +25 -0
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +52 -0
- package/src/components/form/form.handlers.js +30 -0
- package/src/components/form/form.store.js +45 -0
- package/src/components/form/form.view.yaml +47 -0
- package/src/components/navbar/navbar.examples.yaml +86 -0
- package/src/components/navbar/navbar.handlers.js +10 -0
- package/src/components/navbar/navbar.store.js +46 -0
- package/src/components/navbar/navbar.view.yaml +74 -0
- package/src/components/pageOutline/pageOutline.handlers.js +69 -0
- package/src/components/pageOutline/pageOutline.store.js +40 -0
- package/src/components/pageOutline/pageOutline.view.yaml +34 -0
- package/src/components/popover/popover.handlers.js +5 -0
- package/src/components/popover/popover.store.js +12 -0
- package/src/components/popover/popover.view.yaml +57 -0
- package/src/components/select/select.handlers.js +46 -0
- package/src/components/select/select.store.js +65 -0
- package/src/components/select/select.view.yaml +50 -0
- package/src/components/sidebar/sidebar.handlers.js +36 -0
- package/src/components/sidebar/sidebar.store.js +139 -0
- package/src/components/sidebar/sidebar.view.yaml +190 -0
- package/src/entry-iife-layout.js +15 -0
- package/src/entry-iife-ui.js +18 -0
- package/src/index.js +17 -0
- package/src/lib/uhtml.js +9 -0
- package/src/primitives/button.js +306 -0
- package/src/primitives/image.js +234 -0
- package/src/primitives/input.js +208 -0
- package/src/primitives/svg.js +95 -0
- package/src/primitives/text.js +141 -0
- package/src/primitives/textarea.js +103 -0
- package/src/primitives/view.js +217 -0
- package/src/setup.js +16 -0
- package/src/styles/anchorStyles.js +13 -0
- package/src/styles/buttonMarginStyles.js +84 -0
- package/src/styles/cursorStyles.js +12 -0
- package/src/styles/flexChildStyles.js +43 -0
- package/src/styles/flexDirectionStyles.js +74 -0
- package/src/styles/marginStyles.js +13 -0
- package/src/styles/paddingSvgStyles.js +120 -0
- package/src/styles/scrollStyles.js +22 -0
- package/src/styles/textColorStyles.js +14 -0
- package/src/styles/textStyles.js +62 -0
- package/src/styles/viewStyles.js +119 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
export const INITIAL_STATE = Object.freeze({});
|
2
|
+
|
3
|
+
const blacklistedAttrs = ['id', 'class', 'style', 'slot'];
|
4
|
+
|
5
|
+
const stringifyAttrs = (attrs) => {
|
6
|
+
return Object.entries(attrs).filter(([key]) => !blacklistedAttrs.includes(key)).map(([key, value]) => `${key}=${value}`).join(' ');
|
7
|
+
}
|
8
|
+
|
9
|
+
function flattenItems(items, selectedItemId = null) {
|
10
|
+
let result = [];
|
11
|
+
|
12
|
+
for (const item of items) {
|
13
|
+
const itemId = item.id || item.href || item.path;
|
14
|
+
const isSelected = selectedItemId === itemId;
|
15
|
+
|
16
|
+
// Add the parent item if it's not just a group label
|
17
|
+
result.push({
|
18
|
+
id: itemId,
|
19
|
+
title: item.title,
|
20
|
+
href: item.href,
|
21
|
+
type: item.type || 'item',
|
22
|
+
icon: item.icon,
|
23
|
+
hrefAttr: item.href ? `href=${item.href}` : '',
|
24
|
+
isSelected,
|
25
|
+
itemBgc: isSelected ? 'ac' : 'bg',
|
26
|
+
itemHoverBgc: isSelected ? 'ac' : 'mu',
|
27
|
+
});
|
28
|
+
|
29
|
+
// Add child items if they exist
|
30
|
+
if (item.items && Array.isArray(item.items)) {
|
31
|
+
for (const subItem of item.items) {
|
32
|
+
const subItemId = subItem.id || subItem.href || subItem.path;
|
33
|
+
const isSubSelected = selectedItemId === subItemId;
|
34
|
+
|
35
|
+
result.push({
|
36
|
+
id: subItemId,
|
37
|
+
title: subItem.title,
|
38
|
+
href: subItem.href,
|
39
|
+
type: subItem.type || 'item',
|
40
|
+
icon: subItem.icon,
|
41
|
+
hrefAttr: subItem.href ? `href=${subItem.href}` : '',
|
42
|
+
isSelected: isSubSelected,
|
43
|
+
itemBgc: isSubSelected ? 'ac' : 'bg',
|
44
|
+
itemHoverBgc: isSubSelected ? 'ac' : 'mu',
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
return result;
|
51
|
+
}
|
52
|
+
|
53
|
+
export const toViewData = ({ state, props, attrs }) => {
|
54
|
+
const attrsHeader = attrs.header ? JSON.parse(decodeURIComponent(attrs.header)) : props.header;
|
55
|
+
const attrsItems = attrs.items ? JSON.parse(decodeURIComponent(attrs.items)) : props.items;
|
56
|
+
const selectedItemId = attrs.selectedItemId || props.selectedItemId;
|
57
|
+
|
58
|
+
const containerAttrString = stringifyAttrs(attrs);
|
59
|
+
const mode = attrs.mode || 'full';
|
60
|
+
const header = attrsHeader || {
|
61
|
+
label: '',
|
62
|
+
path: '',
|
63
|
+
image: {
|
64
|
+
src: '',
|
65
|
+
alt: '',
|
66
|
+
width: 0,
|
67
|
+
height: 0,
|
68
|
+
},
|
69
|
+
};
|
70
|
+
|
71
|
+
const items = attrsItems ? flattenItems(attrsItems, selectedItemId) : [];
|
72
|
+
|
73
|
+
// Computed values based on mode
|
74
|
+
const sidebarWidth = mode === 'full' ? 272 : 64;
|
75
|
+
const headerAlign = mode === 'full' ? 'fs' : 'c';
|
76
|
+
const itemAlign = mode === 'full' ? 'fs' : 'c';
|
77
|
+
const headerPadding = mode === 'full' ? 'lg' : 'sm';
|
78
|
+
const itemPadding = mode === 'full' ? 'md' : 'sm';
|
79
|
+
const itemHeight = mode === 'shrunk-lg' ? 48 : 40;
|
80
|
+
const iconSize = mode === 'shrunk-lg' ? 28 : 20;
|
81
|
+
const firstLetterSize = mode === 'shrunk-lg' ? 'md' : 'sm';
|
82
|
+
const showLabels = mode === 'full';
|
83
|
+
const showGroupLabels = mode === 'full';
|
84
|
+
|
85
|
+
// For items with icons in full mode, we need left alignment within the container
|
86
|
+
// but the container itself should use flex-start alignment
|
87
|
+
const itemContentAlign = mode === 'full' ? 'fs' : 'c';
|
88
|
+
|
89
|
+
// Item container alignment - only set for shrunk modes, leave default for full mode
|
90
|
+
const itemAlignAttr = mode === 'full' ? '' : `ah=${itemAlign}`;
|
91
|
+
|
92
|
+
// Item width - for shrunk modes, make it square to constrain the highlight
|
93
|
+
const itemWidth = mode === 'full' ? 'f' : itemHeight;
|
94
|
+
|
95
|
+
// Header width - should match item width for alignment
|
96
|
+
const headerWidth = itemWidth;
|
97
|
+
|
98
|
+
return {
|
99
|
+
containerAttrString,
|
100
|
+
mode,
|
101
|
+
header,
|
102
|
+
items,
|
103
|
+
sidebarWidth,
|
104
|
+
headerAlign,
|
105
|
+
itemAlign,
|
106
|
+
headerPadding,
|
107
|
+
itemPadding,
|
108
|
+
itemHeight,
|
109
|
+
iconSize,
|
110
|
+
firstLetterSize,
|
111
|
+
showLabels,
|
112
|
+
showGroupLabels,
|
113
|
+
itemContentAlign,
|
114
|
+
itemAlignAttr,
|
115
|
+
itemWidth,
|
116
|
+
headerWidth,
|
117
|
+
selectedItemId
|
118
|
+
};
|
119
|
+
}
|
120
|
+
|
121
|
+
export const selectHeader = ({ state, props, attrs }) => {
|
122
|
+
const attrsHeader = attrs.header ? JSON.parse(decodeURIComponent(attrs.header)) : props.header;
|
123
|
+
return attrsHeader;
|
124
|
+
}
|
125
|
+
|
126
|
+
export const selectActiveItem = ({ state, props }) => {
|
127
|
+
const items = props.items ? flattenItems(props.items) : [];
|
128
|
+
return items.find(item => item.active);
|
129
|
+
}
|
130
|
+
|
131
|
+
export const selectItem = ({ state, props, attrs }, id) => {
|
132
|
+
const attrsItems = attrs.items ? JSON.parse(decodeURIComponent(attrs.items)) : props.items;
|
133
|
+
const items = attrsItems ? flattenItems(attrsItems) : [];
|
134
|
+
return items.find(item => item.id === id);
|
135
|
+
}
|
136
|
+
|
137
|
+
export const setState = (state) => {
|
138
|
+
// State management if needed
|
139
|
+
}
|
@@ -0,0 +1,190 @@
|
|
1
|
+
elementName: rtgl-sidebar
|
2
|
+
|
3
|
+
viewDataSchema:
|
4
|
+
type: object
|
5
|
+
properties:
|
6
|
+
containerAttrString:
|
7
|
+
type: string
|
8
|
+
mode:
|
9
|
+
type: string
|
10
|
+
enum: ['full', 'shrunk', 'shrunk-lg']
|
11
|
+
default: 'full'
|
12
|
+
sidebarWidth:
|
13
|
+
type: number
|
14
|
+
headerAlign:
|
15
|
+
type: string
|
16
|
+
itemAlign:
|
17
|
+
type: string
|
18
|
+
headerPadding:
|
19
|
+
type: string
|
20
|
+
itemPadding:
|
21
|
+
type: string
|
22
|
+
itemHeight:
|
23
|
+
type: number
|
24
|
+
iconSize:
|
25
|
+
type: number
|
26
|
+
firstLetterSize:
|
27
|
+
type: string
|
28
|
+
showLabels:
|
29
|
+
type: boolean
|
30
|
+
showGroupLabels:
|
31
|
+
type: boolean
|
32
|
+
itemContentAlign:
|
33
|
+
type: string
|
34
|
+
itemAlignAttr:
|
35
|
+
type: string
|
36
|
+
itemWidth:
|
37
|
+
type: string
|
38
|
+
headerWidth:
|
39
|
+
type: string
|
40
|
+
selectedItemId:
|
41
|
+
type: string
|
42
|
+
header:
|
43
|
+
type: object
|
44
|
+
properties:
|
45
|
+
label:
|
46
|
+
type: string
|
47
|
+
href:
|
48
|
+
type: string
|
49
|
+
image:
|
50
|
+
type: object
|
51
|
+
properties:
|
52
|
+
src:
|
53
|
+
type: string
|
54
|
+
width:
|
55
|
+
type: number
|
56
|
+
height:
|
57
|
+
type: number
|
58
|
+
alt:
|
59
|
+
type: string
|
60
|
+
items:
|
61
|
+
type: array
|
62
|
+
items:
|
63
|
+
type: object
|
64
|
+
properties:
|
65
|
+
title:
|
66
|
+
type: string
|
67
|
+
slug:
|
68
|
+
type: string
|
69
|
+
type:
|
70
|
+
type: string
|
71
|
+
active:
|
72
|
+
type: boolean
|
73
|
+
icon:
|
74
|
+
type: string
|
75
|
+
|
76
|
+
propsSchema:
|
77
|
+
type: object
|
78
|
+
properties:
|
79
|
+
selectedItemId:
|
80
|
+
type: string
|
81
|
+
header:
|
82
|
+
type: object
|
83
|
+
properties:
|
84
|
+
label:
|
85
|
+
type: string
|
86
|
+
href:
|
87
|
+
type: string
|
88
|
+
image:
|
89
|
+
type: object
|
90
|
+
properties:
|
91
|
+
src:
|
92
|
+
type: string
|
93
|
+
width:
|
94
|
+
type: number
|
95
|
+
height:
|
96
|
+
type: number
|
97
|
+
alt:
|
98
|
+
type: string
|
99
|
+
items:
|
100
|
+
type: array
|
101
|
+
items:
|
102
|
+
type: object
|
103
|
+
properties:
|
104
|
+
title:
|
105
|
+
type: string
|
106
|
+
slug:
|
107
|
+
type: string
|
108
|
+
type:
|
109
|
+
type: string
|
110
|
+
items:
|
111
|
+
type: array
|
112
|
+
|
113
|
+
refs:
|
114
|
+
header-image:
|
115
|
+
eventListeners:
|
116
|
+
click:
|
117
|
+
handler: handleHeaderClick
|
118
|
+
header-label:
|
119
|
+
eventListeners:
|
120
|
+
click:
|
121
|
+
handler: handleHeaderClick
|
122
|
+
header:
|
123
|
+
eventListeners:
|
124
|
+
click:
|
125
|
+
handler: handleHeaderClick
|
126
|
+
item-*:
|
127
|
+
eventListeners:
|
128
|
+
click:
|
129
|
+
handler: handleItemClick
|
130
|
+
|
131
|
+
events:
|
132
|
+
headerClick:
|
133
|
+
type: object
|
134
|
+
properties:
|
135
|
+
path:
|
136
|
+
type: string
|
137
|
+
|
138
|
+
anchors:
|
139
|
+
- &headerContent
|
140
|
+
- $if header.image && header.image.src:
|
141
|
+
- $if header.image.href:
|
142
|
+
- a href=${header.image.href}:
|
143
|
+
- rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}":
|
144
|
+
$elif header.image.path:
|
145
|
+
- rtgl-view#header-image cur=p:
|
146
|
+
- rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}":
|
147
|
+
$else:
|
148
|
+
- rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}":
|
149
|
+
- $if header.label && showLabels:
|
150
|
+
- $if header.labelHref:
|
151
|
+
- rtgl-text href=${header.labelHref} s=lg: "${header.label}"
|
152
|
+
$elif header.labelPath:
|
153
|
+
- rtgl-view#header-label cur=p:
|
154
|
+
- rtgl-text s=lg: "${header.label}"
|
155
|
+
$else:
|
156
|
+
- rtgl-text s=lg: "${header.label}"
|
157
|
+
|
158
|
+
template:
|
159
|
+
- rtgl-view h=f w=${sidebarWidth} bwr=xs ${containerAttrString}:
|
160
|
+
- rtgl-view ph=${headerPadding} pv=lg:
|
161
|
+
- $if header.href:
|
162
|
+
- rtgl-view href=${header.href} d=h av=c ah=${headerAlign} g=lg w=${headerWidth}:
|
163
|
+
- *headerContent
|
164
|
+
$else:
|
165
|
+
- rtgl-view#header d=h av=c ah=${headerAlign} g=lg w=${headerWidth} cur=p:
|
166
|
+
- *headerContent
|
167
|
+
|
168
|
+
- rtgl-view w=f ph=${headerPadding} pb=lg g=xs:
|
169
|
+
- $for item, i in items:
|
170
|
+
- $if item.type == "groupLabel":
|
171
|
+
- $if showGroupLabels:
|
172
|
+
- rtgl-view mt=md h=32 av=c ph=md:
|
173
|
+
- rtgl-text s=xs c=mu-fg: "${item.title}"
|
174
|
+
$else:
|
175
|
+
- rtgl-view mt=md h=1 bgc=mu-bg:
|
176
|
+
$else:
|
177
|
+
- rtgl-view#item-${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=p title="${item.title}":
|
178
|
+
- $if item.icon:
|
179
|
+
- $if showLabels:
|
180
|
+
- rtgl-view d=h ah=${itemContentAlign} g=sm:
|
181
|
+
- rtgl-svg wh=16 svg=${item.icon} c=fg:
|
182
|
+
- rtgl-text s=sm: "${item.title}"
|
183
|
+
$else:
|
184
|
+
- rtgl-svg wh=${iconSize} svg=${item.icon} c=fg:
|
185
|
+
$else:
|
186
|
+
- $if showLabels:
|
187
|
+
- rtgl-text s=sm: "${item.title}"
|
188
|
+
$else:
|
189
|
+
- rtgl-view wh=${iconSize} br=f bgc=mu av=c ah=c:
|
190
|
+
- rtgl-text s=${firstLetterSize} c=fg: "${item.title.charAt(0).toUpperCase()}"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import RettangoliButton from './primitives/button.js'
|
2
|
+
import RettangoliView from './primitives/view.js';
|
3
|
+
import RettangoliText from './primitives/text.js';
|
4
|
+
import RettangoliImage from './primitives/image.js';
|
5
|
+
import RettangoliSvg from './primitives/svg.js';
|
6
|
+
import RettangoliInput from './primitives/input.js';
|
7
|
+
import RettangoliTextArea from './primitives/textarea.js';
|
8
|
+
|
9
|
+
customElements.define("rtgl-button", RettangoliButton({}));
|
10
|
+
customElements.define("rtgl-view", RettangoliView({}));
|
11
|
+
customElements.define("rtgl-text", RettangoliText({}));
|
12
|
+
customElements.define("rtgl-image", RettangoliImage({}));
|
13
|
+
customElements.define("rtgl-svg", RettangoliSvg({}));
|
14
|
+
customElements.define("rtgl-input", RettangoliInput({}));
|
15
|
+
customElements.define("rtgl-textarea", RettangoliTextArea({}));
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import RettangoliButton from './primitives/button.js'
|
2
|
+
import RettangoliView from './primitives/view.js';
|
3
|
+
import RettangoliText from './primitives/text.js';
|
4
|
+
import RettangoliImage from './primitives/image.js';
|
5
|
+
import RettangoliSvg from './primitives/svg.js';
|
6
|
+
import RettangoliInput from './primitives/input.js';
|
7
|
+
import RettangoliTextArea from './primitives/textarea.js';
|
8
|
+
|
9
|
+
customElements.define("rtgl-button", RettangoliButton({}));
|
10
|
+
customElements.define("rtgl-view", RettangoliView({}));
|
11
|
+
customElements.define("rtgl-text", RettangoliText({}));
|
12
|
+
customElements.define("rtgl-image", RettangoliImage({}));
|
13
|
+
customElements.define("rtgl-svg", RettangoliSvg({}));
|
14
|
+
customElements.define("rtgl-input", RettangoliInput({}));
|
15
|
+
customElements.define("rtgl-textarea", RettangoliTextArea({}));
|
16
|
+
|
17
|
+
// built from rettangoli cli fe
|
18
|
+
import '../.temp/dynamicImport.js'
|
package/src/index.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import RettangoliButton from './primitives/button.js'
|
2
|
+
import RettangoliView from './primitives/view.js';
|
3
|
+
import RettangoliText from './primitives/text.js';
|
4
|
+
import RettangoliImage from './primitives/image.js';
|
5
|
+
import RettangoliSvg from './primitives/svg.js';
|
6
|
+
import RettangoliInput from './primitives/input.js';
|
7
|
+
import RettangoliTextArea from './primitives/textarea.js';
|
8
|
+
|
9
|
+
export {
|
10
|
+
RettangoliButton,
|
11
|
+
RettangoliView,
|
12
|
+
RettangoliText,
|
13
|
+
RettangoliImage,
|
14
|
+
RettangoliSvg,
|
15
|
+
RettangoliInput,
|
16
|
+
RettangoliTextArea,
|
17
|
+
}
|
package/src/lib/uhtml.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Skipped minification because the original files appears to be already minified.
|
3
|
+
* Original file: /npm/uhtml@4.7.0/keyed.js
|
4
|
+
*
|
5
|
+
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
6
|
+
*/
|
7
|
+
const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),i=(e,t)=>t.reduceRight(o,e),o=(e,t)=>e.childNodes[t],{setPrototypeOf:c}=Object;let a;var u=(e,t,n)=>(a||(a=s()),n?a.setStartAfter(e):a.setStartBefore(e),a.setEndAfter(t),a.deleteContents(),e);const h=({firstChild:e,lastChild:t},n)=>u(e,t,n);let d=!1;const f=(e,t)=>d&&11===e.nodeType?1/t<0?t?h(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e,p=e=>document.createComment(e);class g extends((e=>{function t(e){return c(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e=p("<>");#t=p("</>");#n=r;constructor(e){super(e),this.replaceChildren(this.#e,...e.childNodes,this.#t),d=!0}get firstChild(){return this.#e}get lastChild(){return this.#t}get parentNode(){return this.#e.parentNode}remove(){h(this,!1)}replaceWith(e){h(this,!0).replaceWith(e)}valueOf(){const{parentNode:e}=this;if(e===this)this.#n===r&&(this.#n=[...this.childNodes]);else{if(e){let{firstChild:e,lastChild:t}=this;for(this.#n=[e];e!==t;)this.#n.push(e=e.nextSibling)}this.replaceChildren(...this.#n)}return this}}const m=(e,t,n)=>e.setAttribute(t,n),b=(e,t)=>e.removeAttribute(t);let v;const C=(t,n,r)=>{r=r.slice(1),v||(v=new WeakMap);const s=v.get(t)||l(v,t,{});let i=s[r];return i&&i[0]&&t.removeEventListener(r,...i),i=e(n)?n:[n,!1],s[r]=i,i[0]&&t.addEventListener(r,...i),n},w=(e,t)=>{const{t:n,n:r}=e;let s=!1;switch(typeof t){case"object":if(null!==t){(r||n).replaceWith(e.n=t.valueOf());break}case"undefined":s=!0;default:n.data=s?"":t,r&&(e.n=null,r.replaceWith(n))}return t},x=(e,t,n)=>e[n]=t,$=(e,t,n)=>x(e,t,n.slice(1)),y=(e,t,n)=>null==t?(b(e,n),t):x(e,t,n),N=(e,t)=>("function"==typeof t?t(e):t.current=e,t),O=(e,t,n)=>(null==t?b(e,n):m(e,n,t),t),k=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),A=(e,t,n)=>{const{length:s}=t;if(e.data=`[${s}]`,s)return((e,t,n,r,s)=>{const l=n.length;let i=t.length,o=l,c=0,a=0,u=null;for(;c<i||a<o;)if(i===c){const t=o<l?a?r(n[a-1],-0).nextSibling:r(n[o],0):s;for(;a<o;)e.insertBefore(r(n[a++],1),t)}else if(o===a)for(;c<i;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[a])c++,a++;else if(t[i-1]===n[o-1])i--,o--;else if(t[c]===n[o-1]&&n[a]===t[i-1]){const s=r(t[--i],-0).nextSibling;e.insertBefore(r(n[a++],1),r(t[c++],-0).nextSibling),e.insertBefore(r(n[--o],1),s),t[i]=n[o]}else{if(!u){u=new Map;let e=a;for(;e<o;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(a<s&&s<o){let l=c,h=1;for(;++l<i&&l<o&&u.get(t[l])===s+h;)h++;if(h>s-a){const l=r(t[c],0);for(;a<s;)e.insertBefore(r(n[a++],1),l)}else e.replaceChild(r(n[a++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n})(e.parentNode,n,t,f,e);switch(n.length){case 1:n[0].remove();case 0:break;default:u(f(n[0],0),f(n.at(-1),-0),!1)}return r},M=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?b(e,s):m(e,s,r)}return t}],["class",(e,t)=>y(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",N],["style",(e,t)=>null==t?y(e,t,"style"):x(e.style,t,"cssText")]]),W=(e,r,s)=>{switch(r[0]){case".":return $;case"?":return k;case"@":return C;default:return s||"ownerSVGElement"in e?"ref"===r?N:O:M.get(r)||(r in e?r.startsWith("on")?x:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?y:O:O)}},S=(e,t)=>(e.textContent=null==t?"":t,t),E=(e,t,n)=>({a:e,b:t,c:n}),T=()=>E(null,null,r);var B=e=>(t,n)=>{const{a:s,b:l,c:o}=e(t,n),c=document.importNode(s,!0);let a=r;if(l!==r){a=[];for(let e,t,n=0;n<l.length;n++){const{a:s,b:o,c:p}=l[n],g=s===t?e:e=i(c,t=s);a[n]=(u=o,h=g,d=p,f=o===A?[]:o===w?T():null,{v:r,u:u,t:h,n:d,c:f})}}var u,h,d,f;return((e,t)=>({b:e,c:t}))(o?c.firstChild:new g(c),a)};const D=/^(?:plaintext|script|style|textarea|title|xmp)$/i,j=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,L=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,P=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,z=/[\x01\x02]/g;let F,R,Z=document.createElement("template");var G=(e,t)=>{if(t)return F||(F=document.createElementNS("http://www.w3.org/2000/svg","svg"),R=s(),R.selectNodeContents(F)),R.createContextualFragment(e);Z.innerHTML=e;const{content:n}=Z;return Z=Z.cloneNode(!1),n};const H=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=()=>document.createTextNode(""),_=(t,n,s)=>{const i=G(((e,t,n)=>{let r=0;return e.join("").trim().replace(L,((e,t,r,s)=>`<${t}${r.replace(P,"=$2$1").trimEnd()}${s?n||j.test(t)?" /":`></${t}`:""}>`)).replace(z,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,I,s),s),{length:o}=t;let c=r;if(o>1){const t=[],r=document.createTreeWalker(i,129);let l=0,a=`${I}${l++}`;for(c=[];l<o;){const i=r.nextNode();if(8===i.nodeType){if(i.data===a){const r=e(n[l-1])?A:w;r===w&&t.push(i),c.push(E(H(i),r,null)),a=`${I}${l++}`}}else{let e;for(;i.hasAttribute(a);){e||(e=H(i));const t=i.getAttribute(a);c.push(E(e,W(i,t,s),t)),b(i,a),a=`${I}${l++}`}!s&&D.test(i.localName)&&i.textContent.trim()===`\x3c!--${a}--\x3e`&&(c.push(E(e||H(i),S,null)),a=`${I}${l++}`)}}for(l=0;l<t.length;l++)t[l].replaceWith(V())}const{childNodes:a}=i;let{length:u}=a;return u<1?(u=1,i.appendChild(V())):1===u&&1!==o&&1!==a[0].nodeType&&(u=0),l(q,t,E(i,c,1===u))},q=new WeakMap,I="isµ";var J=e=>(t,n)=>q.get(t)||_(t,n,e);const K=B(J(!1)),Q=B(J(!0)),U=(e,{s:t,t:n,v:r})=>{if(e.a!==n){const{b:s,c:l}=(t?Q:K)(n,r);e.a=n,e.b=s,e.c=l}for(let{c:t}=e,n=0;n<t.length;n++){const e=r[n],s=t[n];switch(s.u){case A:s.v=A(s.t,X(s.c,e),s.v);break;case w:const t=e instanceof Y?U(s.c||(s.c=T()),e):(s.c=null,e);t!==s.v&&(s.v=w(s,t));break;default:e!==s.v&&(s.v=s.u(s.t,e,s.n,s.v))}}return e.b},X=(e,t)=>{let n=0,{length:r}=t;for(r<e.length&&e.splice(r);n<r;n++){const r=t[n];r instanceof Y?t[n]=U(e[n]||(e[n]=T()),r):e[n]=null}return t};class Y{constructor(e,t,n){this.s=e,this.t=t,this.v=n}toDOM(e=T()){return U(e,this)}}
|
8
|
+
/*! (c) Andrea Giammarchi - MIT */const ee=e=>(t,...n)=>new Y(e,t,n),te=ee(!1),ne=ee(!0),re=new WeakMap;var se=(e,t)=>((e,t)=>{const n=re.get(e)||l(re,e,T()),{b:r}=n,s="function"==typeof t?t():t,i=s instanceof Y?s.toDOM(n):s;return r!==i&&e.replaceChildren((n.b=i).valueOf()),e})(e,t)
|
9
|
+
/*! (c) Andrea Giammarchi - MIT */;const le=new WeakMap,ie=e=>(t,n)=>{const r=le.get(t)||l(le,t,new Map);return r.get(n)||l(r,n,function(t,...n){return new Y(e,t,n).toDOM(this)}.bind(T()))},oe=ie(!1),ce=ie(!0);export{Y as Hole,M as attr,te as html,oe as htmlFor,se as render,ne as svg,ce as svgFor};
|