@runic-artifex/angular 0.19.0 → 0.20.0
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 +130 -23
- package/dist/fesm2022/runic-artifex-angular-experimental.mjs +285 -0
- package/dist/fesm2022/runic-artifex-angular-experimental.mjs.map +1 -0
- package/dist/fesm2022/runic-artifex-angular-forms.mjs +246 -0
- package/dist/fesm2022/runic-artifex-angular-forms.mjs.map +1 -0
- package/dist/fesm2022/runic-artifex-angular.mjs +975 -0
- package/dist/fesm2022/runic-artifex-angular.mjs.map +1 -0
- package/dist/types/runic-artifex-angular-experimental.d.ts +85 -0
- package/dist/types/runic-artifex-angular-forms.d.ts +72 -0
- package/dist/types/runic-artifex-angular.d.ts +626 -0
- package/package.json +20 -17
- package/dist/esm/experimental.d.ts +0 -39
- package/dist/esm/experimental.js +0 -64
- package/dist/esm/forms/index.d.ts +0 -2
- package/dist/esm/forms/index.js +0 -2
- package/dist/esm/forms/runic-field.directive.d.ts +0 -48
- package/dist/esm/forms/runic-field.directive.js +0 -195
- package/dist/esm/forms/signal-forms.d.ts +0 -19
- package/dist/esm/forms/signal-forms.js +0 -29
- package/dist/esm/index.d.ts +0 -24
- package/dist/esm/index.js +0 -25
- package/dist/esm/inject-appearance.d.ts +0 -19
- package/dist/esm/inject-appearance.js +0 -28
- package/dist/esm/inject-bridge-connection.d.ts +0 -22
- package/dist/esm/inject-bridge-connection.js +0 -26
- package/dist/esm/inject-collection-viewport.d.ts +0 -13
- package/dist/esm/inject-collection-viewport.js +0 -31
- package/dist/esm/inject-command.d.ts +0 -35
- package/dist/esm/inject-command.js +0 -33
- package/dist/esm/inject-field.d.ts +0 -66
- package/dist/esm/inject-field.js +0 -58
- package/dist/esm/inject-form.d.ts +0 -40
- package/dist/esm/inject-form.js +0 -48
- package/dist/esm/inject-latest-operation.d.ts +0 -25
- package/dist/esm/inject-latest-operation.js +0 -35
- package/dist/esm/inject-menu-bar.d.ts +0 -32
- package/dist/esm/inject-menu-bar.js +0 -39
- package/dist/esm/inject-operation.d.ts +0 -23
- package/dist/esm/inject-operation.js +0 -33
- package/dist/esm/inject-query-collection.d.ts +0 -29
- package/dist/esm/inject-query-collection.js +0 -64
- package/dist/esm/inject-text-field.d.ts +0 -55
- package/dist/esm/inject-text-field.js +0 -51
- package/dist/esm/inject-text.d.ts +0 -57
- package/dist/esm/inject-text.js +0 -107
- package/dist/esm/inject-view-resource.d.ts +0 -39
- package/dist/esm/inject-view-resource.js +0 -98
- package/dist/esm/inject-view.d.ts +0 -41
- package/dist/esm/inject-view.js +0 -67
- package/dist/esm/instance.d.ts +0 -34
- package/dist/esm/instance.js +0 -48
- package/dist/esm/view-outlet.d.ts +0 -101
- package/dist/esm/view-outlet.js +0 -177
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef, Component, DestroyRef, Directive, ElementRef, InjectionToken, Injector, NgZone, PLATFORM_ID, Pipe, Renderer2, ViewContainerRef, assertInInjectionContext, computed, effect, inject, input, isDevMode, isSignal, resource, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { BridgeError, appearance, appearance as appearance$1, commitAllFields, configureFieldErrorText, configureTranslatedText, createCollectionViewportController, createCommandController, createFieldController, createLatestOperationController, createMenuBarController, createOperationController, createQueryViewportController, createRunicInstance, createTextFieldController, createViewController, defaultInstance, fieldErrorText, formFieldList, formStateOf, installBackNavigation, installNavigationPath, navigateBack, onAppearance, onAppearance as onAppearance$1, onBridgeConnection, onBridgeConnection as onBridgeConnection$1, onNavigationPath, onWindowLocale, openNavigationPath, pageInstance, regionEntries, regionEntries as regionEntries$1, resolveText, resolveText as resolveText$1, selectedRegion, submitFields, subscribeText, syncDocumentLocale, textDirection, textLocale, textVersion, unknownAppearance, upload, windowLocale, windowLocale as windowLocale$1 } from "@runic-artifex/views";
|
|
4
|
+
import { isViewClient, missingViewMessage, reportMissingView, translationsTextRevision, viewSourceIdentity, viewSourcePreview } from "@runic-artifex/views/bindings";
|
|
5
|
+
const RUNIC_INSTANCE = new InjectionToken("RUNIC_INSTANCE", {
|
|
6
|
+
providedIn: "root",
|
|
7
|
+
factory: () => defaultInstance()
|
|
8
|
+
});
|
|
9
|
+
function provideRunicInstance(instance) {
|
|
10
|
+
return {
|
|
11
|
+
provide: RUNIC_INSTANCE,
|
|
12
|
+
useValue: instance
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function injectRunicInstance({ injector } = {}) {
|
|
16
|
+
if (injector) return instanceOf(injector);
|
|
17
|
+
assertInInjectionContext(injectRunicInstance);
|
|
18
|
+
return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance();
|
|
19
|
+
}
|
|
20
|
+
function instanceOf(injector) {
|
|
21
|
+
return injector.get(RUNIC_INSTANCE, null) ?? defaultInstance();
|
|
22
|
+
}
|
|
23
|
+
function contextInstance() {
|
|
24
|
+
try {
|
|
25
|
+
return inject(RUNIC_INSTANCE, { optional: true }) ?? defaultInstance();
|
|
26
|
+
} catch {
|
|
27
|
+
return defaultInstance();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var ViewOutlet = class ViewOutlet {
|
|
31
|
+
content = input(...ngDevMode ? [void 0, { debugName: "content" }] : /* istanbul ignore next */ []);
|
|
32
|
+
registry = input.required(...ngDevMode ? [{ debugName: "registry" }] : /* istanbul ignore next */ []);
|
|
33
|
+
missing = input(...ngDevMode ? [void 0, { debugName: "missing" }] : /* istanbul ignore next */ []);
|
|
34
|
+
error = signal(void 0, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
35
|
+
mount = viewChild.required("mount", {
|
|
36
|
+
...ngDevMode ? { debugName: "mount" } : /* istanbul ignore next */ {},
|
|
37
|
+
read: ViewContainerRef
|
|
38
|
+
});
|
|
39
|
+
selected = computed(() => {
|
|
40
|
+
const reference = this.content();
|
|
41
|
+
if (!reference) return void 0;
|
|
42
|
+
const component = this.registry()[reference.kind];
|
|
43
|
+
return {
|
|
44
|
+
reference,
|
|
45
|
+
component,
|
|
46
|
+
missing: component ? void 0 : this.missing()
|
|
47
|
+
};
|
|
48
|
+
}, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
49
|
+
constructor() {
|
|
50
|
+
const instance = injectRunicInstance();
|
|
51
|
+
effect(() => {
|
|
52
|
+
const container = this.mount();
|
|
53
|
+
const selection = this.selected();
|
|
54
|
+
untracked(() => {
|
|
55
|
+
container.clear();
|
|
56
|
+
this.error.set(void 0);
|
|
57
|
+
if (!selection) return;
|
|
58
|
+
if (!selection.component) {
|
|
59
|
+
if (selection.missing) {
|
|
60
|
+
container.createEmbeddedView(selection.missing, {
|
|
61
|
+
$implicit: selection.reference,
|
|
62
|
+
content: selection.reference
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (isDevMode()) this.error.set(missingViewMessage(selection.reference.kind));
|
|
67
|
+
else instance.run(() => reportMissingView(selection.reference.kind));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
container.createComponent(selection.component).setInput("page", selection.reference);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
75
|
+
minVersion: "12.0.0",
|
|
76
|
+
version: "22.2.3",
|
|
77
|
+
ngImport: i0,
|
|
78
|
+
type: ViewOutlet,
|
|
79
|
+
deps: [],
|
|
80
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
81
|
+
});
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
83
|
+
minVersion: "17.0.0",
|
|
84
|
+
version: "22.2.3",
|
|
85
|
+
type: ViewOutlet,
|
|
86
|
+
isStandalone: true,
|
|
87
|
+
selector: "runic-view-outlet",
|
|
88
|
+
inputs: {
|
|
89
|
+
content: {
|
|
90
|
+
classPropertyName: "content",
|
|
91
|
+
publicName: "content",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: false,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
},
|
|
96
|
+
registry: {
|
|
97
|
+
classPropertyName: "registry",
|
|
98
|
+
publicName: "registry",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: true,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
},
|
|
103
|
+
missing: {
|
|
104
|
+
classPropertyName: "missing",
|
|
105
|
+
publicName: "missing",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
viewQueries: [{
|
|
112
|
+
propertyName: "mount",
|
|
113
|
+
first: true,
|
|
114
|
+
predicate: ["mount"],
|
|
115
|
+
descendants: true,
|
|
116
|
+
read: ViewContainerRef,
|
|
117
|
+
isSignal: true
|
|
118
|
+
}],
|
|
119
|
+
ngImport: i0,
|
|
120
|
+
template: `
|
|
121
|
+
<ng-container #mount />
|
|
122
|
+
@if (!content()) { <ng-content /> }
|
|
123
|
+
@if (error(); as issue) { <p role="alert">{{ issue }}</p> }
|
|
124
|
+
`,
|
|
125
|
+
isInline: true
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
129
|
+
minVersion: "12.0.0",
|
|
130
|
+
version: "22.2.3",
|
|
131
|
+
ngImport: i0,
|
|
132
|
+
type: ViewOutlet,
|
|
133
|
+
decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{
|
|
136
|
+
selector: "runic-view-outlet",
|
|
137
|
+
standalone: true,
|
|
138
|
+
template: `
|
|
139
|
+
<ng-container #mount />
|
|
140
|
+
@if (!content()) { <ng-content /> }
|
|
141
|
+
@if (error(); as issue) { <p role="alert">{{ issue }}</p> }
|
|
142
|
+
`
|
|
143
|
+
}]
|
|
144
|
+
}],
|
|
145
|
+
ctorParameters: () => [],
|
|
146
|
+
propDecorators: {
|
|
147
|
+
content: [{
|
|
148
|
+
type: i0.Input,
|
|
149
|
+
args: [{
|
|
150
|
+
isSignal: true,
|
|
151
|
+
alias: "content",
|
|
152
|
+
required: false
|
|
153
|
+
}]
|
|
154
|
+
}],
|
|
155
|
+
registry: [{
|
|
156
|
+
type: i0.Input,
|
|
157
|
+
args: [{
|
|
158
|
+
isSignal: true,
|
|
159
|
+
alias: "registry",
|
|
160
|
+
required: true
|
|
161
|
+
}]
|
|
162
|
+
}],
|
|
163
|
+
missing: [{
|
|
164
|
+
type: i0.Input,
|
|
165
|
+
args: [{
|
|
166
|
+
isSignal: true,
|
|
167
|
+
alias: "missing",
|
|
168
|
+
required: false
|
|
169
|
+
}]
|
|
170
|
+
}],
|
|
171
|
+
mount: [{
|
|
172
|
+
type: i0.ViewChild,
|
|
173
|
+
args: ["mount", {
|
|
174
|
+
read: ViewContainerRef,
|
|
175
|
+
isSignal: true
|
|
176
|
+
}]
|
|
177
|
+
}]
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
const outletAttributes = /* @__PURE__ */ new Set([
|
|
181
|
+
"hidden",
|
|
182
|
+
"style",
|
|
183
|
+
"data-region-key"
|
|
184
|
+
]);
|
|
185
|
+
var RegionPanel = class RegionPanel {
|
|
186
|
+
attributes = input(void 0, {
|
|
187
|
+
...ngDevMode ? { debugName: "attributes" } : /* istanbul ignore next */ {},
|
|
188
|
+
alias: "runicRegionPanel"
|
|
189
|
+
});
|
|
190
|
+
constructor() {
|
|
191
|
+
const element = inject(ElementRef).nativeElement;
|
|
192
|
+
const renderer = inject(Renderer2);
|
|
193
|
+
let applied = /* @__PURE__ */ new Set();
|
|
194
|
+
effect(() => {
|
|
195
|
+
const set = /* @__PURE__ */ new Set();
|
|
196
|
+
for (const [name, value] of Object.entries(this.attributes() ?? {})) {
|
|
197
|
+
if (value === null || value === void 0 || outletAttributes.has(name.toLowerCase())) continue;
|
|
198
|
+
renderer.setAttribute(element, name, value);
|
|
199
|
+
set.add(name);
|
|
200
|
+
}
|
|
201
|
+
for (const name of applied) if (!set.has(name)) renderer.removeAttribute(element, name);
|
|
202
|
+
applied = set;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
206
|
+
minVersion: "12.0.0",
|
|
207
|
+
version: "22.2.3",
|
|
208
|
+
ngImport: i0,
|
|
209
|
+
type: RegionPanel,
|
|
210
|
+
deps: [],
|
|
211
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
212
|
+
});
|
|
213
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
214
|
+
minVersion: "17.1.0",
|
|
215
|
+
version: "22.2.3",
|
|
216
|
+
type: RegionPanel,
|
|
217
|
+
isStandalone: true,
|
|
218
|
+
selector: "[runicRegionPanel]",
|
|
219
|
+
inputs: { attributes: {
|
|
220
|
+
classPropertyName: "attributes",
|
|
221
|
+
publicName: "runicRegionPanel",
|
|
222
|
+
isSignal: true,
|
|
223
|
+
isRequired: false,
|
|
224
|
+
transformFunction: null
|
|
225
|
+
} },
|
|
226
|
+
ngImport: i0
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "22.2.3",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: RegionPanel,
|
|
234
|
+
decorators: [{
|
|
235
|
+
type: Directive,
|
|
236
|
+
args: [{
|
|
237
|
+
selector: "[runicRegionPanel]",
|
|
238
|
+
standalone: true
|
|
239
|
+
}]
|
|
240
|
+
}],
|
|
241
|
+
ctorParameters: () => [],
|
|
242
|
+
propDecorators: { attributes: [{
|
|
243
|
+
type: i0.Input,
|
|
244
|
+
args: [{
|
|
245
|
+
isSignal: true,
|
|
246
|
+
alias: "runicRegionPanel",
|
|
247
|
+
required: false
|
|
248
|
+
}]
|
|
249
|
+
}] }
|
|
250
|
+
});
|
|
251
|
+
var RegionOutlets = class RegionOutlets {
|
|
252
|
+
collection = input(...ngDevMode ? [void 0, { debugName: "collection" }] : /* istanbul ignore next */ []);
|
|
253
|
+
registry = input.required(...ngDevMode ? [{ debugName: "registry" }] : /* istanbul ignore next */ []);
|
|
254
|
+
missing = input(...ngDevMode ? [void 0, { debugName: "missing" }] : /* istanbul ignore next */ []);
|
|
255
|
+
mode = input("keep-mounted", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
|
|
256
|
+
panelProps = input(...ngDevMode ? [void 0, { debugName: "panelProps" }] : /* istanbul ignore next */ []);
|
|
257
|
+
shown = computed(() => {
|
|
258
|
+
const keepMounted = this.mode() === "keep-mounted";
|
|
259
|
+
const panelProps = this.panelProps();
|
|
260
|
+
return regionEntries$1(this.collection()).filter((region) => keepMounted || region.selected).map((region) => ({
|
|
261
|
+
region,
|
|
262
|
+
attributes: panelProps?.(region)
|
|
263
|
+
}));
|
|
264
|
+
}, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
265
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
266
|
+
minVersion: "12.0.0",
|
|
267
|
+
version: "22.2.3",
|
|
268
|
+
ngImport: i0,
|
|
269
|
+
type: RegionOutlets,
|
|
270
|
+
deps: [],
|
|
271
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
272
|
+
});
|
|
273
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
274
|
+
minVersion: "17.0.0",
|
|
275
|
+
version: "22.2.3",
|
|
276
|
+
type: RegionOutlets,
|
|
277
|
+
isStandalone: true,
|
|
278
|
+
selector: "runic-region-outlets",
|
|
279
|
+
inputs: {
|
|
280
|
+
collection: {
|
|
281
|
+
classPropertyName: "collection",
|
|
282
|
+
publicName: "collection",
|
|
283
|
+
isSignal: true,
|
|
284
|
+
isRequired: false,
|
|
285
|
+
transformFunction: null
|
|
286
|
+
},
|
|
287
|
+
registry: {
|
|
288
|
+
classPropertyName: "registry",
|
|
289
|
+
publicName: "registry",
|
|
290
|
+
isSignal: true,
|
|
291
|
+
isRequired: true,
|
|
292
|
+
transformFunction: null
|
|
293
|
+
},
|
|
294
|
+
missing: {
|
|
295
|
+
classPropertyName: "missing",
|
|
296
|
+
publicName: "missing",
|
|
297
|
+
isSignal: true,
|
|
298
|
+
isRequired: false,
|
|
299
|
+
transformFunction: null
|
|
300
|
+
},
|
|
301
|
+
mode: {
|
|
302
|
+
classPropertyName: "mode",
|
|
303
|
+
publicName: "mode",
|
|
304
|
+
isSignal: true,
|
|
305
|
+
isRequired: false,
|
|
306
|
+
transformFunction: null
|
|
307
|
+
},
|
|
308
|
+
panelProps: {
|
|
309
|
+
classPropertyName: "panelProps",
|
|
310
|
+
publicName: "panelProps",
|
|
311
|
+
isSignal: true,
|
|
312
|
+
isRequired: false,
|
|
313
|
+
transformFunction: null
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
ngImport: i0,
|
|
317
|
+
template: `
|
|
318
|
+
@for (panel of shown(); track panel.region.key) {
|
|
319
|
+
<div [runicRegionPanel]="panel.attributes" [hidden]="!panel.region.selected" [style.display]="panel.region.selected ? null : 'none'"
|
|
320
|
+
[attr.data-region-key]="panel.region.key">
|
|
321
|
+
<runic-view-outlet [content]="panel.region.content" [registry]="registry()" [missing]="missing()" />
|
|
322
|
+
</div>
|
|
323
|
+
} @empty { <ng-content /> }
|
|
324
|
+
`,
|
|
325
|
+
isInline: true,
|
|
326
|
+
dependencies: [{
|
|
327
|
+
kind: "component",
|
|
328
|
+
type: ViewOutlet,
|
|
329
|
+
selector: "runic-view-outlet",
|
|
330
|
+
inputs: [
|
|
331
|
+
"content",
|
|
332
|
+
"registry",
|
|
333
|
+
"missing"
|
|
334
|
+
]
|
|
335
|
+
}, {
|
|
336
|
+
kind: "directive",
|
|
337
|
+
type: RegionPanel,
|
|
338
|
+
selector: "[runicRegionPanel]",
|
|
339
|
+
inputs: ["runicRegionPanel"]
|
|
340
|
+
}]
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
344
|
+
minVersion: "12.0.0",
|
|
345
|
+
version: "22.2.3",
|
|
346
|
+
ngImport: i0,
|
|
347
|
+
type: RegionOutlets,
|
|
348
|
+
decorators: [{
|
|
349
|
+
type: Component,
|
|
350
|
+
args: [{
|
|
351
|
+
selector: "runic-region-outlets",
|
|
352
|
+
standalone: true,
|
|
353
|
+
imports: [ViewOutlet, RegionPanel],
|
|
354
|
+
template: `
|
|
355
|
+
@for (panel of shown(); track panel.region.key) {
|
|
356
|
+
<div [runicRegionPanel]="panel.attributes" [hidden]="!panel.region.selected" [style.display]="panel.region.selected ? null : 'none'"
|
|
357
|
+
[attr.data-region-key]="panel.region.key">
|
|
358
|
+
<runic-view-outlet [content]="panel.region.content" [registry]="registry()" [missing]="missing()" />
|
|
359
|
+
</div>
|
|
360
|
+
} @empty { <ng-content /> }
|
|
361
|
+
`
|
|
362
|
+
}]
|
|
363
|
+
}],
|
|
364
|
+
propDecorators: {
|
|
365
|
+
collection: [{
|
|
366
|
+
type: i0.Input,
|
|
367
|
+
args: [{
|
|
368
|
+
isSignal: true,
|
|
369
|
+
alias: "collection",
|
|
370
|
+
required: false
|
|
371
|
+
}]
|
|
372
|
+
}],
|
|
373
|
+
registry: [{
|
|
374
|
+
type: i0.Input,
|
|
375
|
+
args: [{
|
|
376
|
+
isSignal: true,
|
|
377
|
+
alias: "registry",
|
|
378
|
+
required: true
|
|
379
|
+
}]
|
|
380
|
+
}],
|
|
381
|
+
missing: [{
|
|
382
|
+
type: i0.Input,
|
|
383
|
+
args: [{
|
|
384
|
+
isSignal: true,
|
|
385
|
+
alias: "missing",
|
|
386
|
+
required: false
|
|
387
|
+
}]
|
|
388
|
+
}],
|
|
389
|
+
mode: [{
|
|
390
|
+
type: i0.Input,
|
|
391
|
+
args: [{
|
|
392
|
+
isSignal: true,
|
|
393
|
+
alias: "mode",
|
|
394
|
+
required: false
|
|
395
|
+
}]
|
|
396
|
+
}],
|
|
397
|
+
panelProps: [{
|
|
398
|
+
type: i0.Input,
|
|
399
|
+
args: [{
|
|
400
|
+
isSignal: true,
|
|
401
|
+
alias: "panelProps",
|
|
402
|
+
required: false
|
|
403
|
+
}]
|
|
404
|
+
}]
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
const RunicViewOutlet = ViewOutlet;
|
|
408
|
+
function injectView(source, options = {}) {
|
|
409
|
+
if (!options.injector) assertInInjectionContext(injectView);
|
|
410
|
+
const injector = options.injector ?? inject(Injector);
|
|
411
|
+
const instance = instanceOf(injector);
|
|
412
|
+
const controller = instance.run(() => createViewController({
|
|
413
|
+
...options.release ? { release: options.release } : {},
|
|
414
|
+
...options.keepAlive === void 0 ? {} : { keepAlive: options.keepAlive }
|
|
415
|
+
}));
|
|
416
|
+
const current = signal(controller.current, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
417
|
+
controller.subscribe(() => current.set(controller.current));
|
|
418
|
+
const read = () => isSignal(source) ? source() : source;
|
|
419
|
+
const identity = computed(() => viewSourceIdentity(read()), ...ngDevMode ? [{ debugName: "identity" }] : /* istanbul ignore next */ []);
|
|
420
|
+
const observed = computed(() => {
|
|
421
|
+
const value = read();
|
|
422
|
+
return value && isViewClient(value) ? value : void 0;
|
|
423
|
+
}, ...ngDevMode ? [{ debugName: "observed" }] : /* istanbul ignore next */ []);
|
|
424
|
+
const fresh = computed(() => viewSourceIdentity(current().source) === identity(), ...ngDevMode ? [{ debugName: "fresh" }] : /* istanbul ignore next */ []);
|
|
425
|
+
effect(() => {
|
|
426
|
+
identity();
|
|
427
|
+
untracked(() => {
|
|
428
|
+
controller.setSource(read());
|
|
429
|
+
current.set(controller.current);
|
|
430
|
+
});
|
|
431
|
+
}, { injector });
|
|
432
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
433
|
+
const preview = computed(() => {
|
|
434
|
+
const value = observed();
|
|
435
|
+
if (value) return value === current().client ? void 0 : instance.run(() => viewSourcePreview(value));
|
|
436
|
+
return fresh() ? void 0 : instance.run(() => viewSourcePreview(read()));
|
|
437
|
+
}, ...ngDevMode ? [{ debugName: "preview" }] : /* istanbul ignore next */ []);
|
|
438
|
+
return {
|
|
439
|
+
state: computed(() => preview()?.state ?? (fresh() ? current().state : void 0)),
|
|
440
|
+
client: computed(() => preview()?.client ?? (fresh() ? current().client : void 0)),
|
|
441
|
+
error: computed(() => fresh() ? current().error : void 0),
|
|
442
|
+
pending: computed(() => preview() ? false : fresh() ? current().pending : identity() !== void 0),
|
|
443
|
+
retry: () => controller.retry()
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
function asError(cause) {
|
|
447
|
+
return cause instanceof Error ? cause : new Error(String(cause), { cause });
|
|
448
|
+
}
|
|
449
|
+
function injectViewResource(source, options = {}) {
|
|
450
|
+
if (!options.injector) assertInInjectionContext(injectViewResource);
|
|
451
|
+
const injector = options.injector ?? inject(Injector);
|
|
452
|
+
const instance = instanceOf(injector);
|
|
453
|
+
const read = () => isSignal(source) ? source() : source;
|
|
454
|
+
const client = signal(void 0, ...ngDevMode ? [{ debugName: "client" }] : /* istanbul ignore next */ []);
|
|
455
|
+
const controllerOptions = {
|
|
456
|
+
...options.release ? { release: options.release } : {},
|
|
457
|
+
...options.keepAlive === void 0 ? {} : { keepAlive: options.keepAlive }
|
|
458
|
+
};
|
|
459
|
+
const identity = computed(() => viewSourceIdentity(read()), ...ngDevMode ? [{ debugName: "identity" }] : /* istanbul ignore next */ []);
|
|
460
|
+
let active;
|
|
461
|
+
effect(() => {
|
|
462
|
+
if (identity() !== void 0) return;
|
|
463
|
+
active?.dispose();
|
|
464
|
+
active = void 0;
|
|
465
|
+
client.set(void 0);
|
|
466
|
+
}, { injector });
|
|
467
|
+
const ref = resource({
|
|
468
|
+
...ngDevMode ? { debugName: "ref" } : /* istanbul ignore next */ {},
|
|
469
|
+
injector,
|
|
470
|
+
params: () => identity(),
|
|
471
|
+
stream: async ({ abortSignal }) => {
|
|
472
|
+
const controller = instance.run(() => createViewController(controllerOptions));
|
|
473
|
+
active = controller;
|
|
474
|
+
abortSignal.addEventListener("abort", () => {
|
|
475
|
+
if (active === controller) active = void 0;
|
|
476
|
+
controller.dispose();
|
|
477
|
+
if (untracked(client) === controller.current.client) client.set(void 0);
|
|
478
|
+
}, { once: true });
|
|
479
|
+
controller.setSource(untracked(read));
|
|
480
|
+
if (controller.current.pending) await new Promise((resolve) => {
|
|
481
|
+
const stop = controller.subscribe(() => {
|
|
482
|
+
if (!controller.current.pending) {
|
|
483
|
+
stop();
|
|
484
|
+
resolve();
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
abortSignal.addEventListener("abort", () => {
|
|
488
|
+
stop();
|
|
489
|
+
resolve();
|
|
490
|
+
}, { once: true });
|
|
491
|
+
});
|
|
492
|
+
const value = signal(controller.current.error !== void 0 ? { error: asError(controller.current.error) } : { value: controller.current.state });
|
|
493
|
+
if (abortSignal.aborted) return value;
|
|
494
|
+
client.set(controller.current.client);
|
|
495
|
+
controller.subscribe(() => {
|
|
496
|
+
const current = controller.current;
|
|
497
|
+
client.set(current.client);
|
|
498
|
+
value.set(current.error !== void 0 ? { error: asError(current.error) } : { value: current.state });
|
|
499
|
+
});
|
|
500
|
+
return value;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
return {
|
|
504
|
+
value: ref.value.asReadonly(),
|
|
505
|
+
status: ref.status,
|
|
506
|
+
error: ref.error,
|
|
507
|
+
isLoading: ref.isLoading,
|
|
508
|
+
snapshot: ref.snapshot,
|
|
509
|
+
hasValue: () => ref.hasValue(),
|
|
510
|
+
client: client.asReadonly(),
|
|
511
|
+
reload: () => ref.reload(),
|
|
512
|
+
destroy: () => ref.destroy()
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function injectCommand(command, options = {}) {
|
|
516
|
+
if (!options.injector) assertInInjectionContext(injectCommand);
|
|
517
|
+
const injector = options.injector ?? inject(Injector);
|
|
518
|
+
const controller = instanceOf(injector).run(() => createCommandController(command));
|
|
519
|
+
const pending = signal(false, ...ngDevMode ? [{ debugName: "pending" }] : /* istanbul ignore next */ []);
|
|
520
|
+
const error = signal(void 0, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
521
|
+
const failure = signal(void 0, ...ngDevMode ? [{ debugName: "failure" }] : /* istanbul ignore next */ []);
|
|
522
|
+
controller.subscribe(() => {
|
|
523
|
+
pending.set(controller.current.pending);
|
|
524
|
+
error.set(controller.current.error);
|
|
525
|
+
failure.set(controller.current.failure);
|
|
526
|
+
});
|
|
527
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
528
|
+
return {
|
|
529
|
+
run: controller.run,
|
|
530
|
+
pending: pending.asReadonly(),
|
|
531
|
+
error: error.asReadonly(),
|
|
532
|
+
failure: failure.asReadonly(),
|
|
533
|
+
reset: controller.reset
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function injectOperation(start, { injector: provided, ...options } = {}) {
|
|
537
|
+
if (!provided) assertInInjectionContext(injectOperation);
|
|
538
|
+
const injector = provided ?? inject(Injector);
|
|
539
|
+
const controller = instanceOf(injector).run(() => createOperationController(start, options));
|
|
540
|
+
const state = signal(controller.current, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
541
|
+
controller.subscribe(() => state.set(controller.current));
|
|
542
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
543
|
+
const field = (key) => computed(() => state()[key]);
|
|
544
|
+
return {
|
|
545
|
+
run: controller.run,
|
|
546
|
+
cancel: controller.cancel,
|
|
547
|
+
reset: controller.reset,
|
|
548
|
+
pending: field("pending"),
|
|
549
|
+
admitting: field("admitting"),
|
|
550
|
+
operation: field("operation"),
|
|
551
|
+
status: field("status"),
|
|
552
|
+
outcome: field("outcome"),
|
|
553
|
+
failure: field("failure"),
|
|
554
|
+
error: field("error"),
|
|
555
|
+
cancelled: field("cancelled"),
|
|
556
|
+
cancellationRequested: field("cancellationRequested"),
|
|
557
|
+
cancelling: field("cancelling"),
|
|
558
|
+
progress: field("progress"),
|
|
559
|
+
cancellation: field("cancellation"),
|
|
560
|
+
cancelError: field("cancelError")
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function textOf$1(event) {
|
|
564
|
+
if (typeof event === "string") return event;
|
|
565
|
+
const target = event.target;
|
|
566
|
+
return typeof target?.value === "string" ? target.value : "";
|
|
567
|
+
}
|
|
568
|
+
function injectField(view, field, { injector: provided, ...options } = {}) {
|
|
569
|
+
if (!provided) assertInInjectionContext(injectField);
|
|
570
|
+
const injector = provided ?? inject(Injector);
|
|
571
|
+
const controller = instanceOf(injector).run(() => createFieldController(field, options));
|
|
572
|
+
const current = signal(controller.current, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
573
|
+
controller.subscribe(() => current.set(controller.current));
|
|
574
|
+
effect(() => {
|
|
575
|
+
const state = view.state();
|
|
576
|
+
const client = view.client();
|
|
577
|
+
untracked(() => {
|
|
578
|
+
controller.setSource(state === void 0 || client === void 0 ? void 0 : {
|
|
579
|
+
state,
|
|
580
|
+
client
|
|
581
|
+
});
|
|
582
|
+
current.set(controller.current);
|
|
583
|
+
});
|
|
584
|
+
}, { injector });
|
|
585
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
586
|
+
return {
|
|
587
|
+
value: computed(() => current().value),
|
|
588
|
+
text: computed(() => current().text),
|
|
589
|
+
editing: computed(() => current().editing),
|
|
590
|
+
error: computed(() => current().error),
|
|
591
|
+
errors: computed(() => current().errors),
|
|
592
|
+
conflict: computed(() => current().conflict),
|
|
593
|
+
validating: computed(() => current().validating),
|
|
594
|
+
field: controller.field,
|
|
595
|
+
input(value) {
|
|
596
|
+
controller.input(value);
|
|
597
|
+
},
|
|
598
|
+
inputText(event) {
|
|
599
|
+
controller.inputText(textOf$1(event));
|
|
600
|
+
},
|
|
601
|
+
compositionStart() {
|
|
602
|
+
controller.compositionStart();
|
|
603
|
+
},
|
|
604
|
+
compositionEnd(event) {
|
|
605
|
+
controller.compositionEnd(textOf$1(event));
|
|
606
|
+
},
|
|
607
|
+
commit() {
|
|
608
|
+
return controller.commit();
|
|
609
|
+
},
|
|
610
|
+
retry() {
|
|
611
|
+
controller.retry();
|
|
612
|
+
},
|
|
613
|
+
reset() {
|
|
614
|
+
controller.reset();
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function injectForm(fields, options = {}) {
|
|
619
|
+
const list = formFieldList(fields);
|
|
620
|
+
const submitting = signal(false, ...ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []);
|
|
621
|
+
const state = computed(() => formStateOf(list.map((field) => ({
|
|
622
|
+
editing: field.editing(),
|
|
623
|
+
validating: field.validating(),
|
|
624
|
+
errors: field.errors(),
|
|
625
|
+
error: field.error()
|
|
626
|
+
})), options.dirty?.() === true, submitting()), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
627
|
+
return {
|
|
628
|
+
state,
|
|
629
|
+
dirty: computed(() => state().dirty),
|
|
630
|
+
editing: computed(() => state().editing),
|
|
631
|
+
validating: computed(() => state().validating),
|
|
632
|
+
pending: computed(() => state().pending),
|
|
633
|
+
valid: computed(() => state().valid),
|
|
634
|
+
submitting: computed(() => state().submitting),
|
|
635
|
+
async submit(command, submitOptions = {}) {
|
|
636
|
+
if (submitting()) return { status: "busy" };
|
|
637
|
+
submitting.set(true);
|
|
638
|
+
const read = (index) => {
|
|
639
|
+
const field = list[index];
|
|
640
|
+
return {
|
|
641
|
+
editing: field.editing(),
|
|
642
|
+
error: field.error(),
|
|
643
|
+
validating: field.validating()
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
try {
|
|
647
|
+
return await submitFields(list, command, submitOptions, read);
|
|
648
|
+
} finally {
|
|
649
|
+
submitting.set(false);
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
async commit() {
|
|
653
|
+
await Promise.all(list.map((field) => field.commit()));
|
|
654
|
+
return state();
|
|
655
|
+
},
|
|
656
|
+
reset() {
|
|
657
|
+
for (const field of list) field.reset();
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function textOf(event) {
|
|
662
|
+
if (typeof event === "string") return event;
|
|
663
|
+
const target = event.target;
|
|
664
|
+
return typeof target?.value === "string" ? target.value : "";
|
|
665
|
+
}
|
|
666
|
+
function injectTextField(view, read, write, { injector: provided, ...options } = {}) {
|
|
667
|
+
if (!provided) assertInInjectionContext(injectTextField);
|
|
668
|
+
const injector = provided ?? inject(Injector);
|
|
669
|
+
const controller = instanceOf(injector).run(() => createTextFieldController({
|
|
670
|
+
read,
|
|
671
|
+
write,
|
|
672
|
+
...options
|
|
673
|
+
}));
|
|
674
|
+
const current = signal(controller.current, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
675
|
+
controller.subscribe(() => current.set(controller.current));
|
|
676
|
+
effect(() => {
|
|
677
|
+
const state = view.state();
|
|
678
|
+
const client = view.client();
|
|
679
|
+
untracked(() => {
|
|
680
|
+
controller.setSource(state === void 0 || client === void 0 ? void 0 : {
|
|
681
|
+
state,
|
|
682
|
+
client
|
|
683
|
+
});
|
|
684
|
+
current.set(controller.current);
|
|
685
|
+
});
|
|
686
|
+
}, { injector });
|
|
687
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
688
|
+
return {
|
|
689
|
+
value: computed(() => current().value),
|
|
690
|
+
editing: computed(() => current().editing),
|
|
691
|
+
error: computed(() => current().error),
|
|
692
|
+
input(event) {
|
|
693
|
+
controller.input(textOf(event));
|
|
694
|
+
},
|
|
695
|
+
compositionStart() {
|
|
696
|
+
controller.compositionStart();
|
|
697
|
+
},
|
|
698
|
+
compositionEnd(event) {
|
|
699
|
+
controller.compositionEnd(textOf(event));
|
|
700
|
+
},
|
|
701
|
+
reset() {
|
|
702
|
+
controller.reset();
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
function injectLatestOperation({ injector: provided } = {}) {
|
|
707
|
+
if (!provided) assertInInjectionContext(injectLatestOperation);
|
|
708
|
+
const injector = provided ?? inject(Injector);
|
|
709
|
+
const controller = instanceOf(injector).run(() => createLatestOperationController());
|
|
710
|
+
const state = signal(controller.current, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
711
|
+
controller.subscribe(() => state.set(controller.current));
|
|
712
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
713
|
+
const field = (key) => computed(() => state()[key]);
|
|
714
|
+
return {
|
|
715
|
+
run: controller.run,
|
|
716
|
+
clear: controller.clear,
|
|
717
|
+
pending: field("pending"),
|
|
718
|
+
admitting: field("admitting"),
|
|
719
|
+
operation: field("operation"),
|
|
720
|
+
status: field("status"),
|
|
721
|
+
outcome: field("outcome"),
|
|
722
|
+
failure: field("failure"),
|
|
723
|
+
error: field("error"),
|
|
724
|
+
cancelled: field("cancelled"),
|
|
725
|
+
cancellationRequested: field("cancellationRequested"),
|
|
726
|
+
cancelling: field("cancelling"),
|
|
727
|
+
progress: field("progress"),
|
|
728
|
+
cancellation: field("cancellation"),
|
|
729
|
+
cancelError: field("cancelError"),
|
|
730
|
+
blocked: field("blocked")
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function injectCollectionViewport(element, options, { injector: provided } = {}) {
|
|
734
|
+
if (!provided) assertInInjectionContext(injectCollectionViewport);
|
|
735
|
+
const injector = provided ?? inject(Injector);
|
|
736
|
+
const controller = createCollectionViewportController(untracked(options));
|
|
737
|
+
const viewport = signal(controller.current, ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
|
|
738
|
+
controller.subscribe(() => viewport.set(controller.current));
|
|
739
|
+
effect(() => {
|
|
740
|
+
const { totalCount, rowHeight, overscan } = options();
|
|
741
|
+
untracked(() => controller.update({
|
|
742
|
+
totalCount,
|
|
743
|
+
rowHeight,
|
|
744
|
+
...overscan === void 0 ? {} : { overscan }
|
|
745
|
+
}));
|
|
746
|
+
}, { injector });
|
|
747
|
+
const zone = injector.get(NgZone, null);
|
|
748
|
+
effect(() => {
|
|
749
|
+
const target = element();
|
|
750
|
+
const attach = () => controller.attach(target instanceof ElementRef ? target.nativeElement : target);
|
|
751
|
+
untracked(() => zone ? zone.runOutsideAngular(attach) : attach());
|
|
752
|
+
}, { injector });
|
|
753
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
754
|
+
return viewport.asReadonly();
|
|
755
|
+
}
|
|
756
|
+
const empty = {
|
|
757
|
+
items: [],
|
|
758
|
+
totalSize: 0,
|
|
759
|
+
total: null,
|
|
760
|
+
query: {
|
|
761
|
+
sort: [],
|
|
762
|
+
filters: []
|
|
763
|
+
},
|
|
764
|
+
loading: false,
|
|
765
|
+
error: void 0
|
|
766
|
+
};
|
|
767
|
+
function injectQueryCollection(element, collection, options, { injector: provided } = {}) {
|
|
768
|
+
if (!provided) assertInInjectionContext(injectQueryCollection);
|
|
769
|
+
const injector = provided ?? inject(Injector);
|
|
770
|
+
const viewport = signal(empty, ...ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []);
|
|
771
|
+
const zone = injector.get(NgZone, null);
|
|
772
|
+
const outside = (run) => zone ? zone.runOutsideAngular(run) : run();
|
|
773
|
+
let controller;
|
|
774
|
+
const container = () => {
|
|
775
|
+
const target = untracked(element);
|
|
776
|
+
return target instanceof ElementRef ? target.nativeElement : target ?? null;
|
|
777
|
+
};
|
|
778
|
+
let release;
|
|
779
|
+
effect(() => {
|
|
780
|
+
const current = collection();
|
|
781
|
+
untracked(() => {
|
|
782
|
+
release?.();
|
|
783
|
+
release = void 0;
|
|
784
|
+
if (!current) {
|
|
785
|
+
viewport.set(empty);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
const created = controller = createQueryViewportController(current, options());
|
|
789
|
+
const stop = created.subscribe(() => viewport.set(created.current));
|
|
790
|
+
outside(() => created.attach(container()));
|
|
791
|
+
viewport.set(created.current);
|
|
792
|
+
release = () => {
|
|
793
|
+
stop();
|
|
794
|
+
created.dispose();
|
|
795
|
+
if (controller === created) controller = void 0;
|
|
796
|
+
};
|
|
797
|
+
});
|
|
798
|
+
}, { injector });
|
|
799
|
+
effect(() => {
|
|
800
|
+
const { estimateSize, overscan } = options();
|
|
801
|
+
untracked(() => controller?.update({
|
|
802
|
+
estimateSize,
|
|
803
|
+
...overscan === void 0 ? {} : { overscan }
|
|
804
|
+
}));
|
|
805
|
+
}, { injector });
|
|
806
|
+
effect(() => {
|
|
807
|
+
element();
|
|
808
|
+
untracked(() => outside(() => controller?.attach(container())));
|
|
809
|
+
}, { injector });
|
|
810
|
+
injector.get(DestroyRef).onDestroy(() => {
|
|
811
|
+
release?.();
|
|
812
|
+
release = void 0;
|
|
813
|
+
});
|
|
814
|
+
return {
|
|
815
|
+
viewport: viewport.asReadonly(),
|
|
816
|
+
observe: (target, index) => controller?.observe(target instanceof ElementRef ? target.nativeElement : target, index) ?? (() => {}),
|
|
817
|
+
scrollToKey: async (key, align) => controller ? controller.scrollToKey(key, align) : false,
|
|
818
|
+
scrollToIndex: (index, align) => controller?.scrollToIndex(index, align),
|
|
819
|
+
setQuery: async (query) => {
|
|
820
|
+
const current = untracked(collection);
|
|
821
|
+
if (!current) throw new TypeError("injectQueryCollection has no collection yet.");
|
|
822
|
+
await current.setQuery(query);
|
|
823
|
+
},
|
|
824
|
+
retry: () => untracked(collection)?.retry()
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
function injectBridgeConnection({ injector: provided, ...options } = {}) {
|
|
828
|
+
if (!provided) assertInInjectionContext(injectBridgeConnection);
|
|
829
|
+
const injector = provided ?? inject(Injector);
|
|
830
|
+
const state = signal("connecting", ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
831
|
+
if (injector.get(PLATFORM_ID, null) !== "server") {
|
|
832
|
+
const stop = instanceOf(injector).run(() => onBridgeConnection$1((next) => state.set(next), options));
|
|
833
|
+
injector.get(DestroyRef).onDestroy(stop);
|
|
834
|
+
}
|
|
835
|
+
return { state: state.asReadonly() };
|
|
836
|
+
}
|
|
837
|
+
function injectText(source, fallback, { injector: provided } = {}) {
|
|
838
|
+
if (!provided) assertInInjectionContext(injectText);
|
|
839
|
+
const injector = provided ?? inject(Injector);
|
|
840
|
+
const instance = instanceOf(injector);
|
|
841
|
+
const version = signal(0, ...ngDevMode ? [{ debugName: "version" }] : /* istanbul ignore next */ []);
|
|
842
|
+
if (injector.get(PLATFORM_ID, null) !== "server") {
|
|
843
|
+
const stop = instance.run(() => subscribeText(() => version.update((value) => value + 1)));
|
|
844
|
+
injector.get(DestroyRef).onDestroy(stop);
|
|
845
|
+
}
|
|
846
|
+
return computed(() => {
|
|
847
|
+
version();
|
|
848
|
+
const value = source(), otherwise = fallback?.();
|
|
849
|
+
return instance.run(() => resolveText$1(value, otherwise));
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function injectWindowLocale({ injector: provided } = {}) {
|
|
853
|
+
if (!provided) assertInInjectionContext(injectWindowLocale);
|
|
854
|
+
const injector = provided ?? inject(Injector);
|
|
855
|
+
const instance = instanceOf(injector);
|
|
856
|
+
const locale = signal(instance.run(windowLocale$1), ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
857
|
+
if (injector.get(PLATFORM_ID, null) !== "server") {
|
|
858
|
+
const stop = instance.run(() => onWindowLocale((next) => locale.set(next)));
|
|
859
|
+
injector.get(DestroyRef).onDestroy(stop);
|
|
860
|
+
}
|
|
861
|
+
return locale.asReadonly();
|
|
862
|
+
}
|
|
863
|
+
const textLocales = /* @__PURE__ */ new WeakMap();
|
|
864
|
+
function textLocaleSignal(instance = contextInstance()) {
|
|
865
|
+
const existing = textLocales.get(instance);
|
|
866
|
+
if (existing) return existing;
|
|
867
|
+
let shown = instance.run(textLocale), revision = translationsTextRevision();
|
|
868
|
+
const current = signal(shown, {
|
|
869
|
+
...ngDevMode ? { debugName: "current" } : /* istanbul ignore next */ {},
|
|
870
|
+
equal: () => false
|
|
871
|
+
});
|
|
872
|
+
instance.run(() => subscribeText(() => {
|
|
873
|
+
const next = instance.run(textLocale), nextRevision = translationsTextRevision();
|
|
874
|
+
if (next === shown && nextRevision === revision) return;
|
|
875
|
+
shown = next;
|
|
876
|
+
revision = nextRevision;
|
|
877
|
+
current.set(next);
|
|
878
|
+
}));
|
|
879
|
+
const locale = current.asReadonly();
|
|
880
|
+
textLocales.set(instance, locale);
|
|
881
|
+
return locale;
|
|
882
|
+
}
|
|
883
|
+
var RunicTextPipe = class RunicTextPipe {
|
|
884
|
+
changes = inject(ChangeDetectorRef);
|
|
885
|
+
instance = instanceOf(inject(Injector));
|
|
886
|
+
stop = this.instance.run(() => subscribeText(() => this.changes.markForCheck()));
|
|
887
|
+
last;
|
|
888
|
+
transform(value, fallback) {
|
|
889
|
+
const version = this.instance.run(textVersion);
|
|
890
|
+
const last = this.last;
|
|
891
|
+
if (last && last.value === value && last.fallback === fallback && last.version === version) return last.text;
|
|
892
|
+
const text = this.instance.run(() => resolveText$1(value, fallback));
|
|
893
|
+
this.last = {
|
|
894
|
+
value,
|
|
895
|
+
fallback,
|
|
896
|
+
version,
|
|
897
|
+
text
|
|
898
|
+
};
|
|
899
|
+
return text;
|
|
900
|
+
}
|
|
901
|
+
ngOnDestroy() {
|
|
902
|
+
this.stop();
|
|
903
|
+
}
|
|
904
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
905
|
+
minVersion: "12.0.0",
|
|
906
|
+
version: "22.2.3",
|
|
907
|
+
ngImport: i0,
|
|
908
|
+
type: RunicTextPipe,
|
|
909
|
+
deps: [],
|
|
910
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
911
|
+
});
|
|
912
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({
|
|
913
|
+
minVersion: "14.0.0",
|
|
914
|
+
version: "22.2.3",
|
|
915
|
+
ngImport: i0,
|
|
916
|
+
type: RunicTextPipe,
|
|
917
|
+
isStandalone: true,
|
|
918
|
+
name: "runicText",
|
|
919
|
+
pure: false
|
|
920
|
+
});
|
|
921
|
+
};
|
|
922
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
923
|
+
minVersion: "12.0.0",
|
|
924
|
+
version: "22.2.3",
|
|
925
|
+
ngImport: i0,
|
|
926
|
+
type: RunicTextPipe,
|
|
927
|
+
decorators: [{
|
|
928
|
+
type: Pipe,
|
|
929
|
+
args: [{
|
|
930
|
+
name: "runicText",
|
|
931
|
+
standalone: true,
|
|
932
|
+
pure: false
|
|
933
|
+
}]
|
|
934
|
+
}]
|
|
935
|
+
});
|
|
936
|
+
function injectAppearance({ injector: provided } = {}) {
|
|
937
|
+
if (!provided) assertInInjectionContext(injectAppearance);
|
|
938
|
+
const injector = provided ?? inject(Injector);
|
|
939
|
+
if (injector.get(PLATFORM_ID, null) === "server") return signal(unknownAppearance).asReadonly();
|
|
940
|
+
const instance = instanceOf(injector);
|
|
941
|
+
const current = signal(instance.run(appearance$1), ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
942
|
+
const stop = instance.run(() => onAppearance$1((next) => current.set(next)));
|
|
943
|
+
injector.get(DestroyRef).onDestroy(stop);
|
|
944
|
+
current.set(instance.run(appearance$1));
|
|
945
|
+
return current.asReadonly();
|
|
946
|
+
}
|
|
947
|
+
function injectMenuBar({ injector: provided, onRequest, ...options } = {}) {
|
|
948
|
+
if (!provided) assertInInjectionContext(injectMenuBar);
|
|
949
|
+
const injector = provided ?? inject(Injector);
|
|
950
|
+
if (injector.get(PLATFORM_ID, null) === "server") return {
|
|
951
|
+
state: signal(Object.freeze({
|
|
952
|
+
status: "connecting",
|
|
953
|
+
placement: "none",
|
|
954
|
+
shortcuts: options.shortcuts === "app" ? "app" : "host",
|
|
955
|
+
accessKeyHints: false,
|
|
956
|
+
revision: 0,
|
|
957
|
+
menus: Object.freeze([])
|
|
958
|
+
}), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []).asReadonly(),
|
|
959
|
+
invoke: () => Promise.reject(new BridgeError("unavailable", "The menu bar is not followed during server rendering.", { route: "runic.menu-bar" })),
|
|
960
|
+
handleKeyDown: () => false
|
|
961
|
+
};
|
|
962
|
+
const controller = instanceOf(injector).run(() => createMenuBarController(options));
|
|
963
|
+
const state = signal(controller.current, ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
964
|
+
controller.subscribe(() => state.set(controller.current));
|
|
965
|
+
if (onRequest) controller.onRequest(onRequest);
|
|
966
|
+
injector.get(DestroyRef).onDestroy(() => controller.dispose());
|
|
967
|
+
return {
|
|
968
|
+
state: state.asReadonly(),
|
|
969
|
+
invoke: controller.invoke,
|
|
970
|
+
handleKeyDown: controller.handleKeyDown
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
export { RUNIC_INSTANCE, RegionOutlets, RunicTextPipe, RunicViewOutlet, ViewOutlet, appearance, commitAllFields, configureFieldErrorText, configureTranslatedText, createRunicInstance, fieldErrorText, injectAppearance, injectBridgeConnection, injectCollectionViewport, injectCommand, injectField, injectForm, injectLatestOperation, injectMenuBar, injectOperation, injectQueryCollection, injectRunicInstance, injectText, injectTextField, injectView, injectViewResource, injectWindowLocale, installBackNavigation, installNavigationPath, navigateBack, onAppearance, onBridgeConnection, onNavigationPath, openNavigationPath, pageInstance, provideRunicInstance, regionEntries, resolveText, selectedRegion, syncDocumentLocale, textDirection, textLocaleSignal, upload, windowLocale };
|
|
974
|
+
|
|
975
|
+
//# sourceMappingURL=runic-artifex-angular.mjs.map
|