@origostudio/angular-renderer 0.0.40
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/CHANGELOG.md +424 -0
- package/README.md +11 -0
- package/package.json +25 -0
- package/src/adapters/web/adapter.d.ts +20 -0
- package/src/adapters/web/adapter.js +140 -0
- package/src/adapters/web/adapter.js.map +1 -0
- package/src/adapters/web/experience-adapter.service.d.ts +6 -0
- package/src/adapters/web/experience-adapter.service.js +44 -0
- package/src/adapters/web/experience-adapter.service.js.map +1 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.d.ts +27 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.js +77 -0
- package/src/components/primitives/breadcrumbs/breadcrumbs.component.js.map +1 -0
- package/src/components/primitives/button/button.component.d.ts +26 -0
- package/src/components/primitives/button/button.component.js +74 -0
- package/src/components/primitives/button/button.component.js.map +1 -0
- package/src/components/primitives/card/card.component.d.ts +27 -0
- package/src/components/primitives/card/card.component.js +77 -0
- package/src/components/primitives/card/card.component.js.map +1 -0
- package/src/components/primitives/checkbox/checkbox.component.d.ts +29 -0
- package/src/components/primitives/checkbox/checkbox.component.js +81 -0
- package/src/components/primitives/checkbox/checkbox.component.js.map +1 -0
- package/src/components/primitives/chip/chip.component.d.ts +22 -0
- package/src/components/primitives/chip/chip.component.js +79 -0
- package/src/components/primitives/chip/chip.component.js.map +1 -0
- package/src/components/primitives/data-grid/data-grid.component.d.ts +48 -0
- package/src/components/primitives/data-grid/data-grid.component.js +135 -0
- package/src/components/primitives/data-grid/data-grid.component.js.map +1 -0
- package/src/components/primitives/form-field/form-field.component.d.ts +30 -0
- package/src/components/primitives/form-field/form-field.component.js +81 -0
- package/src/components/primitives/form-field/form-field.component.js.map +1 -0
- package/src/components/primitives/hbox/hbox.component.d.ts +25 -0
- package/src/components/primitives/hbox/hbox.component.js +92 -0
- package/src/components/primitives/hbox/hbox.component.js.map +1 -0
- package/src/components/primitives/label/label.component.d.ts +23 -0
- package/src/components/primitives/label/label.component.js +62 -0
- package/src/components/primitives/label/label.component.js.map +1 -0
- package/src/components/primitives/list/list.component.d.ts +25 -0
- package/src/components/primitives/list/list.component.js +79 -0
- package/src/components/primitives/list/list.component.js.map +1 -0
- package/src/components/primitives/radio-group/radio-group.component.d.ts +35 -0
- package/src/components/primitives/radio-group/radio-group.component.js +86 -0
- package/src/components/primitives/radio-group/radio-group.component.js.map +1 -0
- package/src/components/primitives/select/select.component.d.ts +39 -0
- package/src/components/primitives/select/select.component.js +91 -0
- package/src/components/primitives/select/select.component.js.map +1 -0
- package/src/components/primitives/sidebar/sidebar.component.d.ts +37 -0
- package/src/components/primitives/sidebar/sidebar.component.js +106 -0
- package/src/components/primitives/sidebar/sidebar.component.js.map +1 -0
- package/src/components/primitives/switch/switch.component.d.ts +22 -0
- package/src/components/primitives/switch/switch.component.js +80 -0
- package/src/components/primitives/switch/switch.component.js.map +1 -0
- package/src/components/primitives/tabs/tabs.component.d.ts +34 -0
- package/src/components/primitives/tabs/tabs.component.js +124 -0
- package/src/components/primitives/tabs/tabs.component.js.map +1 -0
- package/src/components/primitives/text-input/text-input.component.d.ts +29 -0
- package/src/components/primitives/text-input/text-input.component.js +81 -0
- package/src/components/primitives/text-input/text-input.component.js.map +1 -0
- package/src/components/primitives/textarea/textarea.component.d.ts +36 -0
- package/src/components/primitives/textarea/textarea.component.js +91 -0
- package/src/components/primitives/textarea/textarea.component.js.map +1 -0
- package/src/components/primitives/vbox/vbox.component.d.ts +25 -0
- package/src/components/primitives/vbox/vbox.component.js +92 -0
- package/src/components/primitives/vbox/vbox.component.js.map +1 -0
- package/src/devtools/devtools-bridge.d.ts +34 -0
- package/src/devtools/devtools-bridge.js +146 -0
- package/src/devtools/devtools-bridge.js.map +1 -0
- package/src/devtools/index.d.ts +1 -0
- package/src/devtools/index.js +5 -0
- package/src/devtools/index.js.map +1 -0
- package/src/index.d.ts +23 -0
- package/src/index.js +27 -0
- package/src/index.js.map +1 -0
- package/src/lib/primitives.provider.d.ts +2 -0
- package/src/lib/primitives.provider.js +54 -0
- package/src/lib/primitives.provider.js.map +1 -0
- package/src/lib/renderer.component.d.ts +12 -0
- package/src/lib/renderer.component.js +114 -0
- package/src/lib/renderer.component.js.map +1 -0
- package/src/lib/renderer.tokens.d.ts +2 -0
- package/src/lib/renderer.tokens.js +10 -0
- package/src/lib/renderer.tokens.js.map +1 -0
- package/src/lib/theme.provider.d.ts +13 -0
- package/src/lib/theme.provider.js +77 -0
- package/src/lib/theme.provider.js.map +1 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._injectTestState = _injectTestState;
|
|
4
|
+
exports._resetTestState = _resetTestState;
|
|
5
|
+
exports.appendErrorTelemetry = appendErrorTelemetry;
|
|
6
|
+
exports.getDevToolsAPI = getDevToolsAPI;
|
|
7
|
+
exports.initDevToolsBridge = initDevToolsBridge;
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
10
|
+
const core_1 = require("@angular/core");
|
|
11
|
+
// Sensitive keys to redact
|
|
12
|
+
const SENSITIVE_KEYS = new Set(['password', 'ssn', 'apikey', 'token', 'secret']);
|
|
13
|
+
function redactSensitiveData(obj, seen = new WeakSet()) {
|
|
14
|
+
if (obj === null || typeof obj !== 'object') {
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
if (seen.has(obj)) {
|
|
18
|
+
return '[CIRCULAR]';
|
|
19
|
+
}
|
|
20
|
+
seen.add(obj);
|
|
21
|
+
let result;
|
|
22
|
+
if (Array.isArray(obj)) {
|
|
23
|
+
result = obj.map(item => redactSensitiveData(item, seen));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const redacted = {};
|
|
27
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
28
|
+
if (SENSITIVE_KEYS.has(key.toLowerCase()) || key.toLowerCase().includes('password')) {
|
|
29
|
+
redacted[key] = '[REDACTED]';
|
|
30
|
+
}
|
|
31
|
+
else if (value !== null && typeof value === 'object') {
|
|
32
|
+
redacted[key] = redactSensitiveData(value, seen);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
redacted[key] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
result = redacted;
|
|
39
|
+
}
|
|
40
|
+
seen.delete(obj);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
// In-memory mock state for dev tools (to be replaced by actual AST bindings in future epics)
|
|
44
|
+
let _internalState = {
|
|
45
|
+
entities: [],
|
|
46
|
+
};
|
|
47
|
+
let _errorTelemetry = [];
|
|
48
|
+
function deepCloneState(obj, seen = new WeakMap()) {
|
|
49
|
+
if (obj === null || typeof obj !== 'object') {
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
if (seen.has(obj)) {
|
|
53
|
+
return seen.get(obj);
|
|
54
|
+
}
|
|
55
|
+
const clone = Array.isArray(obj) ? [] : {};
|
|
56
|
+
seen.set(obj, clone);
|
|
57
|
+
for (const key in obj) {
|
|
58
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
59
|
+
clone[key] = deepCloneState(obj[key], seen);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return clone;
|
|
63
|
+
}
|
|
64
|
+
function _injectTestState(state) {
|
|
65
|
+
try {
|
|
66
|
+
_internalState =
|
|
67
|
+
typeof structuredClone === 'function' ? structuredClone(state) : deepCloneState(state);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
// Fallback if structuredClone fails (e.g. contains functions or unsupported types)
|
|
71
|
+
_internalState = deepCloneState(state);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function _resetTestState() {
|
|
75
|
+
_internalState = { entities: [] };
|
|
76
|
+
_errorTelemetry = [];
|
|
77
|
+
}
|
|
78
|
+
function appendErrorTelemetry(error) {
|
|
79
|
+
_errorTelemetry.push(error);
|
|
80
|
+
}
|
|
81
|
+
function getDevToolsAPI() {
|
|
82
|
+
if (!(0, core_1.isDevMode)()) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
getActiveState: () => redactSensitiveData(_internalState),
|
|
87
|
+
getRenderingPath: (path) => {
|
|
88
|
+
// Build a tree from _internalState
|
|
89
|
+
const state = _internalState;
|
|
90
|
+
if (state && state.id === 'dom-identity') {
|
|
91
|
+
// Map the provided JSON to a tree
|
|
92
|
+
const root = {
|
|
93
|
+
name: state.name || 'Root',
|
|
94
|
+
badlPath: `/${state.domain || 'core'}/${state.id}`,
|
|
95
|
+
children: (state.entities || []).map((ent) => ({
|
|
96
|
+
name: ent.name,
|
|
97
|
+
badlPath: `/${state.domain || 'core'}/${state.id}/${ent.id}`,
|
|
98
|
+
children: (ent.fields || []).map((fld) => ({
|
|
99
|
+
name: fld.name,
|
|
100
|
+
badlPath: fld.metadata_path || `/${ent.id}/${fld.id}`,
|
|
101
|
+
})),
|
|
102
|
+
})),
|
|
103
|
+
};
|
|
104
|
+
return root;
|
|
105
|
+
}
|
|
106
|
+
// Default fallback
|
|
107
|
+
return {
|
|
108
|
+
name: 'Root Application',
|
|
109
|
+
badlPath: '/',
|
|
110
|
+
children: [],
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
getMetadataSource: (path) => {
|
|
114
|
+
// Find the object in _internalState that matches the path
|
|
115
|
+
const state = _internalState;
|
|
116
|
+
if (state && state.id === 'dom-identity') {
|
|
117
|
+
// Return the whole state for root, or specific parts based on path
|
|
118
|
+
if (path === `/${state.domain || 'core'}/${state.id}`)
|
|
119
|
+
return state;
|
|
120
|
+
for (const ent of state.entities || []) {
|
|
121
|
+
if (path === `/${state.domain || 'core'}/${state.id}/${ent.id}`)
|
|
122
|
+
return ent;
|
|
123
|
+
for (const fld of ent.fields || []) {
|
|
124
|
+
if (path === (fld.metadata_path || `/${ent.id}/${fld.id}`))
|
|
125
|
+
return fld;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { file: 'mock.json', line: 1 };
|
|
130
|
+
},
|
|
131
|
+
getResolutionChain: (path) => {
|
|
132
|
+
return null;
|
|
133
|
+
},
|
|
134
|
+
getErrorTelemetry: () => _errorTelemetry,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function initDevToolsBridge() {
|
|
138
|
+
if (!(0, core_1.isDevMode)()) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const api = getDevToolsAPI();
|
|
142
|
+
if (api && typeof window !== 'undefined') {
|
|
143
|
+
window.__ORIGO_DEVTOOLS__ = api;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=devtools-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools-bridge.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/devtools/devtools-bridge.ts"],"names":[],"mappings":";;AAiGA,4CAQC;AAED,0CAGC;AAED,oDAEC;AAED,wCAwDC;AAED,gDASC;AAvLD,uDAAuD;AACvD,sDAAsD;AACtD,wCAA0C;AAqC1C,2BAA2B;AAC3B,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjF,SAAS,mBAAmB,CAAC,GAAY,EAAE,IAAI,GAAG,IAAI,OAAO,EAAE;IAC7D,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAA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|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/devtools/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './lib/theme.provider';
|
|
2
|
+
export * from './lib/renderer.component';
|
|
3
|
+
export * from './lib/renderer.tokens';
|
|
4
|
+
export * from './adapters/web/adapter';
|
|
5
|
+
export * from './components/primitives/vbox/vbox.component';
|
|
6
|
+
export * from './components/primitives/text-input/text-input.component';
|
|
7
|
+
export * from './components/primitives/button/button.component';
|
|
8
|
+
export * from './devtools';
|
|
9
|
+
export * from './components/primitives/select/select.component';
|
|
10
|
+
export * from './components/primitives/checkbox/checkbox.component';
|
|
11
|
+
export * from './components/primitives/radio-group/radio-group.component';
|
|
12
|
+
export * from './components/primitives/textarea/textarea.component';
|
|
13
|
+
export * from './components/primitives/hbox/hbox.component';
|
|
14
|
+
export * from './components/primitives/label/label.component';
|
|
15
|
+
export * from './components/primitives/form-field/form-field.component';
|
|
16
|
+
export * from './lib/primitives.provider';
|
|
17
|
+
export * from './components/primitives/data-grid/data-grid.component';
|
|
18
|
+
export * from './components/primitives/list/list.component';
|
|
19
|
+
export * from './components/primitives/card/card.component';
|
|
20
|
+
export * from './components/primitives/sidebar/sidebar.component';
|
|
21
|
+
export * from './components/primitives/tabs/tabs.component';
|
|
22
|
+
export * from './components/primitives/breadcrumbs/breadcrumbs.component';
|
|
23
|
+
export * from './adapters/web/experience-adapter.service';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./lib/theme.provider"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./lib/renderer.component"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./lib/renderer.tokens"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./adapters/web/adapter"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/primitives/vbox/vbox.component"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/primitives/text-input/text-input.component"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/primitives/button/button.component"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./devtools"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/primitives/select/select.component"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/primitives/checkbox/checkbox.component"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/primitives/radio-group/radio-group.component"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/primitives/textarea/textarea.component"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./components/primitives/hbox/hbox.component"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./components/primitives/label/label.component"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./components/primitives/form-field/form-field.component"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./lib/primitives.provider"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./components/primitives/data-grid/data-grid.component"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./components/primitives/list/list.component"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./components/primitives/card/card.component"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./components/primitives/sidebar/sidebar.component"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./components/primitives/tabs/tabs.component"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./components/primitives/breadcrumbs/breadcrumbs.component"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./adapters/web/experience-adapter.service"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/angular-renderer/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mEAAyC;AACzC,gEAAsC;AACtC,iEAAuC;AACvC,sFAA4D;AAC5D,kGAAwE;AACxE,0FAAgE;AAChE,qDAA2B;AAC3B,0FAAgE;AAChE,8FAAoE;AACpE,oGAA0E;AAC1E,8FAAoE;AACpE,sFAA4D;AAC5D,wFAA8D;AAC9D,kGAAwE;AACxE,oEAA0C;AAC1C,gGAAsE;AACtE,sFAA4D;AAC5D,sFAA4D;AAC5D,4FAAkE;AAClE,sFAA4D;AAC5D,oGAA0E;AAC1E,oFAA0D"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.provideOrigo9Primitives = provideOrigo9Primitives;
|
|
4
|
+
const core_1 = require("@angular/core");
|
|
5
|
+
const renderer_tokens_1 = require("./renderer.tokens");
|
|
6
|
+
const select_component_1 = require("../components/primitives/select/select.component");
|
|
7
|
+
const checkbox_component_1 = require("../components/primitives/checkbox/checkbox.component");
|
|
8
|
+
const radio_group_component_1 = require("../components/primitives/radio-group/radio-group.component");
|
|
9
|
+
const textarea_component_1 = require("../components/primitives/textarea/textarea.component");
|
|
10
|
+
const hbox_component_1 = require("../components/primitives/hbox/hbox.component");
|
|
11
|
+
const label_component_1 = require("../components/primitives/label/label.component");
|
|
12
|
+
const form_field_component_1 = require("../components/primitives/form-field/form-field.component");
|
|
13
|
+
const data_grid_component_1 = require("../components/primitives/data-grid/data-grid.component");
|
|
14
|
+
const list_component_1 = require("../components/primitives/list/list.component");
|
|
15
|
+
const card_component_1 = require("../components/primitives/card/card.component");
|
|
16
|
+
const sidebar_component_1 = require("../components/primitives/sidebar/sidebar.component");
|
|
17
|
+
const tabs_component_1 = require("../components/primitives/tabs/tabs.component");
|
|
18
|
+
const breadcrumbs_component_1 = require("../components/primitives/breadcrumbs/breadcrumbs.component");
|
|
19
|
+
const switch_component_1 = require("../components/primitives/switch/switch.component");
|
|
20
|
+
const chip_component_1 = require("../components/primitives/chip/chip.component");
|
|
21
|
+
const text_input_component_1 = require("../components/primitives/text-input/text-input.component");
|
|
22
|
+
const button_component_1 = require("../components/primitives/button/button.component");
|
|
23
|
+
const vbox_component_1 = require("../components/primitives/vbox/vbox.component");
|
|
24
|
+
function provideOrigo9Primitives() {
|
|
25
|
+
const registryMap = new Map([
|
|
26
|
+
['Select', select_component_1.SelectComponent],
|
|
27
|
+
['Checkbox', checkbox_component_1.CheckboxComponent],
|
|
28
|
+
['RadioGroup', radio_group_component_1.RadioGroupComponent],
|
|
29
|
+
['Textarea', textarea_component_1.TextareaComponent],
|
|
30
|
+
['HBox', hbox_component_1.HBoxComponent],
|
|
31
|
+
['Label', label_component_1.LabelComponent],
|
|
32
|
+
['FormField', form_field_component_1.FormFieldComponent],
|
|
33
|
+
['DataGrid', data_grid_component_1.DataGridComponent],
|
|
34
|
+
['List', list_component_1.ListComponent],
|
|
35
|
+
['Card', card_component_1.CardComponent],
|
|
36
|
+
['Sidebar', sidebar_component_1.SidebarComponent],
|
|
37
|
+
['Tabs', tabs_component_1.TabsComponent],
|
|
38
|
+
['Breadcrumbs', breadcrumbs_component_1.BreadcrumbsComponent],
|
|
39
|
+
['Navigation', sidebar_component_1.SidebarComponent],
|
|
40
|
+
['Switch', switch_component_1.SwitchComponent],
|
|
41
|
+
['Chip', chip_component_1.ChipComponent],
|
|
42
|
+
['TextInput', text_input_component_1.TextInputComponent],
|
|
43
|
+
['Button', button_component_1.ButtonComponent],
|
|
44
|
+
['VBox', vbox_component_1.VBoxComponent],
|
|
45
|
+
['vbox', vbox_component_1.VBoxComponent], // For backward compatibility with 'vbox' in preview-root
|
|
46
|
+
]);
|
|
47
|
+
return (0, core_1.makeEnvironmentProviders)([
|
|
48
|
+
{
|
|
49
|
+
provide: renderer_tokens_1.RENDERER_REGISTRY,
|
|
50
|
+
useValue: registryMap,
|
|
51
|
+
},
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=primitives.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.provider.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/lib/primitives.provider.ts"],"names":[],"mappings":";;AAqBA,0DA8BC;AAnDD,wCAA+E;AAC/E,uDAAsD;AACtD,uFAAmF;AACnF,6FAAyF;AACzF,sGAAiG;AACjG,6FAAyF;AACzF,iFAA6E;AAC7E,oFAAgF;AAChF,mGAA8F;AAC9F,gGAA2F;AAC3F,iFAA6E;AAC7E,iFAA6E;AAC7E,0FAAsF;AACtF,iFAA6E;AAC7E,sGAAkG;AAClG,uFAAmF;AACnF,iFAA6E;AAC7E,mGAA8F;AAC9F,uFAAmF;AACnF,iFAA6E;AAE7E,SAAgB,uBAAuB;IACrC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAkB;QAC3C,CAAC,QAAQ,EAAE,kCAAe,CAAC;QAC3B,CAAC,UAAU,EAAE,sCAAiB,CAAC;QAC/B,CAAC,YAAY,EAAE,2CAAmB,CAAC;QACnC,CAAC,UAAU,EAAE,sCAAiB,CAAC;QAC/B,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,OAAO,EAAE,gCAAc,CAAC;QACzB,CAAC,WAAW,EAAE,yCAAkB,CAAC;QACjC,CAAC,UAAU,EAAE,uCAAiB,CAAC;QAC/B,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,SAAS,EAAE,oCAAgB,CAAC;QAC7B,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,aAAa,EAAE,4CAAoB,CAAC;QACrC,CAAC,YAAY,EAAE,oCAAgB,CAAC;QAChC,CAAC,QAAQ,EAAE,kCAAe,CAAC;QAC3B,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,WAAW,EAAE,yCAAkB,CAAC;QACjC,CAAC,QAAQ,EAAE,kCAAe,CAAC;QAC3B,CAAC,MAAM,EAAE,8BAAa,CAAC;QACvB,CAAC,MAAM,EAAE,8BAAa,CAAC,EAAE,yDAAyD;KACnF,CAAC,CAAC;IAEH,OAAO,IAAA,+BAAwB,EAAC;QAC9B;YACE,OAAO,EAAE,mCAAiB;YAC1B,QAAQ,EAAE,WAAW;SACtB;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ASTNode } from '@origostudio/core';
|
|
2
|
+
export declare class OrigoRendererComponent {
|
|
3
|
+
node: import("@angular/core").InputSignal<ASTNode>;
|
|
4
|
+
private registry;
|
|
5
|
+
private vc;
|
|
6
|
+
private destroyRef;
|
|
7
|
+
private adapter;
|
|
8
|
+
private renderId;
|
|
9
|
+
private isDestroyed;
|
|
10
|
+
constructor();
|
|
11
|
+
private renderTree;
|
|
12
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrigoRendererComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const renderer_tokens_1 = require("./renderer.tokens");
|
|
7
|
+
const adapter_1 = require("../adapters/web/adapter");
|
|
8
|
+
let OrigoRendererComponent = (() => {
|
|
9
|
+
let _classDecorators = [(0, core_1.Component)({
|
|
10
|
+
selector: 'origo-renderer',
|
|
11
|
+
standalone: true,
|
|
12
|
+
template: `<ng-container #vc></ng-container>`,
|
|
13
|
+
})];
|
|
14
|
+
let _classDescriptor;
|
|
15
|
+
let _classExtraInitializers = [];
|
|
16
|
+
let _classThis;
|
|
17
|
+
var OrigoRendererComponent = class {
|
|
18
|
+
static { _classThis = this; }
|
|
19
|
+
static {
|
|
20
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
21
|
+
tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
22
|
+
OrigoRendererComponent = _classThis = _classDescriptor.value;
|
|
23
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
tslib_1.__runInitializers(_classThis, _classExtraInitializers);
|
|
25
|
+
}
|
|
26
|
+
node = core_1.input.required();
|
|
27
|
+
registry = (0, core_1.inject)(renderer_tokens_1.RENDERER_REGISTRY, { optional: true }) ?? new Map();
|
|
28
|
+
vc = core_1.viewChild.required('vc', { read: core_1.ViewContainerRef });
|
|
29
|
+
destroyRef = (0, core_1.inject)(core_1.DestroyRef);
|
|
30
|
+
adapter = (0, core_1.inject)(adapter_1.AdapterPipelineService);
|
|
31
|
+
renderId = 0;
|
|
32
|
+
isDestroyed = false;
|
|
33
|
+
constructor() {
|
|
34
|
+
this.destroyRef.onDestroy(() => (this.isDestroyed = true));
|
|
35
|
+
(0, core_1.effect)(() => {
|
|
36
|
+
const n = this.node();
|
|
37
|
+
const container = this.vc();
|
|
38
|
+
const currentId = ++this.renderId;
|
|
39
|
+
container.clear();
|
|
40
|
+
if (n) {
|
|
41
|
+
this.renderTree(n, container, currentId);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async renderTree(rootNode, rootVc, traversalId) {
|
|
46
|
+
const queue = [{ node: rootNode, vc: rootVc }];
|
|
47
|
+
const CHUNK_SIZE = 50;
|
|
48
|
+
const visited = new Set();
|
|
49
|
+
while (queue.length > 0) {
|
|
50
|
+
if (this.isDestroyed || traversalId !== this.renderId)
|
|
51
|
+
return;
|
|
52
|
+
let processed = 0;
|
|
53
|
+
while (queue.length > 0 && processed < CHUNK_SIZE) {
|
|
54
|
+
const item = queue.shift();
|
|
55
|
+
if (!item)
|
|
56
|
+
continue;
|
|
57
|
+
processed++;
|
|
58
|
+
const { node, vc } = item;
|
|
59
|
+
if (visited.has(node.id))
|
|
60
|
+
continue;
|
|
61
|
+
visited.add(node.id);
|
|
62
|
+
const componentType = this.registry.get(node.type);
|
|
63
|
+
if (!componentType) {
|
|
64
|
+
console.warn(`No primitive found for node type: ${node.type}`);
|
|
65
|
+
if (node.children && node.children.length > 0) {
|
|
66
|
+
for (const child of node.children) {
|
|
67
|
+
if (child)
|
|
68
|
+
queue.push({ node: child, vc });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const componentRef = vc.createComponent(componentType);
|
|
74
|
+
// Extract optional schema/strict mode if defined on the component class
|
|
75
|
+
const schema = componentType['contractSchema'];
|
|
76
|
+
const strict = componentType['strictContract'] === true;
|
|
77
|
+
const preparedNode = this.adapter.prepareNode(node, schema, strict);
|
|
78
|
+
if ('contract' in componentRef.instance) {
|
|
79
|
+
componentRef.setInput('contract', preparedNode);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.warn(`Component for ${node.type} does not implement OrigoAdapter (missing 'contract' input).`);
|
|
83
|
+
}
|
|
84
|
+
if (node.children && node.children.length > 0) {
|
|
85
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
86
|
+
const instance = componentRef.instance;
|
|
87
|
+
let childVc = instance.vc || instance.viewContainerRef;
|
|
88
|
+
if (typeof childVc === 'function') {
|
|
89
|
+
childVc = childVc();
|
|
90
|
+
}
|
|
91
|
+
if (childVc) {
|
|
92
|
+
for (const child of node.children) {
|
|
93
|
+
if (child)
|
|
94
|
+
queue.push({ node: child, vc: childVc });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.warn(`Component for ${node.type} has children but does not expose a ViewContainerRef as 'vc'`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
componentRef.changeDetectorRef.markForCheck();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (queue.length > 0) {
|
|
106
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return OrigoRendererComponent = _classThis;
|
|
112
|
+
})();
|
|
113
|
+
exports.OrigoRendererComponent = OrigoRendererComponent;
|
|
114
|
+
//# sourceMappingURL=renderer.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.component.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/lib/renderer.component.ts"],"names":[],"mappings":";;;;AAAA,wCAQuB;AAEvB,uDAAsD;AACtD,qDAAqF;IAOxE,sBAAsB;4BALlC,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,mCAAmC;SAC9C,CAAC;;;;;;;;YACF,qLAmGC;;;YAnGY,+DAAsB;;QACjC,IAAI,GAAG,YAAK,CAAC,QAAQ,EAAW,CAAC;QACzB,QAAQ,GAAG,IAAA,aAAM,EAAC,mCAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;QACtE,EAAE,GAAG,gBAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAgB,EAAE,CAAC,CAAC;QAC1D,UAAU,GAAG,IAAA,aAAM,EAAC,iBAAU,CAAC,CAAC;QAChC,OAAO,GAAG,IAAA,aAAM,EAAC,gCAAsB,CAAC,CAAC;QACzC,QAAQ,GAAG,CAAC,CAAC;QACb,WAAW,GAAG,KAAK,CAAC;QAE5B;YACE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC;YAC3D,IAAA,aAAM,EAAC,GAAG,EAAE;gBACV,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBACtB,MAAM,SAAS,G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I,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;4BAClC,OAAO,GAAG,OAAO,EAAE,CAAC;wBACtB,CAAC;wBAED,IAAI,OAAO,EAAE,CAAC;4BACZ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gCAClC,IAAI,KAAK;oCAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;4BACtD,CAAC;wBACH,CAAC;6BAAM,CAAC;4BACN,OAAO,CAAC,IAAI,CACV,iBAAiB,IAAI,CAAC,IAAI,8DAA8D,CACzF,CAAC;wBACJ,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,YAAY,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;oBAChD,CAAC;gBACH,CAAC;gBAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;gBACvD,CAAC;YACH,CAAC;QACH,CAAC;;;;AAlGU,wDAAsB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RENDERER_REGISTRY = void 0;
|
|
4
|
+
const core_1 = require("@angular/core");
|
|
5
|
+
// Batch 1 primitives moved to primitives.provider.ts
|
|
6
|
+
exports.RENDERER_REGISTRY = new core_1.InjectionToken('RENDERER_REGISTRY', {
|
|
7
|
+
providedIn: 'root',
|
|
8
|
+
factory: () => new Map(),
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=renderer.tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.tokens.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/lib/renderer.tokens.ts"],"names":[],"mappings":";;;AAAA,wCAAqD;AAErD,qDAAqD;AAExC,QAAA,iBAAiB,GAAG,IAAI,qBAAc,CACjD,mBAAmB,EACnB;IACE,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE;CACzB,CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Provider } from '@angular/core';
|
|
2
|
+
export interface OrigoThemeOptions {
|
|
3
|
+
url?: string;
|
|
4
|
+
theme?: Record<string, unknown>;
|
|
5
|
+
targetElement?: HTMLElement | string;
|
|
6
|
+
}
|
|
7
|
+
export declare function themeInitializerFactory(optionsOrUrl: string | OrigoThemeOptions, platformId: object, document: Document | null): () => Promise<(() => void) | (() => void)> | Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Provides the Origo Design theme initialization for the Angular Web Adapter.
|
|
10
|
+
*
|
|
11
|
+
* @param optionsOrUrl URL string to the theme.json file, or an options object configuring the theme.
|
|
12
|
+
*/
|
|
13
|
+
export declare function provideOrigoTheme(optionsOrUrl: string | OrigoThemeOptions): Provider[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.themeInitializerFactory = themeInitializerFactory;
|
|
4
|
+
exports.provideOrigoTheme = provideOrigoTheme;
|
|
5
|
+
const core_1 = require("@angular/core");
|
|
6
|
+
const common_1 = require("@angular/common");
|
|
7
|
+
const runtime_1 = require("@origostudio/design-tokens/runtime");
|
|
8
|
+
function themeInitializerFactory(optionsOrUrl, platformId, document) {
|
|
9
|
+
return () => {
|
|
10
|
+
if ((0, common_1.isPlatformBrowser)(platformId)) {
|
|
11
|
+
const isString = typeof optionsOrUrl === 'string';
|
|
12
|
+
const url = isString ? optionsOrUrl : optionsOrUrl.url;
|
|
13
|
+
const theme = isString ? undefined : optionsOrUrl.theme;
|
|
14
|
+
// Resolve target element
|
|
15
|
+
let target;
|
|
16
|
+
if (!isString && typeof optionsOrUrl.targetElement === 'string') {
|
|
17
|
+
target = document?.querySelector(optionsOrUrl.targetElement);
|
|
18
|
+
if (!target) {
|
|
19
|
+
console.warn(`[origo-design] targetElement selector '${optionsOrUrl.targetElement}' matched nothing. Falling back to documentElement.`);
|
|
20
|
+
target = document ? document.documentElement : undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (!isString && optionsOrUrl.targetElement instanceof HTMLElement) {
|
|
24
|
+
target = optionsOrUrl.targetElement;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
target = document ? document.documentElement : undefined;
|
|
28
|
+
}
|
|
29
|
+
if (theme && url) {
|
|
30
|
+
const staticTeardown = (0, runtime_1.injectTheme)(theme, target);
|
|
31
|
+
return (0, runtime_1.loadAndInjectTheme)(url, target)
|
|
32
|
+
.then(fetchTeardown => {
|
|
33
|
+
return () => {
|
|
34
|
+
if (typeof staticTeardown === 'function')
|
|
35
|
+
staticTeardown();
|
|
36
|
+
fetchTeardown();
|
|
37
|
+
};
|
|
38
|
+
})
|
|
39
|
+
.catch(e => {
|
|
40
|
+
console.error('[origo-design] theme init failed', e);
|
|
41
|
+
return typeof staticTeardown === 'function' ? staticTeardown : () => undefined;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else if (theme) {
|
|
45
|
+
const teardown = (0, runtime_1.injectTheme)(theme, target);
|
|
46
|
+
return Promise.resolve(typeof teardown === 'function' ? teardown : () => undefined);
|
|
47
|
+
}
|
|
48
|
+
else if (url) {
|
|
49
|
+
return (0, runtime_1.loadAndInjectTheme)(url, target).catch(e => {
|
|
50
|
+
console.error('[origo-design] theme init failed', e);
|
|
51
|
+
return () => undefined;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.warn('[origo-design] options provided with neither theme nor url');
|
|
56
|
+
return Promise.resolve(() => undefined);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return Promise.resolve();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Provides the Origo Design theme initialization for the Angular Web Adapter.
|
|
64
|
+
*
|
|
65
|
+
* @param optionsOrUrl URL string to the theme.json file, or an options object configuring the theme.
|
|
66
|
+
*/
|
|
67
|
+
function provideOrigoTheme(optionsOrUrl) {
|
|
68
|
+
return [
|
|
69
|
+
{
|
|
70
|
+
provide: core_1.APP_INITIALIZER,
|
|
71
|
+
useFactory: (platformId, document) => themeInitializerFactory(optionsOrUrl, platformId, document),
|
|
72
|
+
deps: [core_1.PLATFORM_ID, [new core_1.Optional(), common_1.DOCUMENT]],
|
|
73
|
+
multi: true,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=theme.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.provider.js","sourceRoot":"","sources":["../../../../../packages/angular-renderer/src/lib/theme.provider.ts"],"names":[],"mappings":";;AAWA,0DAsDC;AAOD,8CAUC;AAlFD,wCAAiF;AACjF,4CAA8D;AAE9D,gEAAqF;AAQrF,SAAgB,uBAAuB,CACrC,YAAwC,EACxC,UAAkB,EAClB,QAAyB;IAEzB,OAAO,GAAG,EAAE;QACV,IAAI,IAAA,0BAAiB,EAAC,UAAU,CAAC,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC;YAClD,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC;YACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC;YACxD,yBAAyB;YACzB,IAAI,MAA+B,CAAC;YACpC,IAAI,CAAC,QAAQ,IAAI,OAAO,YAAY,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;gBAChE,MAAM,GAAG,Q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