@pritzlaff/nano-app 0.0.0-stage → 0.5.2

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.
Files changed (85) hide show
  1. package/AGENTS.md +66 -0
  2. package/LICENSE +21 -0
  3. package/README.md +6 -2
  4. package/app/app.css +160 -0
  5. package/app/bundle/nano-ui.js +2554 -0
  6. package/app/examples/auth/example.auth.js +6 -0
  7. package/app/examples/auth/nano.json +46 -0
  8. package/app/examples/chat/example.chat.js +6 -0
  9. package/app/examples/chat/example.messaging.js +3 -0
  10. package/app/examples/chat/nano.json +115 -0
  11. package/app/examples/drift/example.drift.js +3 -0
  12. package/app/examples/drift/nano.json +31 -0
  13. package/app/examples/kv/example.kv.js +3 -0
  14. package/app/examples/nano.json +356 -0
  15. package/app/examples/originkey/_nano/bundle/nano-ui.js +212 -0
  16. package/app/examples/originkey/_nano/sandbox/boot.js +1 -0
  17. package/app/examples/originkey/_nano/shared/chunks/nano-core-2gg2vg5g.js +2 -0
  18. package/app/examples/originkey/_nano/shared/chunks/nano-core-5h5dssvv.js +3 -0
  19. package/app/examples/originkey/_nano/shared/chunks/nano-core-72b5e6vd.js +17 -0
  20. package/app/examples/originkey/_nano/shared/chunks/nano-core-87v2yejk.js +2 -0
  21. package/app/examples/originkey/_nano/shared/chunks/nano-core-hm29e227.js +7 -0
  22. package/app/examples/originkey/_nano/shared/chunks/nano-core-jtgk4ch8.js +2 -0
  23. package/app/examples/originkey/_nano/shared/chunks/nano-core-mqaje7vc.js +2 -0
  24. package/app/examples/originkey/_nano/shared/chunks/nano-core-mxgap7rs.js +2 -0
  25. package/app/examples/originkey/_nano/shared/chunks/nano-core-qy0mwf7y.js +1 -0
  26. package/app/examples/originkey/_nano/shared/chunks/nano-core-wanb7xw1.js +1 -0
  27. package/app/examples/originkey/_nano/shared/lit-class-map.js +1 -0
  28. package/app/examples/originkey/_nano/shared/lit-decorators.js +1 -0
  29. package/app/examples/originkey/_nano/shared/lit-directive.js +1 -0
  30. package/app/examples/originkey/_nano/shared/lit-if-defined.js +1 -0
  31. package/app/examples/originkey/_nano/shared/lit-ref.js +1 -0
  32. package/app/examples/originkey/_nano/shared/lit-repeat.js +1 -0
  33. package/app/examples/originkey/_nano/shared/lit-style-map.js +1 -0
  34. package/app/examples/originkey/_nano/shared/lit.js +1 -0
  35. package/app/examples/originkey/_nano/shared/nano-core.js +1 -0
  36. package/app/examples/originkey/_nano/shared/nano-elements.js +280 -0
  37. package/app/examples/originkey/_nano/shared/typebox-value.js +1 -0
  38. package/app/examples/originkey/_nano/shared/typebox.js +1 -0
  39. package/app/examples/originkey/example.originkey.js +6 -0
  40. package/app/examples/originkey/frame.html +1 -0
  41. package/app/examples/originkey/nano.json +50 -0
  42. package/app/examples/raft/example.raft.js +30 -0
  43. package/app/examples/raft/nano.json +74 -0
  44. package/app/examples/slice/nano.json +63 -0
  45. package/app/examples/slice/shout.js +14 -0
  46. package/app/examples/template/acme.template.js +20 -0
  47. package/app/examples/template/index.js +241 -0
  48. package/app/examples/template/nano.json +35 -0
  49. package/app/examples/todo/example.todo.js +8 -0
  50. package/app/examples/todo/nano.json +77 -0
  51. package/app/examples/typing/nano.json +33 -0
  52. package/app/favicon.svg +1 -0
  53. package/app/index.html +152 -0
  54. package/app/main.js +15908 -0
  55. package/app/react/index.html +50 -0
  56. package/app/react/main.js +9 -0
  57. package/app/sandbox/boot.js +980 -0
  58. package/app/shared/chunks/nano-core-296y9rgd.js +4321 -0
  59. package/app/shared/chunks/nano-core-2zz7d74m.js +16 -0
  60. package/app/shared/chunks/nano-core-35ryhkm1.js +33 -0
  61. package/app/shared/chunks/nano-core-5a3r312d.js +866 -0
  62. package/app/shared/chunks/nano-core-89mtxedm.js +186 -0
  63. package/app/shared/chunks/nano-core-bf13r20v.js +77 -0
  64. package/app/shared/chunks/nano-core-g3414rnc.js +248 -0
  65. package/app/shared/chunks/nano-core-hyg0qdwg.js +547 -0
  66. package/app/shared/chunks/nano-core-sxgrxy03.js +53 -0
  67. package/app/shared/chunks/nano-core-wg5c961d.js +4564 -0
  68. package/app/shared/lit-class-map.js +60 -0
  69. package/app/shared/lit-decorators.js +228 -0
  70. package/app/shared/lit-directive.js +11 -0
  71. package/app/shared/lit-if-defined.js +10 -0
  72. package/app/shared/lit-ref.js +12 -0
  73. package/app/shared/lit-repeat.js +141 -0
  74. package/app/shared/lit-style-map.js +67 -0
  75. package/app/shared/lit.js +47 -0
  76. package/app/shared/nano-core.js +2516 -0
  77. package/app/shared/nano-elements.js +1178 -0
  78. package/app/shared/typebox-value.js +78 -0
  79. package/app/shared/typebox.js +580 -0
  80. package/app/shared/versions.json +6 -0
  81. package/bin/nano-app.ts +34 -0
  82. package/package.json +22 -4
  83. package/src/events.ts +11 -0
  84. package/src/serve.ts +68 -0
  85. package/src/watch.ts +27 -0
