@appaflytech/zeyrek-ai-mcp 0.0.36 → 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/.env.example +15 -0
- package/README.md +5 -5
- package/dist/config.js +37 -0
- package/dist/index.js +2 -0
- package/dist/knowledge/access.js +802 -0
- package/dist/knowledge/backendConstraints.js +18 -1
- package/dist/knowledge/case.js +41 -0
- package/dist/knowledge/componentCatalog.js +524 -53
- package/dist/knowledge/componentEvents.js +132 -7
- package/dist/knowledge/connectDataBind.js +851 -0
- package/dist/knowledge/connectDataDefinition.js +344 -0
- package/dist/knowledge/connectDataExecute.js +93 -0
- package/dist/knowledge/connectDataRules.js +128 -0
- package/dist/knowledge/decision.js +121 -0
- package/dist/knowledge/expressionPrelude.js +60 -0
- package/dist/knowledge/layoutSummary.js +140 -2
- package/dist/knowledge/microserviceParameters.js +58 -0
- package/dist/knowledge/mining.js +94 -0
- package/dist/knowledge/mobileComponentCatalog.js +876 -0
- package/dist/knowledge/mobileComponentEvents.js +259 -0
- package/dist/knowledge/mobileStore.js +396 -0
- package/dist/knowledge/normalize.js +240 -72
- package/dist/knowledge/outlines.js +36 -0
- package/dist/knowledge/platform/lint.js +385 -0
- package/dist/knowledge/platform/mobile.js +142 -0
- package/dist/knowledge/platform/mobileLayoutLint.js +324 -0
- package/dist/knowledge/platform/mobileRules.js +231 -0
- package/dist/knowledge/platform/mobileSpacing.js +82 -0
- package/dist/knowledge/platform/mobileTabs.js +108 -0
- package/dist/knowledge/platform/nativeBoxModel.js +44 -0
- package/dist/knowledge/platform/profile.js +25 -0
- package/dist/knowledge/platform/resolve.js +122 -0
- package/dist/knowledge/platform/web.js +39 -0
- package/dist/knowledge/policy.js +18 -4
- package/dist/knowledge/process.js +510 -0
- package/dist/knowledge/reservedTables.js +79 -0
- package/dist/knowledge/rowFilter.js +43 -0
- package/dist/knowledge/rules.js +485 -22
- package/dist/knowledge/schemaGuard.js +11 -0
- package/dist/knowledge/styleResolve.js +64 -10
- package/dist/knowledge/styleResolveNative.js +529 -0
- package/dist/knowledge/themeResolve.js +3 -3
- package/dist/observability/trace.js +13 -5
- package/dist/platform/argumentAliases.js +128 -0
- package/dist/platform/bodyFile.js +103 -0
- package/dist/platform/capture/actions.js +398 -0
- package/dist/platform/capture/browser.js +1 -0
- package/dist/platform/capture/capture.js +683 -0
- package/dist/platform/capture/console-log.js +122 -0
- package/dist/platform/capture/index.js +11 -0
- package/dist/platform/capture/readiness.js +103 -0
- package/dist/platform/capture/summary.js +77 -0
- package/dist/platform/capture/target.js +5 -0
- package/dist/platform/capture/targets/studio-mobile.js +15 -0
- package/dist/platform/capture/targets/studio-web.js +5 -0
- package/dist/platform/diagnostics.js +10 -4
- package/dist/platform/domSummary.js +1 -1
- package/dist/platform/errors.js +163 -10
- package/dist/platform/http.js +29 -8
- package/dist/platform/impersonation.js +45 -0
- package/dist/platform/jsonArray.js +24 -0
- package/dist/platform/responses.js +39 -5
- package/dist/platform/schemaReadMemory.js +60 -0
- package/dist/platform/secrets.js +68 -2
- package/dist/platform/strictArguments.js +68 -12
- package/dist/platform/tokenVault.js +187 -4
- package/dist/resources/examples/bpm-gorev-kontrol.json +294 -0
- package/dist/resources/examples/bpm-iso-dokuman.json +228 -0
- package/dist/resources/examples/bpm-satinalma.json +376 -0
- package/dist/resources/examples/connect-data-convert-verify.json +107 -0
- package/dist/resources/examples/connect-data-dropdown-roles.json +66 -0
- package/dist/resources/examples/connect-data-edit-m2m.json +73 -0
- package/dist/resources/examples/connect-data-query-params.json +50 -0
- package/dist/resources/examples/connect-data-table-entity.json +147 -0
- package/dist/resources/examples/connect-data-workflow-microservice.json +65 -0
- package/dist/resources/examples/middleware-authenticate.json +1 -1
- package/dist/resources/examples/mobile-app-shell-drawer.json +244 -0
- package/dist/resources/examples/mobile-app-shell-stack.json +157 -0
- package/dist/resources/examples/mobile-app-shell-tab.json +208 -0
- package/dist/resources/examples/mobile-form-screen.json +365 -0
- package/dist/resources/examples/mobile-list-detail-form.json +703 -0
- package/dist/resources/examples/page-detail-profile.json +2 -1
- package/dist/resources/examples/page-dynamic-form.json +3 -2
- package/dist/resources/examples/page-flex-sections.json +1 -1
- package/dist/resources/examples/page-html-embed.json +1 -1
- package/dist/resources/examples/workflow-basic.json +8 -2
- package/dist/resources/guides/access.md +810 -0
- package/dist/resources/guides/bpm.md +691 -0
- package/dist/resources/guides/case.md +153 -0
- package/dist/resources/guides/component.md +92 -5
- package/dist/resources/guides/decision.md +185 -0
- package/dist/resources/guides/entity.md +50 -8
- package/dist/resources/guides/expressions.md +14 -5
- package/dist/resources/guides/functions.md +1 -1
- package/dist/resources/guides/getting-started.md +38 -1
- package/dist/resources/guides/layout.md +11 -7
- package/dist/resources/guides/merge.md +42 -7
- package/dist/resources/guides/microservice.md +88 -3
- package/dist/resources/guides/middleware.md +69 -5
- package/dist/resources/guides/mobile-layout.md +193 -0
- package/dist/resources/guides/mobile-publish.md +148 -0
- package/dist/resources/guides/mobile.md +565 -0
- package/dist/resources/guides/page.md +469 -82
- package/dist/resources/guides/theme.md +8 -2
- package/dist/resources/guides/translation.md +1 -1
- package/dist/resources/guides/workflow.md +58 -1
- package/dist/resources/read.js +41 -0
- package/dist/resources/rules.js +11 -5
- package/dist/resources/schema-fingerprint.json +7 -5
- package/dist/resources/schemas/AccessExplanationDto.json +144 -0
- package/dist/resources/schemas/AccessMatrixDto.json +170 -0
- package/dist/resources/schemas/AccessPermissionDto.json +57 -0
- package/dist/resources/schemas/AccessPolicyDto.json +223 -0
- package/dist/resources/schemas/AccessResourceDto.json +86 -0
- package/dist/resources/schemas/AppSessionDto.json +53 -0
- package/dist/resources/schemas/ConnectDataDescribeDto.json +344 -0
- package/dist/resources/schemas/ConnectDataRequestModel.json +202 -0
- package/dist/resources/schemas/ConnectDataResultDto.json +421 -0
- package/dist/resources/schemas/ConnectorCredentialDto.json +70 -0
- package/dist/resources/schemas/ConvertConnectDataToMicroserviceCommand.json +37 -0
- package/dist/resources/schemas/CreateAccessPolicyCommand.json +209 -0
- package/dist/resources/schemas/CreateDecisionCommand.json +221 -0
- package/dist/resources/schemas/CreateEntityCommand.json +118 -0
- package/dist/resources/schemas/CreateMicroserviceCommand.json +13 -1
- package/dist/resources/schemas/CreateProcessDefinitionCommand.json +1337 -0
- package/dist/resources/schemas/CreateQueryCommand.json +4 -0
- package/dist/resources/schemas/CreateWorkflowCommand.json +146 -1
- package/dist/resources/schemas/DataJobDto.json +6 -1
- package/dist/resources/schemas/DecisionDto.json +302 -0
- package/dist/resources/schemas/DetachConnectDataMicroserviceCommand.json +28 -0
- package/dist/resources/schemas/ExplainAccessQuery.json +33 -0
- package/dist/resources/schemas/GenerateProcessDocumentCommand.json +116 -0
- package/dist/resources/schemas/GlobalFunctionUpdateResultDto.json +24 -0
- package/dist/resources/schemas/MicroserviceDto.json +15 -3
- package/dist/resources/schemas/OrganizationProjectDto.json +343 -0
- package/dist/resources/schemas/OrganizationSchemaDto.json +196 -0
- package/dist/resources/schemas/OrganizationSchemaVersionDto.json +207 -0
- package/dist/resources/schemas/PatchProcessDefinitionCommand.json +76 -0
- package/dist/resources/schemas/PreviewMicroserviceCommand.json +10 -1
- package/dist/resources/schemas/PreviewWorkflowCommand.json +25 -1
- package/dist/resources/schemas/ProcessDefinitionDto.json +1480 -0
- package/dist/resources/schemas/ProcessSimulationDto.json +96 -0
- package/dist/resources/schemas/SaveConnectorCredentialCommand.json +90 -0
- package/dist/resources/schemas/SaveProcessEventSourceCommand.json +61 -0
- package/dist/resources/schemas/SaveProcessMailSourceCommand.json +89 -0
- package/dist/resources/schemas/SignProcessTaskCommand.json +73 -0
- package/dist/resources/schemas/SimulateProcessDefinitionQuery.json +92 -0
- package/dist/resources/schemas/StartMobileBuildCommand.json +54 -0
- package/dist/resources/schemas/StepDto.json +25 -1
- package/dist/resources/schemas/UpdateAccessPolicyCommand.json +209 -0
- package/dist/resources/schemas/UpdateDecisionCommand.json +216 -0
- package/dist/resources/schemas/UpdateEntityCommand.json +118 -0
- package/dist/resources/schemas/UpdateMicroserviceCommand.json +13 -1
- package/dist/resources/schemas/UpdateProcessDefinitionCommand.json +1357 -0
- package/dist/resources/schemas/UpdateQueryCommand.json +4 -0
- package/dist/resources/schemas/UpdateViewCommand.json +0 -2
- package/dist/resources/schemas/UpdateWorkflowCommand.json +146 -1
- package/dist/resources/schemas/UpsertMobileStoreSettingsCommand.json +333 -0
- package/dist/resources/schemas/ValidateProcessDefinitionQuery.json +1339 -0
- package/dist/server.js +31 -1
- package/dist/tools/access.js +369 -2
- package/dist/tools/accessOperations.js +135 -0
- package/dist/tools/accessPolicies.js +170 -0
- package/dist/tools/accessRuntime.js +203 -0
- package/dist/tools/applications.js +63 -3
- package/dist/tools/bpm.js +343 -0
- package/dist/tools/bpmGovernance.js +266 -0
- package/dist/tools/bpmOperations.js +230 -0
- package/dist/tools/bpmReporting.js +154 -0
- package/dist/tools/bpmRouting.js +150 -0
- package/dist/tools/bpmRuntime.js +396 -0
- package/dist/tools/case.js +178 -0
- package/dist/tools/caseRuntime.js +89 -0
- package/dist/tools/common.js +19 -6
- package/dist/tools/components.js +118 -14
- package/dist/tools/connectData.js +450 -0
- package/dist/tools/connectors.js +193 -0
- package/dist/tools/datasources.js +3 -3
- package/dist/tools/decisions.js +206 -0
- package/dist/tools/dependencies.js +1 -1
- package/dist/tools/deployments.js +38 -3
- package/dist/tools/designSchemaPatch.js +34 -9
- package/dist/tools/dtos.js +36 -5
- package/dist/tools/entities.js +79 -12
- package/dist/tools/environments.js +1 -1
- package/dist/tools/externalComponents.js +26 -5
- package/dist/tools/flows.js +119 -13
- package/dist/tools/folders.js +1 -1
- package/dist/tools/imports.js +5 -2
- package/dist/tools/layouts.js +50 -17
- package/dist/tools/merges.js +2 -2
- package/dist/tools/microservices.js +77 -25
- package/dist/tools/mobile.js +280 -0
- package/dist/tools/mobileStore.js +572 -0
- package/dist/tools/modules.js +48 -0
- package/dist/tools/organizationStructure.js +137 -0
- package/dist/tools/pages.js +467 -100
- package/dist/tools/platformInfo.js +28 -8
- package/dist/tools/profileWrite.js +92 -0
- package/dist/tools/projects.js +71 -9
- package/dist/tools/rows.js +69 -13
- package/dist/tools/schemaOps.js +61 -1
- package/dist/tools/screenWrite.js +36 -7
- package/dist/tools/screens.js +95 -5
- package/dist/tools/templates.js +26 -1
- package/dist/tools/translations.js +1 -1
- package/dist/tools/variables.js +11 -5
- package/dist/tools/workflows.js +10 -5
- package/package.json +2 -2
- package/dist/platform/screenshot.js +0 -1162
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
import { TRANSFORM_RANGES, rawProp, resolveNodeStyleLayers, transformValue } from './styleResolve.js';
|
|
2
|
+
import { mergeTypeScale, resolveTheme } from './themeResolve.js';
|
|
3
|
+
/* ---- css-value.ts ---- */
|
|
4
|
+
const warn = (context, message) => {
|
|
5
|
+
context?.warnings?.push(message);
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
8
|
+
export function parseLength(value, context) {
|
|
9
|
+
if (value === undefined || value === null || value === '')
|
|
10
|
+
return null;
|
|
11
|
+
if (typeof value === 'number')
|
|
12
|
+
return Number.isFinite(value) ? value : null;
|
|
13
|
+
const text = String(value).trim();
|
|
14
|
+
if (!text)
|
|
15
|
+
return null;
|
|
16
|
+
const numeric = Number(text);
|
|
17
|
+
if (Number.isFinite(numeric))
|
|
18
|
+
return numeric;
|
|
19
|
+
if (text.endsWith('%')) {
|
|
20
|
+
const percent = Number(text.slice(0, -1));
|
|
21
|
+
return Number.isFinite(percent) ? `${percent}%` : null;
|
|
22
|
+
}
|
|
23
|
+
const unit = /^(-?[\d.]+)(px|em|rem)$/.exec(text);
|
|
24
|
+
if (unit) {
|
|
25
|
+
const amount = Number(unit[1]);
|
|
26
|
+
if (!Number.isFinite(amount))
|
|
27
|
+
return null;
|
|
28
|
+
if (unit[2] === 'px')
|
|
29
|
+
return amount;
|
|
30
|
+
const base = unit[2] === 'em' ? context?.base ?? context?.root : context?.root;
|
|
31
|
+
if (base === undefined)
|
|
32
|
+
return warn(context, `${text}: em/rem tabanı yok, değer atlandı`);
|
|
33
|
+
return Math.round(amount * base * 1000) / 1000;
|
|
34
|
+
}
|
|
35
|
+
return warn(context, `${text}: React Native'de karşılığı olmayan uzunluk`);
|
|
36
|
+
}
|
|
37
|
+
export function parsePanelLength(value, context) {
|
|
38
|
+
if (typeof value === 'number' && value === 0)
|
|
39
|
+
return null;
|
|
40
|
+
return parseLength(value, context);
|
|
41
|
+
}
|
|
42
|
+
export function parseFontFamily(value) {
|
|
43
|
+
if (value === undefined || value === null || value === '')
|
|
44
|
+
return null;
|
|
45
|
+
const first = String(value).split(',')[0].trim().replace(/^["']|["']$/g, '');
|
|
46
|
+
return first || null;
|
|
47
|
+
}
|
|
48
|
+
const GENERIC_FONT_FAMILIES = new Set([
|
|
49
|
+
'serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui',
|
|
50
|
+
'ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded', 'emoji', 'math', 'fangsong'
|
|
51
|
+
]);
|
|
52
|
+
/** CSS generik ailesi mi (`sans-serif`, `monospace`…) — tırnaklanırsa aile adı sanılır. */
|
|
53
|
+
export function isGenericFontFamily(name) {
|
|
54
|
+
return GENERIC_FONT_FAMILIES.has(name.trim().toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Yığının yedek generiği: son generik ad, yoksa `sans-serif`. Temanın yığını `"Figtree",
|
|
58
|
+
* sans-serif` biçimindedir; tek ad yazılan `typographyStyle` yedeğini buradan miras alır (ZM-10).
|
|
59
|
+
*/
|
|
60
|
+
export function fontFallback(stack) {
|
|
61
|
+
const generic = String(stack ?? '').split(',').map(part => part.trim().replace(/^["']|["']$/g, '')).filter(isGenericFontFamily).pop();
|
|
62
|
+
return generic ?? 'sans-serif';
|
|
63
|
+
}
|
|
64
|
+
/** Yığının yalın ilk adı (tırnaksız); yükleyicinin istediği ad budur (ZM-10, f-05). */
|
|
65
|
+
export function firstFontFamily(value) {
|
|
66
|
+
return parseFontFamily(value) ?? '';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Font adı platforma göre çözülür (ZM-10, K3). Frontend'de bu WEB/cihaz diye ikiye ayrılır
|
|
70
|
+
* (`font-family.ts` / `font-family.native.ts`, Metro `.native`'i seçer) ama bu ayna TEK koldur:
|
|
71
|
+
* `test/style-resolve-native.test.ts` frontend'in `theme-native.ts`'ini düz Node `import()` ile
|
|
72
|
+
* okur ve Node/Vite çözümü platform uzantısını (`.native.ts`) hiç görmez — parite testinin
|
|
73
|
+
* kıyasladığı gerçek davranış bu yüzden HER ZAMAN web kolu (`font-family.ts`); cihazdaki yalın-ad
|
|
74
|
+
* davranışı yalnız Metro bundle'ında oluşur ve bu aynanın kapsamı dışındadır (g-02 parity fix).
|
|
75
|
+
* Tek ad generik yedeksiz kalırsa RN web'de font yüklenemediğinde tarayıcı varsayılanı (Times)
|
|
76
|
+
* çizilir; bu yüzden tek ad tırnaklanıp temanın generiğiyle yığına çevrilir, yazarın kendi yığını
|
|
77
|
+
* (virgüllü) aynen geçer.
|
|
78
|
+
*/
|
|
79
|
+
export function resolveFontFamily(value, fallback) {
|
|
80
|
+
const text = value.trim();
|
|
81
|
+
if (text === '' || text.includes(','))
|
|
82
|
+
return text;
|
|
83
|
+
const name = firstFontFamily(text);
|
|
84
|
+
if (isGenericFontFamily(name))
|
|
85
|
+
return name;
|
|
86
|
+
return `"${name}", ${fallback}`;
|
|
87
|
+
}
|
|
88
|
+
export function parseLineHeight(value, fontSize, context) {
|
|
89
|
+
if (value === undefined || value === null || value === '')
|
|
90
|
+
return null;
|
|
91
|
+
const text = String(value).trim();
|
|
92
|
+
const numeric = Number(text);
|
|
93
|
+
const base = fontSize ?? context?.base ?? context?.root;
|
|
94
|
+
if (Number.isFinite(numeric)) {
|
|
95
|
+
if (numeric <= 0)
|
|
96
|
+
return null;
|
|
97
|
+
const ratio = numeric >= 4 ? numeric / 100 : numeric;
|
|
98
|
+
if (base === undefined)
|
|
99
|
+
return warn(context, `lineHeight ${text}: punto bilinmiyor, atlandı`);
|
|
100
|
+
return Math.round(ratio * base * 1000) / 1000;
|
|
101
|
+
}
|
|
102
|
+
if (text.endsWith('%')) {
|
|
103
|
+
const percent = Number(text.slice(0, -1));
|
|
104
|
+
if (!Number.isFinite(percent) || base === undefined)
|
|
105
|
+
return warn(context, `lineHeight ${text}: punto bilinmiyor, atlandı`);
|
|
106
|
+
return Math.round((percent / 100) * base * 1000) / 1000;
|
|
107
|
+
}
|
|
108
|
+
const length = parseLength(text, context);
|
|
109
|
+
return typeof length === 'number' ? length : null;
|
|
110
|
+
}
|
|
111
|
+
export function parseOpacity(value) {
|
|
112
|
+
if (value === undefined || value === null || value === '')
|
|
113
|
+
return null;
|
|
114
|
+
const amount = Number(value);
|
|
115
|
+
if (!Number.isFinite(amount) || amount < 0 || amount >= 100)
|
|
116
|
+
return null;
|
|
117
|
+
return Math.round((amount / 100) * 1000) / 1000;
|
|
118
|
+
}
|
|
119
|
+
export function parseBorderShorthand(value, context) {
|
|
120
|
+
if (value === undefined || value === null || value === '')
|
|
121
|
+
return null;
|
|
122
|
+
const text = String(value).trim();
|
|
123
|
+
if (!text || text === 'none')
|
|
124
|
+
return { width: 0, style: 'solid' };
|
|
125
|
+
const parts = text.split(/\s+(?![^(]*\))/);
|
|
126
|
+
const width = parseLength(parts[0], context);
|
|
127
|
+
if (typeof width !== 'number')
|
|
128
|
+
return warn(context, `${text}: kenarlık genişliği çözülemedi`);
|
|
129
|
+
const style = parts.find(part => /^(solid|dashed|dotted)$/.test(part)) ?? 'solid';
|
|
130
|
+
const color = parts.find(part => part !== parts[0] && !/^(solid|dashed|dotted)$/.test(part));
|
|
131
|
+
return { width, style, ...(color ? { color } : {}) };
|
|
132
|
+
}
|
|
133
|
+
/* ---- theme-native.ts ---- */
|
|
134
|
+
const camelize = (name) => name.replace(/^--ng-/, '').replace(/-([a-z0-9])/g, (_, character) => character.toUpperCase());
|
|
135
|
+
const hexToRgb = (hex) => {
|
|
136
|
+
const match = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
|
|
137
|
+
if (!match)
|
|
138
|
+
return null;
|
|
139
|
+
const digits = match[1].length === 3 ? match[1].split('').map(digit => digit + digit).join('') : match[1];
|
|
140
|
+
const value = parseInt(digits, 16);
|
|
141
|
+
return [(value >> 16) & 255, (value >> 8) & 255, value & 255];
|
|
142
|
+
};
|
|
143
|
+
const toHex = (channel) => Math.round(Math.max(0, Math.min(255, channel))).toString(16).padStart(2, '0');
|
|
144
|
+
const NAMED_COLORS = { white: '#ffffff', black: '#000000' };
|
|
145
|
+
const resolveColorMix = (value) => {
|
|
146
|
+
const match = /^color-mix\(\s*in\s+srgb\s*,\s*([^,]+?)\s+([\d.]+)%\s*,\s*([^)]+?)\s*\)$/i.exec(value.trim());
|
|
147
|
+
if (!match)
|
|
148
|
+
return value;
|
|
149
|
+
const [, rawFrom = '', percent = '0', rawTo = ''] = match;
|
|
150
|
+
const from = hexToRgb(NAMED_COLORS[rawFrom.trim()] ?? rawFrom);
|
|
151
|
+
const to = hexToRgb(NAMED_COLORS[rawTo.trim()] ?? rawTo);
|
|
152
|
+
if (!from || !to)
|
|
153
|
+
return rawFrom.trim();
|
|
154
|
+
const weight = Number(percent) / 100;
|
|
155
|
+
const mixed = from.map((channel, index) => channel * weight + to[index] * (1 - weight));
|
|
156
|
+
return `#${mixed.map(toHex).join('')}`;
|
|
157
|
+
};
|
|
158
|
+
const CALC_UNIT = /^(-?[\d.]+)([a-z%]*)$/;
|
|
159
|
+
const evaluateCalc = (value) => {
|
|
160
|
+
let result = value;
|
|
161
|
+
while (true) {
|
|
162
|
+
const match = /calc\(([^()]*)\)/.exec(result);
|
|
163
|
+
if (!match)
|
|
164
|
+
return result;
|
|
165
|
+
const [left, operator = '', right] = match[1].trim().split(/\s+/);
|
|
166
|
+
const leftParts = CALC_UNIT.exec(left ?? '');
|
|
167
|
+
const rightAmount = Number(right);
|
|
168
|
+
if (!leftParts || !Number.isFinite(rightAmount) || !'*/'.includes(operator)) {
|
|
169
|
+
result = result.replace(match[0], match[1].trim());
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
const amount = operator === '*' ? Number(leftParts[1]) * rightAmount : Number(leftParts[1]) / rightAmount;
|
|
173
|
+
result = result.replace(match[0], `${Math.round(amount * 1000) / 1000}${leftParts[2]}`);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const resolveVars = (raw) => {
|
|
177
|
+
const resolved = {};
|
|
178
|
+
const expand = (value, seen) => {
|
|
179
|
+
const expanded = value.replace(/var\((--[a-z0-9-]+)(?:\s*,\s*([^)]+))?\)/g, (whole, name, fallback) => {
|
|
180
|
+
if (seen.has(name))
|
|
181
|
+
return whole;
|
|
182
|
+
const target = raw[name];
|
|
183
|
+
if (target === undefined)
|
|
184
|
+
return fallback?.trim() ?? whole;
|
|
185
|
+
return expand(target, new Set([...seen, name]));
|
|
186
|
+
});
|
|
187
|
+
return resolveColorMix(evaluateCalc(expanded));
|
|
188
|
+
};
|
|
189
|
+
for (const [name, value] of Object.entries(raw))
|
|
190
|
+
resolved[name] = expand(value, new Set([name]));
|
|
191
|
+
return resolved;
|
|
192
|
+
};
|
|
193
|
+
const px = (value, fallback) => {
|
|
194
|
+
if (!value)
|
|
195
|
+
return fallback;
|
|
196
|
+
const amount = Number(String(value).replace(/px$/, ''));
|
|
197
|
+
return Number.isFinite(amount) ? amount : fallback;
|
|
198
|
+
};
|
|
199
|
+
export function parseShadow(css) {
|
|
200
|
+
if (!css || css === 'none')
|
|
201
|
+
return {};
|
|
202
|
+
const color = /rgba?\(([^)]+)\)/.exec(css);
|
|
203
|
+
const lengths = css.replace(/rgba?\([^)]+\)/, '').trim().split(/\s+/)
|
|
204
|
+
.map(part => Number(part.replace(/px$/, '')))
|
|
205
|
+
.filter(part => Number.isFinite(part));
|
|
206
|
+
const [offsetX = 0, offsetY = 0, blur = 0] = lengths;
|
|
207
|
+
const channels = color?.[1].split(',').map(part => Number(part.trim())) ?? [];
|
|
208
|
+
const [red = 0, green = 0, blue = 0, alpha = 1] = channels;
|
|
209
|
+
return {
|
|
210
|
+
shadowColor: `#${toHex(red)}${toHex(green)}${toHex(blue)}`,
|
|
211
|
+
shadowOffset: { width: offsetX, height: offsetY },
|
|
212
|
+
shadowOpacity: alpha,
|
|
213
|
+
shadowRadius: blur,
|
|
214
|
+
elevation: Math.round(blur / 2)
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Proje temasının mobil karşılığı. Frontend `resolveThemeNative(overrides, mode = 'light')` ile
|
|
219
|
+
* aynı: mod çağırandan gelir, temanın kendi `mode` alanı okunmaz (runtime da okumuyor).
|
|
220
|
+
*/
|
|
221
|
+
export function resolveThemeNative(theme, mode = 'light') {
|
|
222
|
+
const resolvedTheme = resolveTheme(theme, mode);
|
|
223
|
+
const vars = resolveVars(resolvedTheme.cssVars);
|
|
224
|
+
const tokens = resolvedTheme.tokens;
|
|
225
|
+
const colors = {};
|
|
226
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
227
|
+
if (/^(#|rgb|hsl)/.test(value))
|
|
228
|
+
colors[camelize(name)] = value;
|
|
229
|
+
}
|
|
230
|
+
const fontSize = px(vars['--ng-font-size'], 14);
|
|
231
|
+
const spacingBase = px(vars['--ng-spacing'], 10);
|
|
232
|
+
const spacing = { base: spacingBase };
|
|
233
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
234
|
+
const level = /^--ng-spacing-([a-z]+)$/.exec(name);
|
|
235
|
+
if (level)
|
|
236
|
+
spacing[level[1]] = px(value, spacingBase);
|
|
237
|
+
}
|
|
238
|
+
const scale = {};
|
|
239
|
+
for (const level of Object.keys(mergeTypeScale(tokens.typeScale))) {
|
|
240
|
+
scale[level] = px(vars[`--ng-font-size-${level}`], fontSize);
|
|
241
|
+
const narrow = vars[`--ng-font-size-${level}-mobile`];
|
|
242
|
+
if (narrow)
|
|
243
|
+
scale[`${level}Mobile`] = px(narrow, fontSize);
|
|
244
|
+
}
|
|
245
|
+
const bodyStack = vars['--ng-font'] ?? tokens.fontFamily;
|
|
246
|
+
const headingStack = vars['--ng-font-heading'] ?? bodyStack;
|
|
247
|
+
const fallback = fontFallback(bodyStack);
|
|
248
|
+
return {
|
|
249
|
+
mode,
|
|
250
|
+
vars,
|
|
251
|
+
colors,
|
|
252
|
+
spacing,
|
|
253
|
+
radius: {
|
|
254
|
+
sm: px(vars['--ng-radius-sm'], 2),
|
|
255
|
+
md: px(vars['--ng-radius-md'], 4),
|
|
256
|
+
lg: px(vars['--ng-radius-lg'], 12),
|
|
257
|
+
pill: px(vars['--ng-radius-pill'], 999)
|
|
258
|
+
},
|
|
259
|
+
font: {
|
|
260
|
+
family: resolveFontFamily(bodyStack, fallback),
|
|
261
|
+
headingFamily: resolveFontFamily(headingStack, fallback),
|
|
262
|
+
source: firstFontFamily(bodyStack),
|
|
263
|
+
headingSource: firstFontFamily(headingStack),
|
|
264
|
+
fallback,
|
|
265
|
+
size: fontSize,
|
|
266
|
+
weight: vars['--ng-font-weight'] ?? tokens.fontWeight,
|
|
267
|
+
scale
|
|
268
|
+
},
|
|
269
|
+
shadow: {
|
|
270
|
+
none: {},
|
|
271
|
+
sm: parseShadow(vars['--ng-shadow-sm']),
|
|
272
|
+
md: parseShadow(vars['--ng-shadow-md']),
|
|
273
|
+
lg: parseShadow(vars['--ng-shadow-lg'])
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/* ---- compose-native-style.ts ---- */
|
|
278
|
+
const TEXT_KEYS = new Set(['color', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'letterSpacing', 'lineHeight', 'textAlign', 'textDecorationLine', 'textTransform']);
|
|
279
|
+
const RENAMED_KEYS = { background: 'backgroundColor', textDecoration: 'textDecorationLine' };
|
|
280
|
+
const IGNORED_KEYS = new Set(['boxShadow', 'transition', 'cursor', 'boxSizing', 'whiteSpace', 'wordBreak', 'textOverflow', 'backdropFilter', 'filter']);
|
|
281
|
+
const isPlainObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
282
|
+
const isSet = (value) => value !== undefined && value !== null && value !== '' && !(typeof value === 'string' && value.includes('{{'));
|
|
283
|
+
export function resolveThemeToken(value, theme) {
|
|
284
|
+
return value.replace(/var\((--[a-z0-9-]+)(?:\s*,\s*([^)]+))?\)/g, (whole, name, fallback) => theme.vars[name] ?? fallback?.trim() ?? whole);
|
|
285
|
+
}
|
|
286
|
+
const UNRESOLVED_TOKEN = /var\(\s*(--[a-z0-9-]+)\s*\)/;
|
|
287
|
+
/** Frontend `compose-native-style.ts` `asText` aynası: çözülemeyen yedeksiz jeton yazılmaz, uyarıya düşer (K37-c). */
|
|
288
|
+
const asText = (value, theme, warnings, field) => {
|
|
289
|
+
if (!isSet(value))
|
|
290
|
+
return undefined;
|
|
291
|
+
const resolved = resolveThemeToken(String(value), theme);
|
|
292
|
+
const unresolved = UNRESOLVED_TOKEN.exec(resolved);
|
|
293
|
+
if (!unresolved)
|
|
294
|
+
return resolved;
|
|
295
|
+
warnings?.push(`${field ?? 'değer'}: tanımsız tema jetonu ${unresolved[1]}, atlandı`);
|
|
296
|
+
return undefined;
|
|
297
|
+
};
|
|
298
|
+
const composeRadius = (value, shell, theme, context) => {
|
|
299
|
+
if (!isSet(value))
|
|
300
|
+
return;
|
|
301
|
+
const preset = theme.radius[String(value)];
|
|
302
|
+
if (preset !== undefined) {
|
|
303
|
+
shell.borderRadius = preset;
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const parts = resolveThemeToken(String(value), theme).trim().split(/\s+/);
|
|
307
|
+
if (parts.length === 1) {
|
|
308
|
+
const radius = parsePanelLength(parts[0], context);
|
|
309
|
+
if (typeof radius === 'number')
|
|
310
|
+
shell.borderRadius = radius;
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const corners = ['borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomRightRadius', 'borderBottomLeftRadius'];
|
|
314
|
+
corners.forEach((corner, index) => {
|
|
315
|
+
const radius = parseLength(parts[index] ?? parts[index % parts.length], context);
|
|
316
|
+
if (typeof radius === 'number')
|
|
317
|
+
shell[corner] = radius;
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
const composeBorders = (surface, shell, theme, context) => {
|
|
321
|
+
const sides = [
|
|
322
|
+
['borderTop', 'borderTopWidth', 'borderTopColor'],
|
|
323
|
+
['borderRight', 'borderRightWidth', 'borderRightColor'],
|
|
324
|
+
['borderBottom', 'borderBottomWidth', 'borderBottomColor'],
|
|
325
|
+
['borderLeft', 'borderLeftWidth', 'borderLeftColor']
|
|
326
|
+
];
|
|
327
|
+
let wrote = false;
|
|
328
|
+
for (const [field, widthKey, colorKey] of sides) {
|
|
329
|
+
if (!isSet(surface[field]))
|
|
330
|
+
continue;
|
|
331
|
+
const border = parseBorderShorthand(resolveThemeToken(String(surface[field]), theme), context);
|
|
332
|
+
if (!border)
|
|
333
|
+
continue;
|
|
334
|
+
wrote = true;
|
|
335
|
+
shell[widthKey] = border.width;
|
|
336
|
+
if (border.color)
|
|
337
|
+
shell[colorKey] = border.color;
|
|
338
|
+
if (border.style !== 'solid' && !shell.borderStyle)
|
|
339
|
+
shell.borderStyle = border.style;
|
|
340
|
+
}
|
|
341
|
+
if (wrote)
|
|
342
|
+
return;
|
|
343
|
+
const width = Number(surface.borderWidth);
|
|
344
|
+
const color = asText(surface.borderColor, theme, context.warnings, 'surfaceStyle.borderColor');
|
|
345
|
+
const style = asText(surface.borderStyle, theme);
|
|
346
|
+
if (Number.isFinite(width) && isSet(surface.borderWidth)) {
|
|
347
|
+
shell.borderWidth = width;
|
|
348
|
+
if (width > 0) {
|
|
349
|
+
shell.borderColor = color ?? theme.colors.borderPrimary;
|
|
350
|
+
if (style && style !== 'solid')
|
|
351
|
+
shell.borderStyle = style;
|
|
352
|
+
}
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (color || style) {
|
|
356
|
+
shell.borderWidth = 1;
|
|
357
|
+
shell.borderColor = color ?? theme.colors.borderPrimary;
|
|
358
|
+
if (style && style !== 'solid')
|
|
359
|
+
shell.borderStyle = style;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
/** Yüzey grubunun bilinen alanları; kalanı uyarıya yazılır (frontend `SURFACE_KEYS`). MOB-002 de buradan okur. */
|
|
363
|
+
export const SURFACE_KEYS = new Set([
|
|
364
|
+
'background',
|
|
365
|
+
'radius',
|
|
366
|
+
'borderTop',
|
|
367
|
+
'borderRight',
|
|
368
|
+
'borderBottom',
|
|
369
|
+
'borderLeft',
|
|
370
|
+
'shadow',
|
|
371
|
+
'contentOverflow',
|
|
372
|
+
'opacity',
|
|
373
|
+
'rotate',
|
|
374
|
+
'scale',
|
|
375
|
+
'translateX',
|
|
376
|
+
'translateY',
|
|
377
|
+
'borderWidth',
|
|
378
|
+
'borderStyle',
|
|
379
|
+
'borderColor'
|
|
380
|
+
]);
|
|
381
|
+
/**
|
|
382
|
+
* Döndür / ölçekle / kaydır (ADR 0005): web ile aynı sıra ve aralık, RN dizisi. Dolu ama geçersiz
|
|
383
|
+
* değer (birimli metin, aralık dışı) uyarıya yazılır — frontend `composeTransform`.
|
|
384
|
+
*/
|
|
385
|
+
const composeTransform = (surface, shell, warnings) => {
|
|
386
|
+
const read = (field) => {
|
|
387
|
+
const raw = surface[field];
|
|
388
|
+
if (!isSet(raw))
|
|
389
|
+
return undefined;
|
|
390
|
+
const value = transformValue(raw, field);
|
|
391
|
+
if (value === undefined) {
|
|
392
|
+
const [min, max] = TRANSFORM_RANGES[field];
|
|
393
|
+
warnings?.push(`surfaceStyle.${field}: ${String(raw)} geçersiz — ${min}…${max} arası sayı, atlandı`);
|
|
394
|
+
}
|
|
395
|
+
return value;
|
|
396
|
+
};
|
|
397
|
+
const transform = [];
|
|
398
|
+
const x = read('translateX') ?? 0;
|
|
399
|
+
const y = read('translateY') ?? 0;
|
|
400
|
+
if (x !== 0 || y !== 0)
|
|
401
|
+
transform.push({ translateX: x }, { translateY: y });
|
|
402
|
+
const rotate = read('rotate');
|
|
403
|
+
if (rotate !== undefined && rotate !== 0)
|
|
404
|
+
transform.push({ rotate: `${rotate}deg` });
|
|
405
|
+
const scale = read('scale');
|
|
406
|
+
if (scale !== undefined && scale !== 100)
|
|
407
|
+
transform.push({ scale: scale / 100 });
|
|
408
|
+
if (transform.length)
|
|
409
|
+
shell.transform = transform;
|
|
410
|
+
};
|
|
411
|
+
const composeSurface = (surface, shell, theme, context) => {
|
|
412
|
+
const background = asText(surface.background, theme, context.warnings, 'surfaceStyle.background');
|
|
413
|
+
if (background)
|
|
414
|
+
shell.backgroundColor = background;
|
|
415
|
+
composeRadius(surface.radius, shell, theme, context);
|
|
416
|
+
composeBorders(surface, shell, theme, context);
|
|
417
|
+
if (isSet(surface.shadow) && isSet(surface.background) && !background) {
|
|
418
|
+
context.warnings?.push('surfaceStyle.shadow: zemin çözülemedi, gölge çocuklara düşerdi — atlandı');
|
|
419
|
+
}
|
|
420
|
+
else if (isSet(surface.shadow)) {
|
|
421
|
+
const raw = String(surface.shadow);
|
|
422
|
+
const key = raw;
|
|
423
|
+
if (!theme.shadow[key] && (raw.includes(',') || raw.includes('inset'))) {
|
|
424
|
+
context.warnings?.push(`shadow: RN tek katman taşır, ilk katman uygulandı (${raw})`);
|
|
425
|
+
}
|
|
426
|
+
Object.assign(shell, theme.shadow[key] ?? parseShadow(resolveThemeToken(raw, theme)));
|
|
427
|
+
}
|
|
428
|
+
const opacity = parseOpacity(surface.opacity);
|
|
429
|
+
if (opacity !== null)
|
|
430
|
+
shell.opacity = opacity;
|
|
431
|
+
if (isSet(surface.contentOverflow)) {
|
|
432
|
+
const overflow = String(surface.contentOverflow);
|
|
433
|
+
shell.overflow = overflow === 'visible' ? 'visible' : 'hidden';
|
|
434
|
+
if (overflow === 'auto')
|
|
435
|
+
context.warnings?.push('contentOverflow: auto — RN kaydırmayı bileşenin kendisi açar, kutu hidden yapıldı');
|
|
436
|
+
}
|
|
437
|
+
composeTransform(surface, shell, context.warnings);
|
|
438
|
+
for (const [key, value] of Object.entries(surface)) {
|
|
439
|
+
if (!SURFACE_KEYS.has(key) && isSet(value))
|
|
440
|
+
context.warnings?.push(`surfaceStyle.${key}: mobilde karşılığı yok, atlandı`);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const composeTypography = (typography, text, theme, context) => {
|
|
444
|
+
const color = asText(typography.textColor, theme, context.warnings, 'typographyStyle.textColor');
|
|
445
|
+
if (color)
|
|
446
|
+
text.color = color;
|
|
447
|
+
const family = resolveFontFamily(asText(typography.fontFamily, theme) ?? '', theme.font.fallback);
|
|
448
|
+
if (family)
|
|
449
|
+
text.fontFamily = family;
|
|
450
|
+
const fontSize = parsePanelLength(typeof typography.fontSize === 'string' ? resolveThemeToken(typography.fontSize, theme) : typography.fontSize, context);
|
|
451
|
+
if (typeof fontSize === 'number')
|
|
452
|
+
text.fontSize = fontSize;
|
|
453
|
+
if (isSet(typography.fontWeight))
|
|
454
|
+
text.fontWeight = String(typography.fontWeight);
|
|
455
|
+
if (isSet(typography.fontStyle))
|
|
456
|
+
text.fontStyle = String(typography.fontStyle);
|
|
457
|
+
if (isSet(typography.textDecoration))
|
|
458
|
+
text.textDecorationLine = String(typography.textDecoration);
|
|
459
|
+
if (isSet(typography.textAlign)) {
|
|
460
|
+
const align = String(typography.textAlign);
|
|
461
|
+
text.textAlign = align === 'start' ? 'left' : align === 'end' ? 'right' : align;
|
|
462
|
+
}
|
|
463
|
+
const letterSpacing = parsePanelLength(typography.letterSpacing, context);
|
|
464
|
+
if (typeof letterSpacing === 'number')
|
|
465
|
+
text.letterSpacing = letterSpacing;
|
|
466
|
+
const lineHeight = parseLineHeight(typography.lineHeight, text.fontSize ?? context.base, context);
|
|
467
|
+
if (lineHeight !== null)
|
|
468
|
+
text.lineHeight = lineHeight;
|
|
469
|
+
};
|
|
470
|
+
const composeFreeStyle = (value, shell, text, theme, context) => {
|
|
471
|
+
if (!isPlainObject(value))
|
|
472
|
+
return;
|
|
473
|
+
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
474
|
+
if (!isSet(rawValue))
|
|
475
|
+
continue;
|
|
476
|
+
if (rawKey.startsWith('&') || rawKey.startsWith('--') || rawKey.startsWith(':')) {
|
|
477
|
+
context.warnings?.push(`${rawKey}: RN'de alt seçici yok, atlandı`);
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
const key = RENAMED_KEYS[rawKey] ?? rawKey;
|
|
481
|
+
if (IGNORED_KEYS.has(key))
|
|
482
|
+
continue;
|
|
483
|
+
const target = TEXT_KEYS.has(key) ? text : shell;
|
|
484
|
+
const resolved = typeof rawValue === 'string' ? resolveThemeToken(rawValue, theme) : rawValue;
|
|
485
|
+
if (typeof resolved === 'number') {
|
|
486
|
+
target[key] = resolved;
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const length = key === 'fontWeight' || typeof resolved !== 'string' ? null : parseLength(resolved, { ...context, warnings: undefined });
|
|
490
|
+
target[key] = length ?? resolved;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
export function composeNativeStyle(input, theme) {
|
|
494
|
+
const warnings = [];
|
|
495
|
+
const shell = {};
|
|
496
|
+
const text = {};
|
|
497
|
+
const context = { base: theme.font.size, root: theme.font.size, warnings };
|
|
498
|
+
composeFreeStyle(input.themeStyle, shell, text, theme, context);
|
|
499
|
+
if (isPlainObject(input.surfaceStyle))
|
|
500
|
+
composeSurface(input.surfaceStyle, shell, theme, context);
|
|
501
|
+
if (isPlainObject(input.typographyStyle))
|
|
502
|
+
composeTypography(input.typographyStyle, text, theme, context);
|
|
503
|
+
if (isPlainObject(input.hoverStyle) && Object.values(input.hoverStyle).some(isSet)) {
|
|
504
|
+
warnings.push('hoverStyle: dokunmatikte hover durumu yok, atlandı');
|
|
505
|
+
}
|
|
506
|
+
composeFreeStyle(input.style, shell, text, theme, context);
|
|
507
|
+
return { shell, text, warnings };
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Bir düğümün mobil çizerdeki stili (`NativeRenderer` → `nativeNodeStyle`, `renderer.functions.ts`). Temanın katmanı
|
|
511
|
+
* (`componentStyles[tip]` ← `$preset`) web'in çözücüsünden gelir ve TABANDIR; panel grupları üstüne, düğümün serbest
|
|
512
|
+
* `style`'ı son söz; `$preset` işareti RN stiline inmez (plans/mobil-plantcare-acigi f-16 — 2026-09-28'e dek çizer bu
|
|
513
|
+
* katmanı okumuyordu, rapor da okumuyordu). İfadeye bağlı prop çalışma anında çözülür, burada yok.
|
|
514
|
+
*/
|
|
515
|
+
export function nodeNativeStyle(node, theme, source) {
|
|
516
|
+
const props = node.props;
|
|
517
|
+
const group = (name) => {
|
|
518
|
+
const value = rawProp(props, name);
|
|
519
|
+
return isPlainObject(value) ? value : null;
|
|
520
|
+
};
|
|
521
|
+
const layers = resolveNodeStyleLayers(rawProp(props, 'style'), source, node.type);
|
|
522
|
+
return composeNativeStyle({
|
|
523
|
+
themeStyle: layers.theme,
|
|
524
|
+
surfaceStyle: group('surfaceStyle'),
|
|
525
|
+
typographyStyle: group('typographyStyle'),
|
|
526
|
+
hoverStyle: group('hoverStyle'),
|
|
527
|
+
style: layers.own
|
|
528
|
+
}, theme);
|
|
529
|
+
}
|
|
@@ -332,8 +332,8 @@ export function buildSpacingScaleVars(scale) {
|
|
|
332
332
|
.join('\n\t');
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
|
-
* Bir seviyenin
|
|
336
|
-
* Kullanıcı tek çarpan ayarlar,
|
|
335
|
+
* Bir seviyenin dar ekran karşılığının masaüstüne oranı — bugünkü breakpoint değerlerinden türer.
|
|
336
|
+
* Kullanıcı tek çarpan ayarlar, dar ekran ona orantılı hareket eder.
|
|
337
337
|
*/
|
|
338
338
|
const TYPE_SCALE_MOBILE_RATIO = {
|
|
339
339
|
h1: 1.7 / 2.25,
|
|
@@ -363,7 +363,7 @@ export function mergeTypeScale(overrides) {
|
|
|
363
363
|
}
|
|
364
364
|
return result;
|
|
365
365
|
}
|
|
366
|
-
/** Ölçekten `--ng-font-size-*` değişkenlerini üretir (masaüstü +
|
|
366
|
+
/** Ölçekten `--ng-font-size-*` değişkenlerini üretir (masaüstü + dar ekran). */
|
|
367
367
|
export function buildTypeScaleVars(scale) {
|
|
368
368
|
const lines = [];
|
|
369
369
|
for (const [level, factor] of Object.entries(scale)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { appendFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
|
-
import { secretKeyPattern } from '../platform/secrets.js';
|
|
4
|
+
import { maskSecretLeaf, secretKeyPattern, secretPairName } from '../platform/secrets.js';
|
|
5
5
|
const defaultDirectory = join(process.cwd(), 'logs');
|
|
6
6
|
const activeTrace = new AsyncLocalStorage();
|
|
7
7
|
const activeRequest = new AsyncLocalStorage();
|
|
@@ -37,11 +37,16 @@ function clip(text, limit) {
|
|
|
37
37
|
function redact(value, depth = 0) {
|
|
38
38
|
if (depth > 8)
|
|
39
39
|
return '…';
|
|
40
|
+
// Günlük, yanıt maskesinin gördüğü ad/değer çiftini ve yaprak jetonu da görmeli: debug gövdesi ve
|
|
41
|
+
// `asUser` argümanı buraya ham gelir (g-01, 37 S-24).
|
|
42
|
+
if (typeof value === 'string')
|
|
43
|
+
return maskSecretLeaf(value);
|
|
40
44
|
if (Array.isArray(value))
|
|
41
45
|
return value.map(entry => redact(entry, depth + 1));
|
|
42
46
|
if (value && typeof value === 'object') {
|
|
47
|
+
const pairName = secretPairName(value);
|
|
43
48
|
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
44
|
-
if (secretKeyPattern.test(key))
|
|
49
|
+
if (secretKeyPattern.test(key === 'value' && pairName !== undefined ? pairName : key))
|
|
45
50
|
return [key, '***'];
|
|
46
51
|
if (/^stack(Trace)?$/i.test(key) && typeof entry === 'string') {
|
|
47
52
|
return [key, `${clip(entry.split(/\r?\n/)[0] ?? '', 240)} … (kalan stack kırpıldı)`];
|
|
@@ -204,9 +209,12 @@ function describeResult(result) {
|
|
|
204
209
|
const text = Array.isArray(call?.content)
|
|
205
210
|
? call.content.filter(entry => entry.type === 'text').map(entry => String(entry.text)).join(' ')
|
|
206
211
|
: '';
|
|
207
|
-
if (call?.isError)
|
|
208
|
-
return { ok: false, summary: clip(text, 400) };
|
|
209
212
|
const structured = call?.structuredContent;
|
|
213
|
+
if (call?.isError) {
|
|
214
|
+
return structured?.expectedFailure === true
|
|
215
|
+
? { ok: true, summary: `beklenen platform hatası (negatif test): ${clip(text, 400)}` }
|
|
216
|
+
: { ok: false, summary: clip(text, 400) };
|
|
217
|
+
}
|
|
210
218
|
const runtimeErrors = structured?.runtimeErrors;
|
|
211
219
|
if (Array.isArray(runtimeErrors) && runtimeErrors.length > 0) {
|
|
212
220
|
// Kasıtlı negatif test bir kusur değil bir KANIT: çağıran beklediğini söylediyse satır
|
|
@@ -351,7 +359,7 @@ export function logGatewayEvent(message) {
|
|
|
351
359
|
*/
|
|
352
360
|
export function logCapabilityGap(gap) {
|
|
353
361
|
const lines = [
|
|
354
|
-
`┌─ ${clockOf(new Date())} · KABİLİYET BOŞLUĞU · ${gap.severity}${gap.module ? ` · ${gap.module}` : ''}`,
|
|
362
|
+
`┌─ ${clockOf(new Date())} · KABİLİYET BOŞLUĞU · ${gap.severity}${gap.module ? ` · ${gap.module}` : ''}${gap.project ? ` · proje ${gap.project}` : ''}`,
|
|
355
363
|
`│ hedef : ${condense(gap.goal, maxBodyChars)}`,
|
|
356
364
|
`│ engel : ${condense(gap.blocker, maxBodyChars)}`
|
|
357
365
|
];
|