@pritzlaff/nano-app 0.0.0-stage → 0.5.1
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/AGENTS.md +66 -0
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/app/app.css +160 -0
- package/app/bundle/nano-ui.js +2553 -0
- package/app/examples/auth/example.auth.js +6 -0
- package/app/examples/auth/nano.json +46 -0
- package/app/examples/chat/example.chat.js +6 -0
- package/app/examples/chat/example.messaging.js +3 -0
- package/app/examples/chat/nano.json +115 -0
- package/app/examples/drift/example.drift.js +3 -0
- package/app/examples/drift/nano.json +31 -0
- package/app/examples/kv/example.kv.js +3 -0
- package/app/examples/nano.json +353 -0
- package/app/examples/originkey/_nano/bundle/nano-ui.js +212 -0
- package/app/examples/originkey/_nano/sandbox/boot.js +1 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-2gg2vg5g.js +2 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-5h5dssvv.js +3 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-72b5e6vd.js +17 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-87v2yejk.js +2 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-hm29e227.js +7 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-jtgk4ch8.js +2 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-mqaje7vc.js +2 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-mxgap7rs.js +2 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-qy0mwf7y.js +1 -0
- package/app/examples/originkey/_nano/shared/chunks/nano-core-wanb7xw1.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-class-map.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-decorators.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-directive.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-if-defined.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-ref.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-repeat.js +1 -0
- package/app/examples/originkey/_nano/shared/lit-style-map.js +1 -0
- package/app/examples/originkey/_nano/shared/lit.js +1 -0
- package/app/examples/originkey/_nano/shared/nano-core.js +1 -0
- package/app/examples/originkey/_nano/shared/nano-elements.js +280 -0
- package/app/examples/originkey/_nano/shared/typebox-value.js +1 -0
- package/app/examples/originkey/_nano/shared/typebox.js +1 -0
- package/app/examples/originkey/example.originkey.js +6 -0
- package/app/examples/originkey/frame.html +1 -0
- package/app/examples/originkey/nano.json +50 -0
- package/app/examples/raft/example.raft.js +30 -0
- package/app/examples/raft/nano.json +74 -0
- package/app/examples/slice/nano.json +63 -0
- package/app/examples/slice/shout.js +14 -0
- package/app/examples/template/acme.template.js +11 -0
- package/app/examples/template/index.js +194 -0
- package/app/examples/template/nano.json +32 -0
- package/app/examples/todo/example.todo.js +8 -0
- package/app/examples/todo/nano.json +77 -0
- package/app/examples/typing/nano.json +33 -0
- package/app/favicon.svg +1 -0
- package/app/index.html +152 -0
- package/app/main.js +15906 -0
- package/app/react/index.html +50 -0
- package/app/react/main.js +9 -0
- package/app/sandbox/boot.js +980 -0
- package/app/shared/chunks/nano-core-296y9rgd.js +4321 -0
- package/app/shared/chunks/nano-core-2zz7d74m.js +16 -0
- package/app/shared/chunks/nano-core-35ryhkm1.js +33 -0
- package/app/shared/chunks/nano-core-5a3r312d.js +866 -0
- package/app/shared/chunks/nano-core-89mtxedm.js +186 -0
- package/app/shared/chunks/nano-core-bf13r20v.js +77 -0
- package/app/shared/chunks/nano-core-g3414rnc.js +248 -0
- package/app/shared/chunks/nano-core-hyg0qdwg.js +547 -0
- package/app/shared/chunks/nano-core-sxgrxy03.js +53 -0
- package/app/shared/chunks/nano-core-wg5c961d.js +4564 -0
- package/app/shared/lit-class-map.js +60 -0
- package/app/shared/lit-decorators.js +228 -0
- package/app/shared/lit-directive.js +11 -0
- package/app/shared/lit-if-defined.js +10 -0
- package/app/shared/lit-ref.js +12 -0
- package/app/shared/lit-repeat.js +141 -0
- package/app/shared/lit-style-map.js +67 -0
- package/app/shared/lit.js +47 -0
- package/app/shared/nano-core.js +2348 -0
- package/app/shared/nano-elements.js +1178 -0
- package/app/shared/typebox-value.js +78 -0
- package/app/shared/typebox.js +580 -0
- package/app/shared/versions.json +6 -0
- package/bin/nano-app.ts +34 -0
- package/package.json +22 -4
- package/src/events.ts +11 -0
- package/src/serve.ts +68 -0
- package/src/watch.ts +27 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
// ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/css-tag.js
|
|
2
|
+
var NODE_MODE = false;
|
|
3
|
+
var global = globalThis;
|
|
4
|
+
var supportsAdoptingStyleSheets = global.ShadowRoot && (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
|
|
5
|
+
var constructionToken = Symbol();
|
|
6
|
+
var cssTagCache = new WeakMap;
|
|
7
|
+
|
|
8
|
+
class CSSResult {
|
|
9
|
+
constructor(cssText, strings, safeToken) {
|
|
10
|
+
this["_$cssResult$"] = true;
|
|
11
|
+
if (safeToken !== constructionToken) {
|
|
12
|
+
throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
13
|
+
}
|
|
14
|
+
this.cssText = cssText;
|
|
15
|
+
this._strings = strings;
|
|
16
|
+
}
|
|
17
|
+
get styleSheet() {
|
|
18
|
+
let styleSheet = this._styleSheet;
|
|
19
|
+
const strings = this._strings;
|
|
20
|
+
if (supportsAdoptingStyleSheets && styleSheet === undefined) {
|
|
21
|
+
const cacheable = strings !== undefined && strings.length === 1;
|
|
22
|
+
if (cacheable) {
|
|
23
|
+
styleSheet = cssTagCache.get(strings);
|
|
24
|
+
}
|
|
25
|
+
if (styleSheet === undefined) {
|
|
26
|
+
(this._styleSheet = styleSheet = new CSSStyleSheet).replaceSync(this.cssText);
|
|
27
|
+
if (cacheable) {
|
|
28
|
+
cssTagCache.set(strings, styleSheet);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return styleSheet;
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
return this.cssText;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var textFromCSSResult = (value) => {
|
|
39
|
+
if (value["_$cssResult$"] === true) {
|
|
40
|
+
return value.cssText;
|
|
41
|
+
} else if (typeof value === "number") {
|
|
42
|
+
return value;
|
|
43
|
+
} else {
|
|
44
|
+
throw new Error(`Value passed to 'css' function must be a 'css' function result: ` + `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` + `to ensure page security.`);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var unsafeCSS = (value) => new CSSResult(typeof value === "string" ? value : String(value), undefined, constructionToken);
|
|
48
|
+
var css = (strings, ...values) => {
|
|
49
|
+
const cssText = strings.length === 1 ? strings[0] : values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
|
|
50
|
+
return new CSSResult(cssText, strings, constructionToken);
|
|
51
|
+
};
|
|
52
|
+
var adoptStyles = (renderRoot, styles) => {
|
|
53
|
+
if (supportsAdoptingStyleSheets) {
|
|
54
|
+
renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
|
|
55
|
+
} else {
|
|
56
|
+
for (const s of styles) {
|
|
57
|
+
const style = document.createElement("style");
|
|
58
|
+
const nonce = global["litNonce"];
|
|
59
|
+
if (nonce !== undefined) {
|
|
60
|
+
style.setAttribute("nonce", nonce);
|
|
61
|
+
}
|
|
62
|
+
style.textContent = s.cssText;
|
|
63
|
+
renderRoot.appendChild(style);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var cssResultFromStyleSheet = (sheet) => {
|
|
68
|
+
let cssText = "";
|
|
69
|
+
for (const rule of sheet.cssRules) {
|
|
70
|
+
cssText += rule.cssText;
|
|
71
|
+
}
|
|
72
|
+
return unsafeCSS(cssText);
|
|
73
|
+
};
|
|
74
|
+
var getCompatibleStyle = supportsAdoptingStyleSheets || NODE_MODE && global.CSSStyleSheet === undefined ? (s) => s : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/reactive-element.js
|
|
77
|
+
var { is, defineProperty, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf } = Object;
|
|
78
|
+
var NODE_MODE2 = false;
|
|
79
|
+
var global2 = globalThis;
|
|
80
|
+
if (NODE_MODE2) {
|
|
81
|
+
global2.customElements ??= customElements;
|
|
82
|
+
}
|
|
83
|
+
var DEV_MODE = true;
|
|
84
|
+
var issueWarning;
|
|
85
|
+
var trustedTypes = global2.trustedTypes;
|
|
86
|
+
var emptyStringForBooleanAttribute = trustedTypes ? trustedTypes.emptyScript : "";
|
|
87
|
+
var polyfillSupport = DEV_MODE ? global2.reactiveElementPolyfillSupportDevMode : global2.reactiveElementPolyfillSupport;
|
|
88
|
+
if (DEV_MODE) {
|
|
89
|
+
global2.litIssuedWarnings ??= new Set;
|
|
90
|
+
issueWarning = (code, warning) => {
|
|
91
|
+
warning += ` See https://lit.dev/msg/${code} for more information.`;
|
|
92
|
+
if (!global2.litIssuedWarnings.has(warning) && !global2.litIssuedWarnings.has(code)) {
|
|
93
|
+
console.warn(warning);
|
|
94
|
+
global2.litIssuedWarnings.add(warning);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
queueMicrotask(() => {
|
|
98
|
+
issueWarning("dev-mode", `Lit is in dev mode. Not recommended for production!`);
|
|
99
|
+
if (global2.ShadyDOM?.inUse && polyfillSupport === undefined) {
|
|
100
|
+
issueWarning("polyfill-support-missing", `Shadow DOM is being polyfilled via \`ShadyDOM\` but ` + `the \`polyfill-support\` module has not been loaded.`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
var debugLogEvent = DEV_MODE ? (event) => {
|
|
105
|
+
const shouldEmit = global2.emitLitDebugLogEvents;
|
|
106
|
+
if (!shouldEmit) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
global2.dispatchEvent(new CustomEvent("lit-debug", {
|
|
110
|
+
detail: event
|
|
111
|
+
}));
|
|
112
|
+
} : undefined;
|
|
113
|
+
var JSCompiler_renameProperty = (prop, _obj) => prop;
|
|
114
|
+
var defaultConverter = {
|
|
115
|
+
toAttribute(value, type) {
|
|
116
|
+
switch (type) {
|
|
117
|
+
case Boolean:
|
|
118
|
+
value = value ? emptyStringForBooleanAttribute : null;
|
|
119
|
+
break;
|
|
120
|
+
case Object:
|
|
121
|
+
case Array:
|
|
122
|
+
value = value == null ? value : JSON.stringify(value);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
return value;
|
|
126
|
+
},
|
|
127
|
+
fromAttribute(value, type) {
|
|
128
|
+
let fromValue = value;
|
|
129
|
+
switch (type) {
|
|
130
|
+
case Boolean:
|
|
131
|
+
fromValue = value !== null;
|
|
132
|
+
break;
|
|
133
|
+
case Number:
|
|
134
|
+
fromValue = value === null ? null : Number(value);
|
|
135
|
+
break;
|
|
136
|
+
case Object:
|
|
137
|
+
case Array:
|
|
138
|
+
try {
|
|
139
|
+
fromValue = JSON.parse(value);
|
|
140
|
+
} catch (e) {
|
|
141
|
+
fromValue = null;
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return fromValue;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var notEqual = (value, old) => !is(value, old);
|
|
149
|
+
var defaultPropertyDeclaration = {
|
|
150
|
+
attribute: true,
|
|
151
|
+
type: String,
|
|
152
|
+
converter: defaultConverter,
|
|
153
|
+
reflect: false,
|
|
154
|
+
useDefault: false,
|
|
155
|
+
hasChanged: notEqual
|
|
156
|
+
};
|
|
157
|
+
Symbol.metadata ??= Symbol("metadata");
|
|
158
|
+
global2.litPropertyMetadata ??= new WeakMap;
|
|
159
|
+
|
|
160
|
+
class ReactiveElement extends HTMLElement {
|
|
161
|
+
static addInitializer(initializer) {
|
|
162
|
+
this.__prepare();
|
|
163
|
+
(this._initializers ??= []).push(initializer);
|
|
164
|
+
}
|
|
165
|
+
static get observedAttributes() {
|
|
166
|
+
this.finalize();
|
|
167
|
+
return this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()];
|
|
168
|
+
}
|
|
169
|
+
static createProperty(name, options = defaultPropertyDeclaration) {
|
|
170
|
+
if (options.state) {
|
|
171
|
+
options.attribute = false;
|
|
172
|
+
}
|
|
173
|
+
this.__prepare();
|
|
174
|
+
if (this.prototype.hasOwnProperty(name)) {
|
|
175
|
+
options = Object.create(options);
|
|
176
|
+
options.wrapped = true;
|
|
177
|
+
}
|
|
178
|
+
this.elementProperties.set(name, options);
|
|
179
|
+
if (!options.noAccessor) {
|
|
180
|
+
const key = DEV_MODE ? Symbol.for(`${String(name)} (@property() cache)`) : Symbol();
|
|
181
|
+
const descriptor = this.getPropertyDescriptor(name, key, options);
|
|
182
|
+
if (descriptor !== undefined) {
|
|
183
|
+
defineProperty(this.prototype, name, descriptor);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
static getPropertyDescriptor(name, key, options) {
|
|
188
|
+
const { get, set } = getOwnPropertyDescriptor(this.prototype, name) ?? {
|
|
189
|
+
get() {
|
|
190
|
+
return this[key];
|
|
191
|
+
},
|
|
192
|
+
set(v) {
|
|
193
|
+
this[key] = v;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
if (DEV_MODE && get == null) {
|
|
197
|
+
if ("value" in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {
|
|
198
|
+
throw new Error(`Field ${JSON.stringify(String(name))} on ` + `${this.name} was declared as a reactive property ` + `but it's actually declared as a value on the prototype. ` + `Usually this is due to using @property or @state on a method.`);
|
|
199
|
+
}
|
|
200
|
+
issueWarning("reactive-property-without-getter", `Field ${JSON.stringify(String(name))} on ` + `${this.name} was declared as a reactive property ` + `but it does not have a getter. This will be an error in a ` + `future version of Lit.`);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
get,
|
|
204
|
+
set(value) {
|
|
205
|
+
const oldValue = get?.call(this);
|
|
206
|
+
set?.call(this, value);
|
|
207
|
+
this.requestUpdate(name, oldValue, options);
|
|
208
|
+
},
|
|
209
|
+
configurable: true,
|
|
210
|
+
enumerable: true
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
static getPropertyOptions(name) {
|
|
214
|
+
return this.elementProperties.get(name) ?? defaultPropertyDeclaration;
|
|
215
|
+
}
|
|
216
|
+
static __prepare() {
|
|
217
|
+
if (this.hasOwnProperty(JSCompiler_renameProperty("elementProperties", this))) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const superCtor = getPrototypeOf(this);
|
|
221
|
+
superCtor.finalize();
|
|
222
|
+
if (superCtor._initializers !== undefined) {
|
|
223
|
+
this._initializers = [...superCtor._initializers];
|
|
224
|
+
}
|
|
225
|
+
this.elementProperties = new Map(superCtor.elementProperties);
|
|
226
|
+
}
|
|
227
|
+
static finalize() {
|
|
228
|
+
if (this.hasOwnProperty(JSCompiler_renameProperty("finalized", this))) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
this.finalized = true;
|
|
232
|
+
this.__prepare();
|
|
233
|
+
if (this.hasOwnProperty(JSCompiler_renameProperty("properties", this))) {
|
|
234
|
+
const props = this.properties;
|
|
235
|
+
const propKeys = [
|
|
236
|
+
...getOwnPropertyNames(props),
|
|
237
|
+
...getOwnPropertySymbols(props)
|
|
238
|
+
];
|
|
239
|
+
for (const p of propKeys) {
|
|
240
|
+
this.createProperty(p, props[p]);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const metadata = this[Symbol.metadata];
|
|
244
|
+
if (metadata !== null) {
|
|
245
|
+
const properties = litPropertyMetadata.get(metadata);
|
|
246
|
+
if (properties !== undefined) {
|
|
247
|
+
for (const [p, options] of properties) {
|
|
248
|
+
this.elementProperties.set(p, options);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
this.__attributeToPropertyMap = new Map;
|
|
253
|
+
for (const [p, options] of this.elementProperties) {
|
|
254
|
+
const attr = this.__attributeNameForProperty(p, options);
|
|
255
|
+
if (attr !== undefined) {
|
|
256
|
+
this.__attributeToPropertyMap.set(attr, p);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
260
|
+
if (DEV_MODE) {
|
|
261
|
+
if (this.hasOwnProperty("createProperty")) {
|
|
262
|
+
issueWarning("no-override-create-property", "Overriding ReactiveElement.createProperty() is deprecated. " + "The override will not be called with standard decorators");
|
|
263
|
+
}
|
|
264
|
+
if (this.hasOwnProperty("getPropertyDescriptor")) {
|
|
265
|
+
issueWarning("no-override-get-property-descriptor", "Overriding ReactiveElement.getPropertyDescriptor() is deprecated. " + "The override will not be called with standard decorators");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
static finalizeStyles(styles) {
|
|
270
|
+
const elementStyles = [];
|
|
271
|
+
if (Array.isArray(styles)) {
|
|
272
|
+
const set = new Set(styles.flat(Infinity).reverse());
|
|
273
|
+
for (const s of set) {
|
|
274
|
+
elementStyles.unshift(getCompatibleStyle(s));
|
|
275
|
+
}
|
|
276
|
+
} else if (styles !== undefined) {
|
|
277
|
+
elementStyles.push(getCompatibleStyle(styles));
|
|
278
|
+
}
|
|
279
|
+
return elementStyles;
|
|
280
|
+
}
|
|
281
|
+
static __attributeNameForProperty(name, options) {
|
|
282
|
+
const attribute = options.attribute;
|
|
283
|
+
return attribute === false ? undefined : typeof attribute === "string" ? attribute : typeof name === "string" ? name.toLowerCase() : undefined;
|
|
284
|
+
}
|
|
285
|
+
constructor() {
|
|
286
|
+
super();
|
|
287
|
+
this.__instanceProperties = undefined;
|
|
288
|
+
this.isUpdatePending = false;
|
|
289
|
+
this.hasUpdated = false;
|
|
290
|
+
this.__reflectingProperty = null;
|
|
291
|
+
this.__initialize();
|
|
292
|
+
}
|
|
293
|
+
__initialize() {
|
|
294
|
+
this.__updatePromise = new Promise((res) => this.enableUpdating = res);
|
|
295
|
+
this._$changedProperties = new Map;
|
|
296
|
+
this.__saveInstanceProperties();
|
|
297
|
+
this.requestUpdate();
|
|
298
|
+
this.constructor._initializers?.forEach((i) => i(this));
|
|
299
|
+
}
|
|
300
|
+
addController(controller) {
|
|
301
|
+
(this.__controllers ??= new Set).add(controller);
|
|
302
|
+
if (this.renderRoot !== undefined && this.isConnected) {
|
|
303
|
+
controller.hostConnected?.();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
removeController(controller) {
|
|
307
|
+
this.__controllers?.delete(controller);
|
|
308
|
+
}
|
|
309
|
+
__saveInstanceProperties() {
|
|
310
|
+
const instanceProperties = new Map;
|
|
311
|
+
const elementProperties = this.constructor.elementProperties;
|
|
312
|
+
for (const p of elementProperties.keys()) {
|
|
313
|
+
if (this.hasOwnProperty(p)) {
|
|
314
|
+
instanceProperties.set(p, this[p]);
|
|
315
|
+
delete this[p];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (instanceProperties.size > 0) {
|
|
319
|
+
this.__instanceProperties = instanceProperties;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
createRenderRoot() {
|
|
323
|
+
const renderRoot = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
324
|
+
adoptStyles(renderRoot, this.constructor.elementStyles);
|
|
325
|
+
return renderRoot;
|
|
326
|
+
}
|
|
327
|
+
connectedCallback() {
|
|
328
|
+
this.renderRoot ??= this.createRenderRoot();
|
|
329
|
+
this.enableUpdating(true);
|
|
330
|
+
this.__controllers?.forEach((c) => c.hostConnected?.());
|
|
331
|
+
}
|
|
332
|
+
enableUpdating(_requestedUpdate) {}
|
|
333
|
+
disconnectedCallback() {
|
|
334
|
+
this.__controllers?.forEach((c) => c.hostDisconnected?.());
|
|
335
|
+
}
|
|
336
|
+
attributeChangedCallback(name, _old, value) {
|
|
337
|
+
this._$attributeToProperty(name, value);
|
|
338
|
+
}
|
|
339
|
+
__propertyToAttribute(name, value) {
|
|
340
|
+
const elemProperties = this.constructor.elementProperties;
|
|
341
|
+
const options = elemProperties.get(name);
|
|
342
|
+
const attr = this.constructor.__attributeNameForProperty(name, options);
|
|
343
|
+
if (attr !== undefined && options.reflect === true) {
|
|
344
|
+
const converter = options.converter?.toAttribute !== undefined ? options.converter : defaultConverter;
|
|
345
|
+
const attrValue = converter.toAttribute(value, options.type);
|
|
346
|
+
if (DEV_MODE && this.constructor.enabledWarnings.includes("migration") && attrValue === undefined) {
|
|
347
|
+
issueWarning("undefined-attribute-value", `The attribute value for the ${name} property is ` + `undefined on element ${this.localName}. The attribute will be ` + `removed, but in the previous version of \`ReactiveElement\`, ` + `the attribute would not have changed.`);
|
|
348
|
+
}
|
|
349
|
+
this.__reflectingProperty = name;
|
|
350
|
+
if (attrValue == null) {
|
|
351
|
+
this.removeAttribute(attr);
|
|
352
|
+
} else {
|
|
353
|
+
this.setAttribute(attr, attrValue);
|
|
354
|
+
}
|
|
355
|
+
this.__reflectingProperty = null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
_$attributeToProperty(name, value) {
|
|
359
|
+
const ctor = this.constructor;
|
|
360
|
+
const propName = ctor.__attributeToPropertyMap.get(name);
|
|
361
|
+
if (propName !== undefined && this.__reflectingProperty !== propName) {
|
|
362
|
+
const options = ctor.getPropertyOptions(propName);
|
|
363
|
+
const converter = typeof options.converter === "function" ? { fromAttribute: options.converter } : options.converter?.fromAttribute !== undefined ? options.converter : defaultConverter;
|
|
364
|
+
this.__reflectingProperty = propName;
|
|
365
|
+
const convertedValue = converter.fromAttribute(value, options.type);
|
|
366
|
+
this[propName] = convertedValue ?? this.__defaultValues?.get(propName) ?? convertedValue;
|
|
367
|
+
this.__reflectingProperty = null;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
requestUpdate(name, oldValue, options, useNewValue = false, newValue) {
|
|
371
|
+
if (name !== undefined) {
|
|
372
|
+
if (DEV_MODE && name instanceof Event) {
|
|
373
|
+
issueWarning(``, `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`);
|
|
374
|
+
}
|
|
375
|
+
const ctor = this.constructor;
|
|
376
|
+
if (useNewValue === false) {
|
|
377
|
+
newValue = this[name];
|
|
378
|
+
}
|
|
379
|
+
options ??= ctor.getPropertyOptions(name);
|
|
380
|
+
const changed = (options.hasChanged ?? notEqual)(newValue, oldValue) || options.useDefault && options.reflect && newValue === this.__defaultValues?.get(name) && !this.hasAttribute(ctor.__attributeNameForProperty(name, options));
|
|
381
|
+
if (changed) {
|
|
382
|
+
this._$changeProperty(name, oldValue, options);
|
|
383
|
+
} else {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (this.isUpdatePending === false) {
|
|
388
|
+
this.__updatePromise = this.__enqueueUpdate();
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
_$changeProperty(name, oldValue, { useDefault, reflect, wrapped }, initializeValue) {
|
|
392
|
+
if (useDefault && !(this.__defaultValues ??= new Map).has(name)) {
|
|
393
|
+
this.__defaultValues.set(name, initializeValue ?? oldValue ?? this[name]);
|
|
394
|
+
if (wrapped !== true || initializeValue !== undefined) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (!this._$changedProperties.has(name)) {
|
|
399
|
+
if (!this.hasUpdated && !useDefault) {
|
|
400
|
+
oldValue = undefined;
|
|
401
|
+
}
|
|
402
|
+
this._$changedProperties.set(name, oldValue);
|
|
403
|
+
}
|
|
404
|
+
if (reflect === true && this.__reflectingProperty !== name) {
|
|
405
|
+
(this.__reflectingProperties ??= new Set).add(name);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
async __enqueueUpdate() {
|
|
409
|
+
this.isUpdatePending = true;
|
|
410
|
+
try {
|
|
411
|
+
await this.__updatePromise;
|
|
412
|
+
} catch (e) {
|
|
413
|
+
Promise.reject(e);
|
|
414
|
+
}
|
|
415
|
+
const result = this.scheduleUpdate();
|
|
416
|
+
if (result != null) {
|
|
417
|
+
await result;
|
|
418
|
+
}
|
|
419
|
+
return !this.isUpdatePending;
|
|
420
|
+
}
|
|
421
|
+
scheduleUpdate() {
|
|
422
|
+
const result = this.performUpdate();
|
|
423
|
+
if (DEV_MODE && this.constructor.enabledWarnings.includes("async-perform-update") && typeof result?.then === "function") {
|
|
424
|
+
issueWarning("async-perform-update", `Element ${this.localName} returned a Promise from performUpdate(). ` + `This behavior is deprecated and will be removed in a future ` + `version of ReactiveElement.`);
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
performUpdate() {
|
|
429
|
+
if (!this.isUpdatePending) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
debugLogEvent?.({ kind: "update" });
|
|
433
|
+
if (!this.hasUpdated) {
|
|
434
|
+
this.renderRoot ??= this.createRenderRoot();
|
|
435
|
+
if (DEV_MODE) {
|
|
436
|
+
const ctor = this.constructor;
|
|
437
|
+
const shadowedProperties = [...ctor.elementProperties.keys()].filter((p) => this.hasOwnProperty(p) && (p in getPrototypeOf(this)));
|
|
438
|
+
if (shadowedProperties.length) {
|
|
439
|
+
throw new Error(`The following properties on element ${this.localName} will not ` + `trigger updates as expected because they are set using class ` + `fields: ${shadowedProperties.join(", ")}. ` + `Native class fields and some compiled output will overwrite ` + `accessors used for detecting changes. See ` + `https://lit.dev/msg/class-field-shadowing ` + `for more information.`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (this.__instanceProperties) {
|
|
443
|
+
for (const [p, value] of this.__instanceProperties) {
|
|
444
|
+
this[p] = value;
|
|
445
|
+
}
|
|
446
|
+
this.__instanceProperties = undefined;
|
|
447
|
+
}
|
|
448
|
+
const elementProperties = this.constructor.elementProperties;
|
|
449
|
+
if (elementProperties.size > 0) {
|
|
450
|
+
for (const [p, options] of elementProperties) {
|
|
451
|
+
const { wrapped } = options;
|
|
452
|
+
const value = this[p];
|
|
453
|
+
if (wrapped === true && !this._$changedProperties.has(p) && value !== undefined) {
|
|
454
|
+
this._$changeProperty(p, undefined, options, value);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
let shouldUpdate = false;
|
|
460
|
+
const changedProperties = this._$changedProperties;
|
|
461
|
+
try {
|
|
462
|
+
shouldUpdate = this.shouldUpdate(changedProperties);
|
|
463
|
+
if (shouldUpdate) {
|
|
464
|
+
this.willUpdate(changedProperties);
|
|
465
|
+
this.__controllers?.forEach((c) => c.hostUpdate?.());
|
|
466
|
+
this.update(changedProperties);
|
|
467
|
+
} else {
|
|
468
|
+
this.__markUpdated();
|
|
469
|
+
}
|
|
470
|
+
} catch (e) {
|
|
471
|
+
shouldUpdate = false;
|
|
472
|
+
this.__markUpdated();
|
|
473
|
+
throw e;
|
|
474
|
+
}
|
|
475
|
+
if (shouldUpdate) {
|
|
476
|
+
this._$didUpdate(changedProperties);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
willUpdate(_changedProperties) {}
|
|
480
|
+
_$didUpdate(changedProperties) {
|
|
481
|
+
this.__controllers?.forEach((c) => c.hostUpdated?.());
|
|
482
|
+
if (!this.hasUpdated) {
|
|
483
|
+
this.hasUpdated = true;
|
|
484
|
+
this.firstUpdated(changedProperties);
|
|
485
|
+
}
|
|
486
|
+
this.updated(changedProperties);
|
|
487
|
+
if (DEV_MODE && this.isUpdatePending && this.constructor.enabledWarnings.includes("change-in-update")) {
|
|
488
|
+
issueWarning("change-in-update", `Element ${this.localName} scheduled an update ` + `(generally because a property was set) ` + `after an update completed, causing a new update to be scheduled. ` + `This is inefficient and should be avoided unless the next update ` + `can only be scheduled as a side effect of the previous update.`);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
__markUpdated() {
|
|
492
|
+
this._$changedProperties = new Map;
|
|
493
|
+
this.isUpdatePending = false;
|
|
494
|
+
}
|
|
495
|
+
get updateComplete() {
|
|
496
|
+
return this.getUpdateComplete();
|
|
497
|
+
}
|
|
498
|
+
getUpdateComplete() {
|
|
499
|
+
return this.__updatePromise;
|
|
500
|
+
}
|
|
501
|
+
shouldUpdate(_changedProperties) {
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
504
|
+
update(_changedProperties) {
|
|
505
|
+
this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) => this.__propertyToAttribute(p, this[p]));
|
|
506
|
+
this.__markUpdated();
|
|
507
|
+
}
|
|
508
|
+
updated(_changedProperties) {}
|
|
509
|
+
firstUpdated(_changedProperties) {}
|
|
510
|
+
}
|
|
511
|
+
ReactiveElement.elementStyles = [];
|
|
512
|
+
ReactiveElement.shadowRootOptions = { mode: "open" };
|
|
513
|
+
ReactiveElement[JSCompiler_renameProperty("elementProperties", ReactiveElement)] = new Map;
|
|
514
|
+
ReactiveElement[JSCompiler_renameProperty("finalized", ReactiveElement)] = new Map;
|
|
515
|
+
polyfillSupport?.({ ReactiveElement });
|
|
516
|
+
if (DEV_MODE) {
|
|
517
|
+
ReactiveElement.enabledWarnings = [
|
|
518
|
+
"change-in-update",
|
|
519
|
+
"async-perform-update"
|
|
520
|
+
];
|
|
521
|
+
const ensureOwnWarnings = function(ctor) {
|
|
522
|
+
if (!ctor.hasOwnProperty(JSCompiler_renameProperty("enabledWarnings", ctor))) {
|
|
523
|
+
ctor.enabledWarnings = ctor.enabledWarnings.slice();
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
ReactiveElement.enableWarning = function(warning) {
|
|
527
|
+
ensureOwnWarnings(this);
|
|
528
|
+
if (!this.enabledWarnings.includes(warning)) {
|
|
529
|
+
this.enabledWarnings.push(warning);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
ReactiveElement.disableWarning = function(warning) {
|
|
533
|
+
ensureOwnWarnings(this);
|
|
534
|
+
const i = this.enabledWarnings.indexOf(warning);
|
|
535
|
+
if (i >= 0) {
|
|
536
|
+
this.enabledWarnings.splice(i, 1);
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
(global2.reactiveElementVersions ??= []).push("2.1.2");
|
|
541
|
+
if (DEV_MODE && global2.reactiveElementVersions.length > 1) {
|
|
542
|
+
queueMicrotask(() => {
|
|
543
|
+
issueWarning("multiple-versions", `Multiple versions of Lit loaded. Loading multiple versions ` + `is not recommended.`);
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export { supportsAdoptingStyleSheets, CSSResult, unsafeCSS, css, adoptStyles, getCompatibleStyle, defaultConverter, notEqual, ReactiveElement };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_$LH
|
|
3
|
+
} from "./nano-core-5a3r312d.js";
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directive-helpers.js
|
|
6
|
+
var { _ChildPart: ChildPart } = _$LH;
|
|
7
|
+
var ENABLE_SHADYDOM_NOPATCH = true;
|
|
8
|
+
var wrap = ENABLE_SHADYDOM_NOPATCH && window.ShadyDOM?.inUse && window.ShadyDOM?.noPatch === true ? window.ShadyDOM.wrap : (node) => node;
|
|
9
|
+
var isSingleExpression = (part) => part.strings === undefined;
|
|
10
|
+
var createMarker = () => document.createComment("");
|
|
11
|
+
var insertPart = (containerPart, refPart, part) => {
|
|
12
|
+
const container = wrap(containerPart._$startNode).parentNode;
|
|
13
|
+
const refNode = refPart === undefined ? containerPart._$endNode : refPart._$startNode;
|
|
14
|
+
if (part === undefined) {
|
|
15
|
+
const startNode = wrap(container).insertBefore(createMarker(), refNode);
|
|
16
|
+
const endNode = wrap(container).insertBefore(createMarker(), refNode);
|
|
17
|
+
part = new ChildPart(startNode, endNode, containerPart, containerPart.options);
|
|
18
|
+
} else {
|
|
19
|
+
const endNode = wrap(part._$endNode).nextSibling;
|
|
20
|
+
const oldParent = part._$parent;
|
|
21
|
+
const parentChanged = oldParent !== containerPart;
|
|
22
|
+
if (parentChanged) {
|
|
23
|
+
part._$reparentDisconnectables?.(containerPart);
|
|
24
|
+
part._$parent = containerPart;
|
|
25
|
+
let newConnectionState;
|
|
26
|
+
if (part._$notifyConnectionChanged !== undefined && (newConnectionState = containerPart._$isConnected) !== oldParent._$isConnected) {
|
|
27
|
+
part._$notifyConnectionChanged(newConnectionState);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (endNode !== refNode || parentChanged) {
|
|
31
|
+
let start = part._$startNode;
|
|
32
|
+
while (start !== endNode) {
|
|
33
|
+
const n = wrap(start).nextSibling;
|
|
34
|
+
wrap(container).insertBefore(start, refNode);
|
|
35
|
+
start = n;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return part;
|
|
40
|
+
};
|
|
41
|
+
var setChildPartValue = (part, value, directiveParent = part) => {
|
|
42
|
+
part._$setValue(value, directiveParent);
|
|
43
|
+
return part;
|
|
44
|
+
};
|
|
45
|
+
var RESET_VALUE = {};
|
|
46
|
+
var setCommittedValue = (part, value = RESET_VALUE) => part._$committedValue = value;
|
|
47
|
+
var getCommittedValue = (part) => part._$committedValue;
|
|
48
|
+
var removePart = (part) => {
|
|
49
|
+
part._$clear();
|
|
50
|
+
part._$startNode.remove();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { isSingleExpression, insertPart, setChildPartValue, setCommittedValue, getCommittedValue, removePart };
|