@@ -0,0 +1,60 @@
1
+ import {
2
+ noChange
3
+ } from "./chunks/nano-core-5a3r312d.js";
4
+ import {
5
+ Directive,
6
+ PartType,
7
+ directive
8
+ } from "./chunks/nano-core-35ryhkm1.js";
9
+ import"./chunks/nano-core-2zz7d74m.js";
10
+
11
+ // ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/class-map.js
12
+ class ClassMapDirective extends Directive {
13
+ constructor(partInfo) {
14
+ super(partInfo);
15
+ if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== "class" || partInfo.strings?.length > 2) {
16
+ throw new Error("`classMap()` can only be used in the `class` attribute " + "and must be the only part in the attribute.");
17
+ }
18
+ }
19
+ render(classInfo) {
20
+ return " " + Object.keys(classInfo).filter((key) => classInfo[key]).join(" ") + " ";
21
+ }
22
+ update(part, [classInfo]) {
23
+ if (this._previousClasses === undefined) {
24
+ this._previousClasses = new Set;
25
+ if (part.strings !== undefined) {
26
+ this._staticClasses = new Set(part.strings.join(" ").split(/\s/).filter((s) => s !== ""));
27
+ }
28
+ for (const name in classInfo) {
29
+ if (classInfo[name] && !this._staticClasses?.has(name)) {
30
+ this._previousClasses.add(name);
31
+ }
32
+ }
33
+ return this.render(classInfo);
34
+ }
35
+ const classList = part.element.classList;
36
+ for (const name of this._previousClasses) {
37
+ if (!(name in classInfo)) {
38
+ classList.remove(name);
39
+ this._previousClasses.delete(name);
40
+ }
41
+ }
42
+ for (const name in classInfo) {
43
+ const value = !!classInfo[name];
44
+ if (value !== this._previousClasses.has(name) && !this._staticClasses?.has(name)) {
45
+ if (value) {
46
+ classList.add(name);
47
+ this._previousClasses.add(name);
48
+ } else {
49
+ classList.remove(name);
50
+ this._previousClasses.delete(name);
51
+ }
52
+ }
53
+ }
54
+ return noChange;
55
+ }
56
+ }
57
+ var classMap = directive(ClassMapDirective);
58
+ export {
59
+ classMap
60
+ };
@@ -0,0 +1,228 @@
1
+ import {
2
+ defaultConverter,
3
+ notEqual
4
+ } from "./chunks/nano-core-hyg0qdwg.js";
5
+ import"./chunks/nano-core-2zz7d74m.js";
6
+
7
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/custom-element.js
8
+ var customElement = (tagName) => (classOrTarget, context) => {
9
+ if (context !== undefined) {
10
+ context.addInitializer(() => {
11
+ customElements.define(tagName, classOrTarget);
12
+ });
13
+ } else {
14
+ customElements.define(tagName, classOrTarget);
15
+ }
16
+ };
17
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/property.js
18
+ var DEV_MODE = true;
19
+ var issueWarning;
20
+ if (DEV_MODE) {
21
+ globalThis.litIssuedWarnings ??= new Set;
22
+ issueWarning = (code, warning) => {
23
+ warning += ` See https://lit.dev/msg/${code} for more information.`;
24
+ if (!globalThis.litIssuedWarnings.has(warning) && !globalThis.litIssuedWarnings.has(code)) {
25
+ console.warn(warning);
26
+ globalThis.litIssuedWarnings.add(warning);
27
+ }
28
+ };
29
+ }
30
+ var legacyProperty = (options, proto, name) => {
31
+ const hasOwnProperty = proto.hasOwnProperty(name);
32
+ proto.constructor.createProperty(name, options);
33
+ return hasOwnProperty ? Object.getOwnPropertyDescriptor(proto, name) : undefined;
34
+ };
35
+ var defaultPropertyDeclaration = {
36
+ attribute: true,
37
+ type: String,
38
+ converter: defaultConverter,
39
+ reflect: false,
40
+ hasChanged: notEqual
41
+ };
42
+ var standardProperty = (options = defaultPropertyDeclaration, target, context) => {
43
+ const { kind, metadata } = context;
44
+ if (DEV_MODE && metadata == null) {
45
+ issueWarning("missing-class-metadata", `The class ${target} is missing decorator metadata. This ` + `could mean that you're using a compiler that supports decorators ` + `but doesn't support decorator metadata, such as TypeScript 5.1. ` + `Please update your compiler.`);
46
+ }
47
+ let properties = globalThis.litPropertyMetadata.get(metadata);
48
+ if (properties === undefined) {
49
+ globalThis.litPropertyMetadata.set(metadata, properties = new Map);
50
+ }
51
+ if (kind === "setter") {
52
+ options = Object.create(options);
53
+ options.wrapped = true;
54
+ }
55
+ properties.set(context.name, options);
56
+ if (kind === "accessor") {
57
+ const { name } = context;
58
+ return {
59
+ set(v) {
60
+ const oldValue = target.get.call(this);
61
+ target.set.call(this, v);
62
+ this.requestUpdate(name, oldValue, options, true, v);
63
+ },
64
+ init(v) {
65
+ if (v !== undefined) {
66
+ this._$changeProperty(name, undefined, options, v);
67
+ }
68
+ return v;
69
+ }
70
+ };
71
+ } else if (kind === "setter") {
72
+ const { name } = context;
73
+ return function(value) {
74
+ const oldValue = this[name];
75
+ target.call(this, value);
76
+ this.requestUpdate(name, oldValue, options, true, value);
77
+ };
78
+ }
79
+ throw new Error(`Unsupported decorator location: ${kind}`);
80
+ };
81
+ function property(options) {
82
+ return (protoOrTarget, nameOrContext) => {
83
+ return typeof nameOrContext === "object" ? standardProperty(options, protoOrTarget, nameOrContext) : legacyProperty(options, protoOrTarget, nameOrContext);
84
+ };
85
+ }
86
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/state.js
87
+ function state(options) {
88
+ return property({
89
+ ...options,
90
+ state: true,
91
+ attribute: false
92
+ });
93
+ }
94
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/event-options.js
95
+ function eventOptions(options) {
96
+ return (protoOrValue, nameOrContext) => {
97
+ const method = typeof protoOrValue === "function" ? protoOrValue : protoOrValue[nameOrContext];
98
+ Object.assign(method, options);
99
+ };
100
+ }
101
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/base.js
102
+ var desc = (obj, name, descriptor) => {
103
+ descriptor.configurable = true;
104
+ descriptor.enumerable = true;
105
+ if (Reflect.decorate && typeof name !== "object") {
106
+ Object.defineProperty(obj, name, descriptor);
107
+ }
108
+ return descriptor;
109
+ };
110
+
111
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/query.js
112
+ var DEV_MODE2 = true;
113
+ var issueWarning2;
114
+ if (DEV_MODE2) {
115
+ globalThis.litIssuedWarnings ??= new Set;
116
+ issueWarning2 = (code, warning) => {
117
+ warning += code ? ` See https://lit.dev/msg/${code} for more information.` : "";
118
+ if (!globalThis.litIssuedWarnings.has(warning) && !globalThis.litIssuedWarnings.has(code)) {
119
+ console.warn(warning);
120
+ globalThis.litIssuedWarnings.add(warning);
121
+ }
122
+ };
123
+ }
124
+ function query(selector, cache) {
125
+ return (protoOrTarget, nameOrContext, descriptor) => {
126
+ const doQuery = (el) => {
127
+ const result = el.renderRoot?.querySelector(selector) ?? null;
128
+ if (DEV_MODE2 && result === null && cache && !el.hasUpdated) {
129
+ const name = typeof nameOrContext === "object" ? nameOrContext.name : nameOrContext;
130
+ issueWarning2("", `@query'd field ${JSON.stringify(String(name))} with the 'cache' ` + `flag set for selector '${selector}' has been accessed before ` + `the first update and returned null. This is expected if the ` + `renderRoot tree has not been provided beforehand (e.g. via ` + `Declarative Shadow DOM). Therefore the value hasn't been cached.`);
131
+ }
132
+ return result;
133
+ };
134
+ if (cache) {
135
+ const { get, set } = typeof nameOrContext === "object" ? protoOrTarget : descriptor ?? (() => {
136
+ const key = DEV_MODE2 ? Symbol(`${String(nameOrContext)} (@query() cache)`) : Symbol();
137
+ return {
138
+ get() {
139
+ return this[key];
140
+ },
141
+ set(v) {
142
+ this[key] = v;
143
+ }
144
+ };
145
+ })();
146
+ return desc(protoOrTarget, nameOrContext, {
147
+ get() {
148
+ let result = get.call(this);
149
+ if (result === undefined) {
150
+ result = doQuery(this);
151
+ if (result !== null || this.hasUpdated) {
152
+ set.call(this, result);
153
+ }
154
+ }
155
+ return result;
156
+ }
157
+ });
158
+ } else {
159
+ return desc(protoOrTarget, nameOrContext, {
160
+ get() {
161
+ return doQuery(this);
162
+ }
163
+ });
164
+ }
165
+ };
166
+ }
167
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/query-all.js
168
+ var fragment;
169
+ function queryAll(selector) {
170
+ return (obj, name) => {
171
+ return desc(obj, name, {
172
+ get() {
173
+ const container = this.renderRoot ?? (fragment ??= document.createDocumentFragment());
174
+ return container.querySelectorAll(selector);
175
+ }
176
+ });
177
+ };
178
+ }
179
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/query-async.js
180
+ function queryAsync(selector) {
181
+ return (obj, name) => {
182
+ return desc(obj, name, {
183
+ async get() {
184
+ await this.updateComplete;
185
+ return this.renderRoot?.querySelector(selector) ?? null;
186
+ }
187
+ });
188
+ };
189
+ }
190
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/query-assigned-elements.js
191
+ function queryAssignedElements(options) {
192
+ return (obj, name) => {
193
+ const { slot, selector } = options ?? {};
194
+ const slotSelector = `slot${slot ? `[name=${slot}]` : ":not([name])"}`;
195
+ return desc(obj, name, {
196
+ get() {
197
+ const slotEl = this.renderRoot?.querySelector(slotSelector);
198
+ const elements = slotEl?.assignedElements(options) ?? [];
199
+ return selector === undefined ? elements : elements.filter((node) => node.matches(selector));
200
+ }
201
+ });
202
+ };
203
+ }
204
+ // ../../node_modules/.bun/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/development/decorators/query-assigned-nodes.js
205
+ function queryAssignedNodes(options) {
206
+ return (obj, name) => {
207
+ const { slot } = options ?? {};
208
+ const slotSelector = `slot${slot ? `[name=${slot}]` : ":not([name])"}`;
209
+ return desc(obj, name, {
210
+ get() {
211
+ const slotEl = this.renderRoot?.querySelector(slotSelector);
212
+ return slotEl?.assignedNodes(options) ?? [];
213
+ }
214
+ });
215
+ };
216
+ }
217
+ export {
218
+ state,
219
+ standardProperty,
220
+ queryAsync,
221
+ queryAssignedNodes,
222
+ queryAssignedElements,
223
+ queryAll,
224
+ query,
225
+ property,
226
+ eventOptions,
227
+ customElement
228
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ Directive,
3
+ PartType,
4
+ directive
5
+ } from "./chunks/nano-core-35ryhkm1.js";
6
+ import"./chunks/nano-core-2zz7d74m.js";
7
+ export {
8
+ directive,
9
+ PartType,
10
+ Directive
11
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ nothing
3
+ } from "./chunks/nano-core-5a3r312d.js";
4
+ import"./chunks/nano-core-2zz7d74m.js";
5
+
6
+ // ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/if-defined.js
7
+ var ifDefined = (value) => value ?? nothing;
8
+ export {
9
+ ifDefined
10
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ createRef,
3
+ ref
4
+ } from "./chunks/nano-core-89mtxedm.js";
5
+ import"./chunks/nano-core-sxgrxy03.js";
6
+ import"./chunks/nano-core-5a3r312d.js";
7
+ import"./chunks/nano-core-35ryhkm1.js";
8
+ import"./chunks/nano-core-2zz7d74m.js";
9
+ export {
10
+ ref,
11
+ createRef
12
+ };
@@ -0,0 +1,141 @@
1
+ import {
2
+ getCommittedValue,
3
+ insertPart,
4
+ removePart,
5
+ setChildPartValue,
6
+ setCommittedValue
7
+ } from "./chunks/nano-core-sxgrxy03.js";
8
+ import {
9
+ noChange
10
+ } from "./chunks/nano-core-5a3r312d.js";
11
+ import {
12
+ Directive,
13
+ PartType,
14
+ directive
15
+ } from "./chunks/nano-core-35ryhkm1.js";
16
+ import"./chunks/nano-core-2zz7d74m.js";
17
+
18
+ // ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/repeat.js
19
+ var generateMap = (list, start, end) => {
20
+ const map = new Map;
21
+ for (let i = start;i <= end; i++) {
22
+ map.set(list[i], i);
23
+ }
24
+ return map;
25
+ };
26
+
27
+ class RepeatDirective extends Directive {
28
+ constructor(partInfo) {
29
+ super(partInfo);
30
+ if (partInfo.type !== PartType.CHILD) {
31
+ throw new Error("repeat() can only be used in text expressions");
32
+ }
33
+ }
34
+ _getValuesAndKeys(items, keyFnOrTemplate, template) {
35
+ let keyFn;
36
+ if (template === undefined) {
37
+ template = keyFnOrTemplate;
38
+ } else if (keyFnOrTemplate !== undefined) {
39
+ keyFn = keyFnOrTemplate;
40
+ }
41
+ const keys = [];
42
+ const values = [];
43
+ let index = 0;
44
+ for (const item of items) {
45
+ keys[index] = keyFn ? keyFn(item, index) : index;
46
+ values[index] = template(item, index);
47
+ index++;
48
+ }
49
+ return {
50
+ values,
51
+ keys
52
+ };
53
+ }
54
+ render(items, keyFnOrTemplate, template) {
55
+ return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;
56
+ }
57
+ update(containerPart, [items, keyFnOrTemplate, template]) {
58
+ const oldParts = getCommittedValue(containerPart);
59
+ const { values: newValues, keys: newKeys } = this._getValuesAndKeys(items, keyFnOrTemplate, template);
60
+ if (!Array.isArray(oldParts)) {
61
+ this._itemKeys = newKeys;
62
+ return newValues;
63
+ }
64
+ const oldKeys = this._itemKeys ??= [];
65
+ const newParts = [];
66
+ let newKeyToIndexMap;
67
+ let oldKeyToIndexMap;
68
+ let oldHead = 0;
69
+ let oldTail = oldParts.length - 1;
70
+ let newHead = 0;
71
+ let newTail = newValues.length - 1;
72
+ while (oldHead <= oldTail && newHead <= newTail) {
73
+ if (oldParts[oldHead] === null) {
74
+ oldHead++;
75
+ } else if (oldParts[oldTail] === null) {
76
+ oldTail--;
77
+ } else if (oldKeys[oldHead] === newKeys[newHead]) {
78
+ newParts[newHead] = setChildPartValue(oldParts[oldHead], newValues[newHead]);
79
+ oldHead++;
80
+ newHead++;
81
+ } else if (oldKeys[oldTail] === newKeys[newTail]) {
82
+ newParts[newTail] = setChildPartValue(oldParts[oldTail], newValues[newTail]);
83
+ oldTail--;
84
+ newTail--;
85
+ } else if (oldKeys[oldHead] === newKeys[newTail]) {
86
+ newParts[newTail] = setChildPartValue(oldParts[oldHead], newValues[newTail]);
87
+ insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]);
88
+ oldHead++;
89
+ newTail--;
90
+ } else if (oldKeys[oldTail] === newKeys[newHead]) {
91
+ newParts[newHead] = setChildPartValue(oldParts[oldTail], newValues[newHead]);
92
+ insertPart(containerPart, oldParts[oldHead], oldParts[oldTail]);
93
+ oldTail--;
94
+ newHead++;
95
+ } else {
96
+ if (newKeyToIndexMap === undefined) {
97
+ newKeyToIndexMap = generateMap(newKeys, newHead, newTail);
98
+ oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);
99
+ }
100
+ if (!newKeyToIndexMap.has(oldKeys[oldHead])) {
101
+ removePart(oldParts[oldHead]);
102
+ oldHead++;
103
+ } else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {
104
+ removePart(oldParts[oldTail]);
105
+ oldTail--;
106
+ } else {
107
+ const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);
108
+ const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;
109
+ if (oldPart === null) {
110
+ const newPart = insertPart(containerPart, oldParts[oldHead]);
111
+ setChildPartValue(newPart, newValues[newHead]);
112
+ newParts[newHead] = newPart;
113
+ } else {
114
+ newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);
115
+ insertPart(containerPart, oldParts[oldHead], oldPart);
116
+ oldParts[oldIndex] = null;
117
+ }
118
+ newHead++;
119
+ }
120
+ }
121
+ }
122
+ while (newHead <= newTail) {
123
+ const newPart = insertPart(containerPart, newParts[newTail + 1]);
124
+ setChildPartValue(newPart, newValues[newHead]);
125
+ newParts[newHead++] = newPart;
126
+ }
127
+ while (oldHead <= oldTail) {
128
+ const oldPart = oldParts[oldHead++];
129
+ if (oldPart !== null) {
130
+ removePart(oldPart);
131
+ }
132
+ }
133
+ this._itemKeys = newKeys;
134
+ setCommittedValue(containerPart, newParts);
135
+ return noChange;
136
+ }
137
+ }
138
+ var repeat = directive(RepeatDirective);
139
+ export {
140
+ repeat
141
+ };
@@ -0,0 +1,67 @@
1
+ import {
2
+ noChange
3
+ } from "./chunks/nano-core-5a3r312d.js";
4
+ import {
5
+ Directive,
6
+ PartType,
7
+ directive
8
+ } from "./chunks/nano-core-35ryhkm1.js";
9
+ import"./chunks/nano-core-2zz7d74m.js";
10
+
11
+ // ../../node_modules/.bun/lit-html@3.3.3/node_modules/lit-html/development/directives/style-map.js
12
+ var important = "important";
13
+ var importantFlag = " !" + important;
14
+ var flagTrim = 0 - importantFlag.length;
15
+
16
+ class StyleMapDirective extends Directive {
17
+ constructor(partInfo) {
18
+ super(partInfo);
19
+ if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) {
20
+ throw new Error("The `styleMap` directive must be used in the `style` attribute " + "and must be the only part in the attribute.");
21
+ }
22
+ }
23
+ render(styleInfo) {
24
+ return Object.keys(styleInfo).reduce((style, prop) => {
25
+ const value = styleInfo[prop];
26
+ if (value == null) {
27
+ return style;
28
+ }
29
+ prop = prop.includes("-") ? prop : prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase();
30
+ return style + `${prop}:${value};`;
31
+ }, "");
32
+ }
33
+ update(part, [styleInfo]) {
34
+ const { style } = part.element;
35
+ if (this._previousStyleProperties === undefined) {
36
+ this._previousStyleProperties = new Set(Object.keys(styleInfo));
37
+ return this.render(styleInfo);
38
+ }
39
+ for (const name of this._previousStyleProperties) {
40
+ if (styleInfo[name] == null) {
41
+ this._previousStyleProperties.delete(name);
42
+ if (name.includes("-")) {
43
+ style.removeProperty(name);
44
+ } else {
45
+ style[name] = null;
46
+ }
47
+ }
48
+ }
49
+ for (const name in styleInfo) {
50
+ const value = styleInfo[name];
51
+ if (value != null) {
52
+ this._previousStyleProperties.add(name);
53
+ const isImportant = typeof value === "string" && value.endsWith(importantFlag);
54
+ if (name.includes("-") || isImportant) {
55
+ style.setProperty(name, isImportant ? value.slice(0, flagTrim) : value, isImportant ? important : "");
56
+ } else {
57
+ style[name] = value;
58
+ }
59
+ }
60
+ }
61
+ return noChange;
62
+ }
63
+ }
64
+ var styleMap = directive(StyleMapDirective);
65
+ export {
66
+ styleMap
67
+ };
@@ -0,0 +1,47 @@
1
+ import {
2
+ LitElement,
3
+ _$LE,
4
+ isServer
5
+ } from "./chunks/nano-core-bf13r20v.js";
6
+ import {
7
+ CSSResult,
8
+ ReactiveElement,
9
+ adoptStyles,
10
+ css,
11
+ defaultConverter,
12
+ getCompatibleStyle,
13
+ notEqual,
14
+ supportsAdoptingStyleSheets,
15
+ unsafeCSS
16
+ } from "./chunks/nano-core-hyg0qdwg.js";
17
+ import {
18
+ _$LH,
19
+ html,
20
+ mathml,
21
+ noChange,
22
+ nothing,
23
+ render,
24
+ svg
25
+ } from "./chunks/nano-core-5a3r312d.js";
26
+ import"./chunks/nano-core-2zz7d74m.js";
27
+ export {
28
+ unsafeCSS,
29
+ svg,
30
+ supportsAdoptingStyleSheets,
31
+ render,
32
+ nothing,
33
+ notEqual,
34
+ noChange,
35
+ mathml,
36
+ isServer,
37
+ html,
38
+ getCompatibleStyle,
39
+ defaultConverter,
40
+ css,
41
+ adoptStyles,
42
+ _$LH,
43
+ _$LE,
44
+ ReactiveElement,
45
+ LitElement,
46
+ CSSResult
47
+ };