@nordcraft/core 1.0.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 +5 -0
- package/dist/api/LegacyToddleApi.d.ts +34 -0
- package/dist/api/LegacyToddleApi.js +178 -0
- package/dist/api/LegacyToddleApi.js.map +1 -0
- package/dist/api/ToddleApiV2.d.ts +77 -0
- package/dist/api/ToddleApiV2.js +271 -0
- package/dist/api/ToddleApiV2.js.map +1 -0
- package/dist/api/api.d.ts +49 -0
- package/dist/api/api.js +276 -0
- package/dist/api/api.js.map +1 -0
- package/dist/api/apiTypes.d.ts +125 -0
- package/dist/api/apiTypes.js +11 -0
- package/dist/api/apiTypes.js.map +1 -0
- package/dist/api/headers.d.ts +10 -0
- package/dist/api/headers.js +36 -0
- package/dist/api/headers.js.map +1 -0
- package/dist/api/template.d.ts +5 -0
- package/dist/api/template.js +7 -0
- package/dist/api/template.js.map +1 -0
- package/dist/component/ToddleComponent.d.ts +45 -0
- package/dist/component/ToddleComponent.js +373 -0
- package/dist/component/ToddleComponent.js.map +1 -0
- package/dist/component/actionUtils.d.ts +2 -0
- package/dist/component/actionUtils.js +56 -0
- package/dist/component/actionUtils.js.map +1 -0
- package/dist/component/component.types.d.ts +313 -0
- package/dist/component/component.types.js +9 -0
- package/dist/component/component.types.js.map +1 -0
- package/dist/component/isPageComponent.d.ts +2 -0
- package/dist/component/isPageComponent.js +3 -0
- package/dist/component/isPageComponent.js.map +1 -0
- package/dist/formula/ToddleFormula.d.ts +15 -0
- package/dist/formula/ToddleFormula.js +20 -0
- package/dist/formula/ToddleFormula.js.map +1 -0
- package/dist/formula/formula.d.ts +103 -0
- package/dist/formula/formula.js +186 -0
- package/dist/formula/formula.js.map +1 -0
- package/dist/formula/formulaTypes.d.ts +30 -0
- package/dist/formula/formulaTypes.js +2 -0
- package/dist/formula/formulaTypes.js.map +1 -0
- package/dist/formula/formulaUtils.d.ts +18 -0
- package/dist/formula/formulaUtils.js +240 -0
- package/dist/formula/formulaUtils.js.map +1 -0
- package/dist/styling/className.d.ts +2 -0
- package/dist/styling/className.js +52 -0
- package/dist/styling/className.js.map +1 -0
- package/dist/styling/style.css.d.ts +5 -0
- package/dist/styling/style.css.js +242 -0
- package/dist/styling/style.css.js.map +1 -0
- package/dist/styling/theme.const.d.ts +3 -0
- package/dist/styling/theme.const.js +381 -0
- package/dist/styling/theme.const.js.map +1 -0
- package/dist/styling/theme.d.ts +72 -0
- package/dist/styling/theme.js +200 -0
- package/dist/styling/theme.js.map +1 -0
- package/dist/styling/variantSelector.d.ts +123 -0
- package/dist/styling/variantSelector.js +25 -0
- package/dist/styling/variantSelector.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/collections.d.ts +21 -0
- package/dist/utils/collections.js +75 -0
- package/dist/utils/collections.js.map +1 -0
- package/dist/utils/customElements.d.ts +6 -0
- package/dist/utils/customElements.js +15 -0
- package/dist/utils/customElements.js.map +1 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +17 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/json.d.ts +5 -0
- package/dist/utils/json.js +16 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/sha1.d.ts +2 -0
- package/dist/utils/sha1.js +13 -0
- package/dist/utils/sha1.js.map +1 -0
- package/dist/utils/url.d.ts +5 -0
- package/dist/utils/url.js +27 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/util.d.ts +3 -0
- package/dist/utils/util.js +4 -0
- package/dist/utils/util.js.map +1 -0
- package/package.json +18 -0
- package/src/api/LegacyToddleApi.ts +205 -0
- package/src/api/ToddleApiV2.ts +331 -0
- package/src/api/api.test.ts +319 -0
- package/src/api/api.ts +414 -0
- package/src/api/apiTypes.ts +145 -0
- package/src/api/headers.ts +41 -0
- package/src/api/template.ts +10 -0
- package/src/component/ToddleComponent.actionReferences.test.ts +75 -0
- package/src/component/ToddleComponent.formulasInComponent.test.ts +234 -0
- package/src/component/ToddleComponent.ts +470 -0
- package/src/component/actionUtils.ts +61 -0
- package/src/component/component.types.ts +362 -0
- package/src/component/isPageComponent.ts +6 -0
- package/src/formula/ToddleFormula.ts +30 -0
- package/src/formula/formula.ts +355 -0
- package/src/formula/formulaTypes.ts +45 -0
- package/src/formula/formulaUtils.ts +287 -0
- package/src/styling/className.test.ts +19 -0
- package/src/styling/className.ts +73 -0
- package/src/styling/style.css.ts +309 -0
- package/src/styling/theme.const.ts +390 -0
- package/src/styling/theme.ts +339 -0
- package/src/styling/variantSelector.ts +168 -0
- package/src/types.ts +158 -0
- package/src/utils/collections.test.ts +57 -0
- package/src/utils/collections.ts +122 -0
- package/src/utils/customElements.test.ts +40 -0
- package/src/utils/customElements.ts +16 -0
- package/src/utils/hash.test.ts +32 -0
- package/src/utils/hash.ts +18 -0
- package/src/utils/json.ts +18 -0
- package/src/utils/sha1.test.ts +50 -0
- package/src/utils/sha1.ts +17 -0
- package/src/utils/url.test.ts +17 -0
- package/src/utils/url.ts +33 -0
- package/src/utils/util.ts +8 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Formula } from './formula';
|
|
2
|
+
export interface BaseFormula {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
arguments: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
formula?: Formula | null;
|
|
8
|
+
testValue?: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
exported?: boolean;
|
|
11
|
+
variableArguments?: boolean | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ToddleFormula extends BaseFormula {
|
|
14
|
+
formula: Formula;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The Handler generic is a string server side, but a function client side
|
|
18
|
+
*/
|
|
19
|
+
export interface CodeFormula<Handler = string | Function> extends BaseFormula {
|
|
20
|
+
version?: 2 | never;
|
|
21
|
+
handler: Handler;
|
|
22
|
+
}
|
|
23
|
+
export type PluginFormula<Handler = string | Function> = ToddleFormula | CodeFormula<Handler>;
|
|
24
|
+
export declare const isToddleFormula: <Handler>(formula: PluginFormula<Handler>) => formula is ToddleFormula;
|
|
25
|
+
export interface GlobalFormulas<Handler = string | Function> {
|
|
26
|
+
formulas?: Record<string, PluginFormula<Handler>>;
|
|
27
|
+
packages?: Record<string, {
|
|
28
|
+
formulas?: Record<string, PluginFormula<Handler>>;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formulaTypes.js","sourceRoot":"","sources":["../../src/formula/formulaTypes.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAA+B,EACL,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ActionModel } from '../component/component.types';
|
|
2
|
+
import type { Formula, FunctionOperation, PathOperation, ValueOperation } from './formula';
|
|
3
|
+
import type { GlobalFormulas } from './formulaTypes';
|
|
4
|
+
export declare const valueFormula: (value: string | number | boolean | null | object) => ValueOperation;
|
|
5
|
+
export declare const pathFormula: (path: string[]) => PathOperation;
|
|
6
|
+
export declare const functionFormula: (name: string, formula?: Omit<Partial<FunctionOperation>, "type" | "name">) => FunctionOperation;
|
|
7
|
+
export declare function getFormulasInFormula<Handler>({ formula, globalFormulas, path, visitedFormulas, }: {
|
|
8
|
+
formula: Formula | undefined | null;
|
|
9
|
+
globalFormulas: GlobalFormulas<Handler>;
|
|
10
|
+
path?: (string | number)[];
|
|
11
|
+
visitedFormulas?: Set<string>;
|
|
12
|
+
}): Generator<[(string | number)[], Formula]>;
|
|
13
|
+
export declare function getFormulasInAction<Handler>({ action, globalFormulas, path, visitedFormulas, }: {
|
|
14
|
+
action: ActionModel | null;
|
|
15
|
+
globalFormulas: GlobalFormulas<Handler>;
|
|
16
|
+
path?: (string | number)[];
|
|
17
|
+
visitedFormulas?: Set<string>;
|
|
18
|
+
}): Generator<[(string | number)[], Formula]>;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { isDefined } from '../utils/util';
|
|
2
|
+
import { isFormula } from './formula';
|
|
3
|
+
import { isToddleFormula } from './formulaTypes';
|
|
4
|
+
export const valueFormula = (value) => ({
|
|
5
|
+
type: 'value',
|
|
6
|
+
value,
|
|
7
|
+
});
|
|
8
|
+
export const pathFormula = (path) => ({
|
|
9
|
+
type: 'path',
|
|
10
|
+
path,
|
|
11
|
+
});
|
|
12
|
+
export const functionFormula = (name, formula) => ({
|
|
13
|
+
type: 'function',
|
|
14
|
+
name,
|
|
15
|
+
package: formula?.package,
|
|
16
|
+
arguments: formula?.arguments ?? [],
|
|
17
|
+
variableArguments: formula?.variableArguments,
|
|
18
|
+
});
|
|
19
|
+
export function* getFormulasInFormula({ formula, globalFormulas, path = [], visitedFormulas = new Set(), }) {
|
|
20
|
+
if (!isDefined(formula)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
yield [path, formula];
|
|
24
|
+
switch (formula.type) {
|
|
25
|
+
case 'path':
|
|
26
|
+
case 'value':
|
|
27
|
+
break;
|
|
28
|
+
case 'record':
|
|
29
|
+
for (const [key, entry] of formula.entries.entries()) {
|
|
30
|
+
yield* getFormulasInFormula({
|
|
31
|
+
formula: entry.formula,
|
|
32
|
+
globalFormulas,
|
|
33
|
+
path: [...path, 'entries', key, 'formula'],
|
|
34
|
+
visitedFormulas,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
case 'function': {
|
|
39
|
+
const formulaKey = [formula.package, formula.name]
|
|
40
|
+
.filter(isDefined)
|
|
41
|
+
.join('/');
|
|
42
|
+
const shouldVisitFormula = !visitedFormulas.has(formulaKey);
|
|
43
|
+
visitedFormulas.add(formulaKey);
|
|
44
|
+
const globalFormula = formula.package
|
|
45
|
+
? globalFormulas.packages?.[formula.package]?.formulas?.[formula.name]
|
|
46
|
+
: globalFormulas.formulas?.[formula.name];
|
|
47
|
+
for (const [key, arg] of (formula.arguments ?? []).entries()) {
|
|
48
|
+
yield* getFormulasInFormula({
|
|
49
|
+
formula: arg.formula,
|
|
50
|
+
globalFormulas,
|
|
51
|
+
path: [...path, 'arguments', key, 'formula'],
|
|
52
|
+
visitedFormulas,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Lookup the actual function and traverse its potential formula references
|
|
56
|
+
// if this formula wasn't already visited
|
|
57
|
+
if (globalFormula &&
|
|
58
|
+
isToddleFormula(globalFormula) &&
|
|
59
|
+
shouldVisitFormula) {
|
|
60
|
+
yield* getFormulasInFormula({
|
|
61
|
+
formula: globalFormula.formula,
|
|
62
|
+
globalFormulas,
|
|
63
|
+
path: [...path, 'formula'],
|
|
64
|
+
visitedFormulas,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case 'array':
|
|
70
|
+
case 'or':
|
|
71
|
+
case 'and':
|
|
72
|
+
case 'object':
|
|
73
|
+
for (const [key, arg] of (formula.arguments ?? []).entries()) {
|
|
74
|
+
yield* getFormulasInFormula({
|
|
75
|
+
formula: arg.formula,
|
|
76
|
+
globalFormulas,
|
|
77
|
+
path: [...path, 'arguments', key, 'formula'],
|
|
78
|
+
visitedFormulas,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case 'apply':
|
|
83
|
+
for (const [key, arg] of (formula.arguments ?? []).entries()) {
|
|
84
|
+
yield* getFormulasInFormula({
|
|
85
|
+
formula: arg.formula,
|
|
86
|
+
globalFormulas,
|
|
87
|
+
path: [...path, 'arguments', key, 'formula'],
|
|
88
|
+
visitedFormulas,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'switch':
|
|
93
|
+
for (const [key, c] of formula.cases.entries()) {
|
|
94
|
+
yield* getFormulasInFormula({
|
|
95
|
+
formula: c.condition,
|
|
96
|
+
globalFormulas,
|
|
97
|
+
path: [...path, 'cases', key, 'condition'],
|
|
98
|
+
visitedFormulas,
|
|
99
|
+
});
|
|
100
|
+
yield* getFormulasInFormula({
|
|
101
|
+
formula: c.formula,
|
|
102
|
+
globalFormulas,
|
|
103
|
+
path: [...path, 'cases', key, 'formula'],
|
|
104
|
+
visitedFormulas,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
yield* getFormulasInFormula({
|
|
108
|
+
formula: formula.default,
|
|
109
|
+
globalFormulas,
|
|
110
|
+
path: [...path, 'default'],
|
|
111
|
+
visitedFormulas,
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function* getFormulasInAction({ action, globalFormulas, path = [], visitedFormulas = new Set(), }) {
|
|
117
|
+
if (!isDefined(action)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
switch (action.type) {
|
|
121
|
+
case 'Fetch':
|
|
122
|
+
for (const [inputKey, input] of Object.entries(action.inputs ?? {})) {
|
|
123
|
+
yield* getFormulasInFormula({
|
|
124
|
+
formula: input.formula,
|
|
125
|
+
globalFormulas,
|
|
126
|
+
path: [...path, 'input', inputKey, 'formula'],
|
|
127
|
+
visitedFormulas,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
for (const [key, a] of Object.entries(action.onSuccess?.actions ?? {})) {
|
|
131
|
+
yield* getFormulasInAction({
|
|
132
|
+
action: a,
|
|
133
|
+
globalFormulas,
|
|
134
|
+
path: [...path, 'onSuccess', 'actions', key],
|
|
135
|
+
visitedFormulas,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
for (const [key, a] of Object.entries(action.onError?.actions ?? {})) {
|
|
139
|
+
yield* getFormulasInAction({
|
|
140
|
+
action: a,
|
|
141
|
+
globalFormulas,
|
|
142
|
+
path: [...path, 'onError', 'actions', key],
|
|
143
|
+
visitedFormulas,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
for (const [key, a] of Object.entries(action.onMessage?.actions ?? {})) {
|
|
147
|
+
yield* getFormulasInAction({
|
|
148
|
+
action: a,
|
|
149
|
+
globalFormulas,
|
|
150
|
+
path: [...path, 'onMessage', 'actions', key],
|
|
151
|
+
visitedFormulas,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case 'Custom':
|
|
156
|
+
case undefined:
|
|
157
|
+
if (isFormula(action.data)) {
|
|
158
|
+
yield* getFormulasInFormula({
|
|
159
|
+
formula: action.data,
|
|
160
|
+
globalFormulas,
|
|
161
|
+
path: [...path, 'data'],
|
|
162
|
+
visitedFormulas,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
for (const [key, a] of Object.entries(action.arguments ?? {})) {
|
|
166
|
+
yield* getFormulasInFormula({
|
|
167
|
+
formula: a.formula,
|
|
168
|
+
globalFormulas,
|
|
169
|
+
path: [...path, 'arguments', key, 'formula'],
|
|
170
|
+
visitedFormulas,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
for (const [eventKey, event] of Object.entries(action.events ?? {})) {
|
|
174
|
+
for (const [key, a] of Object.entries(event.actions ?? {})) {
|
|
175
|
+
yield* getFormulasInAction({
|
|
176
|
+
action: a,
|
|
177
|
+
globalFormulas,
|
|
178
|
+
path: [...path, 'events', eventKey, 'actions', key],
|
|
179
|
+
visitedFormulas,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case 'SetVariable':
|
|
185
|
+
case 'SetURLParameter':
|
|
186
|
+
case 'TriggerEvent':
|
|
187
|
+
yield* getFormulasInFormula({
|
|
188
|
+
formula: action.data,
|
|
189
|
+
globalFormulas,
|
|
190
|
+
path: [...path, 'data'],
|
|
191
|
+
visitedFormulas,
|
|
192
|
+
});
|
|
193
|
+
break;
|
|
194
|
+
case 'TriggerWorkflow':
|
|
195
|
+
for (const [key, a] of Object.entries(action.parameters ?? {})) {
|
|
196
|
+
yield* getFormulasInFormula({
|
|
197
|
+
formula: a.formula,
|
|
198
|
+
globalFormulas,
|
|
199
|
+
path: [...path, 'parameters', key, 'formula'],
|
|
200
|
+
visitedFormulas,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case 'Switch':
|
|
205
|
+
if (isDefined(action.data) && isFormula(action.data)) {
|
|
206
|
+
yield* getFormulasInFormula({
|
|
207
|
+
formula: action.data,
|
|
208
|
+
globalFormulas,
|
|
209
|
+
path: [...path, 'data'],
|
|
210
|
+
visitedFormulas,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
for (const [key, c] of action.cases.entries()) {
|
|
214
|
+
yield* getFormulasInFormula({
|
|
215
|
+
formula: c.condition,
|
|
216
|
+
globalFormulas,
|
|
217
|
+
path: [...path, 'cases', key, 'condition'],
|
|
218
|
+
visitedFormulas,
|
|
219
|
+
});
|
|
220
|
+
for (const [actionKey, a] of Object.entries(c.actions)) {
|
|
221
|
+
yield* getFormulasInAction({
|
|
222
|
+
action: a,
|
|
223
|
+
globalFormulas,
|
|
224
|
+
path: [...path, 'cases', key, 'actions', actionKey],
|
|
225
|
+
visitedFormulas,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
for (const [actionKey, a] of Object.entries(action.default.actions)) {
|
|
230
|
+
yield* getFormulasInAction({
|
|
231
|
+
action: a,
|
|
232
|
+
globalFormulas,
|
|
233
|
+
path: [...path, 'default', 'actions', actionKey],
|
|
234
|
+
visitedFormulas,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=formulaUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formulaUtils.js","sourceRoot":"","sources":["../../src/formula/formulaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,E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B,MAAM,EAAE,CAAC;oBACT,cAAc;oBACd,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;oBAChD,eAAe;iBAChB,CAAC,CAAA;YACJ,CAAC;YACD,MAAK;IACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// cSpell: ignore phash
|
|
2
|
+
const SEED = 5381;
|
|
3
|
+
// When we have separate strings it's useful to run a progressive
|
|
4
|
+
// version of djb2 where we pretend that we're still looping over
|
|
5
|
+
// the same string
|
|
6
|
+
const phash = (h, x) => {
|
|
7
|
+
let i = x.length;
|
|
8
|
+
while (i) {
|
|
9
|
+
h = (h * 33) ^ x.charCodeAt(--i);
|
|
10
|
+
}
|
|
11
|
+
return h;
|
|
12
|
+
};
|
|
13
|
+
// This is a djb2 hashing function
|
|
14
|
+
const hash = (x) => {
|
|
15
|
+
return phash(SEED, x);
|
|
16
|
+
};
|
|
17
|
+
const AD_REPLACER_R = /(a)(d)/gi;
|
|
18
|
+
/* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalized
|
|
19
|
+
* counterparts */
|
|
20
|
+
const charsLength = 52;
|
|
21
|
+
/* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalized letters */
|
|
22
|
+
const getAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
23
|
+
/* input a number, usually a hash and convert it to base-52 */
|
|
24
|
+
function generateAlphabeticName(code) {
|
|
25
|
+
let name = '';
|
|
26
|
+
let x;
|
|
27
|
+
/* get a char and divide by alphabet-length */
|
|
28
|
+
for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
|
|
29
|
+
name = getAlphabeticChar(x % charsLength) + name;
|
|
30
|
+
}
|
|
31
|
+
return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');
|
|
32
|
+
}
|
|
33
|
+
export const getClassName = (object) => {
|
|
34
|
+
return generateAlphabeticName(hash(JSON.stringify(object)));
|
|
35
|
+
};
|
|
36
|
+
export const toValidClassName = (input, escapeSpecialCharacters = false) => {
|
|
37
|
+
// Replace invalid characters with hyphens
|
|
38
|
+
let className = input
|
|
39
|
+
// Remove leading and trailing whitespace
|
|
40
|
+
.trim()
|
|
41
|
+
// Replace whitespace with hyphens
|
|
42
|
+
.replace(/\s+/g, '-');
|
|
43
|
+
if (escapeSpecialCharacters) {
|
|
44
|
+
className = className.replace(/[^a-zA-Z0-9-_]/g, (match) => `\\${match}`);
|
|
45
|
+
}
|
|
46
|
+
// Ensure the class name doesn't start with a number or special character
|
|
47
|
+
if (/^[^a-zA-Z]/.test(className)) {
|
|
48
|
+
className = `_${className}`;
|
|
49
|
+
}
|
|
50
|
+
return className;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=className.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"className.js","sourceRoot":"","sources":["../../src/styling/className.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,MAAM,IAAI,GAAG,IAAI,CAAA;AAEjB,iEAAiE;AACjE,iEAAiE;AACjE,kBAAkB;AAClB,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;IACrC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAEhB,OAAO,CAAC,EAAE,CAAC;QACT,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAED,kCAAkC;AAClC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE;IACzB,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC;kBACkB;AAClB,MAAM,WAAW,GAAG,EAAE,CAAA;AAE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CAAC,CAAA;IAC3E,CAAC;IAED,yEAAyE;IACzE,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,SAAS,GAAG,IAAI,SAAS,EAAE,CAAA;IAC7B,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Component } from '../component/component.types';
|
|
2
|
+
import type { OldTheme, Theme, ThemeOptions } from './theme';
|
|
3
|
+
export declare function kebabCase(string: string): string;
|
|
4
|
+
export declare const createStylesheet: (root: Component, components: Component[], theme: Theme | OldTheme, options: ThemeOptions) => string;
|
|
5
|
+
export declare const getAllFonts: (components: Component[]) => Set<string>;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { omitKeys } from '../utils/collections';
|
|
2
|
+
import { isDefined } from '../utils/util';
|
|
3
|
+
import { getClassName, toValidClassName } from './className';
|
|
4
|
+
import { getThemeCss } from './theme';
|
|
5
|
+
import { variantSelector } from './variantSelector';
|
|
6
|
+
const LEGACY_BREAKPOINTS = {
|
|
7
|
+
large: 1440,
|
|
8
|
+
small: 576,
|
|
9
|
+
medium: 960,
|
|
10
|
+
};
|
|
11
|
+
export function kebabCase(string) {
|
|
12
|
+
return string
|
|
13
|
+
.split('')
|
|
14
|
+
.map((char) => {
|
|
15
|
+
return 'ABCDEFGHIJKLMNOPQRSTYVWXYZ'.includes(char)
|
|
16
|
+
? '-' + char.toLocaleLowerCase()
|
|
17
|
+
: char;
|
|
18
|
+
})
|
|
19
|
+
.join('');
|
|
20
|
+
}
|
|
21
|
+
const SIZE_PROPERTIES = new Set([
|
|
22
|
+
'width',
|
|
23
|
+
'min-width',
|
|
24
|
+
'max-width',
|
|
25
|
+
'height',
|
|
26
|
+
'min-height',
|
|
27
|
+
'max-height',
|
|
28
|
+
'margin',
|
|
29
|
+
'margin-top',
|
|
30
|
+
'margin-left',
|
|
31
|
+
'margin-bottom',
|
|
32
|
+
'margin-right',
|
|
33
|
+
'padding',
|
|
34
|
+
'padding-top',
|
|
35
|
+
'padding-left',
|
|
36
|
+
'padding-bottom',
|
|
37
|
+
'padding-right',
|
|
38
|
+
'gap',
|
|
39
|
+
'gap-x',
|
|
40
|
+
'gap-y',
|
|
41
|
+
'border-radius',
|
|
42
|
+
'border-bottom-left-radius',
|
|
43
|
+
'border-bottom-right-radius',
|
|
44
|
+
'border-top-left-radius',
|
|
45
|
+
'border-top-right-radius',
|
|
46
|
+
'border-width',
|
|
47
|
+
'border-top-width',
|
|
48
|
+
'border-left-width',
|
|
49
|
+
'border-bottom-width',
|
|
50
|
+
'border-right-width',
|
|
51
|
+
'font-size',
|
|
52
|
+
'top',
|
|
53
|
+
'right',
|
|
54
|
+
'bottom',
|
|
55
|
+
'left',
|
|
56
|
+
'outline-width',
|
|
57
|
+
]);
|
|
58
|
+
export const createStylesheet = (root, components, theme, options) => {
|
|
59
|
+
const hashes = new Set();
|
|
60
|
+
// Get fonts used on the page
|
|
61
|
+
const fonts = getAllFonts(components);
|
|
62
|
+
//Exclude fonts that are not used on this page.
|
|
63
|
+
let stylesheet = getThemeCss('breakpoints' in theme
|
|
64
|
+
? {
|
|
65
|
+
...theme,
|
|
66
|
+
fontFamily: Object.fromEntries(Object.entries(theme.fontFamily).filter(([key, value]) => value.default ?? fonts.has('--font-' + key))),
|
|
67
|
+
}
|
|
68
|
+
: {
|
|
69
|
+
...theme,
|
|
70
|
+
fonts: theme.fonts,
|
|
71
|
+
}, options);
|
|
72
|
+
const styleToCss = (style) => {
|
|
73
|
+
return Object.entries(style)
|
|
74
|
+
.map(([property, value]) => {
|
|
75
|
+
if (!isDefined(value)) {
|
|
76
|
+
// ignore undefined/null values
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const propertyName = kebabCase(property);
|
|
80
|
+
const propertyValue = String(Number(value)) === String(value) &&
|
|
81
|
+
SIZE_PROPERTIES.has(propertyName)
|
|
82
|
+
? `${Number(value) * 4}px`
|
|
83
|
+
: value;
|
|
84
|
+
return `${propertyName}:${propertyValue};`;
|
|
85
|
+
})
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.join('\n ');
|
|
88
|
+
};
|
|
89
|
+
const getNodeStyles = (node, classHash) => {
|
|
90
|
+
try {
|
|
91
|
+
const style = omitKeys(node.style ?? {}, [
|
|
92
|
+
'variants',
|
|
93
|
+
'breakpoints',
|
|
94
|
+
'shadows',
|
|
95
|
+
]);
|
|
96
|
+
const styleVariants = node.variants ?? node.style?.variants;
|
|
97
|
+
const renderVariant = (selector, style, options) => {
|
|
98
|
+
const scrollbarStyles = Object.entries(style).filter(([key]) => key == 'scrollbar-width');
|
|
99
|
+
// If selectorCss is empty, we don't need to render the selector
|
|
100
|
+
let styles = styleToCss(style);
|
|
101
|
+
if (options?.startingStyle) {
|
|
102
|
+
styles = `@starting-style {
|
|
103
|
+
${styles}
|
|
104
|
+
}`;
|
|
105
|
+
}
|
|
106
|
+
return `
|
|
107
|
+
${styles.length > 0
|
|
108
|
+
? `${selector} {
|
|
109
|
+
${styles}
|
|
110
|
+
}`
|
|
111
|
+
: ''}
|
|
112
|
+
${scrollbarStyles.length > 0
|
|
113
|
+
? `
|
|
114
|
+
${selector}::-webkit-scrollbar {
|
|
115
|
+
${scrollbarStyles
|
|
116
|
+
.map(([_, value]) => {
|
|
117
|
+
switch (value) {
|
|
118
|
+
case 'none':
|
|
119
|
+
return 'width: 0;';
|
|
120
|
+
case 'thinn':
|
|
121
|
+
case 'thin':
|
|
122
|
+
return 'width: 4px;';
|
|
123
|
+
default:
|
|
124
|
+
return '';
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
.join('\n')}
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
: ''}
|
|
131
|
+
`;
|
|
132
|
+
};
|
|
133
|
+
return `
|
|
134
|
+
${renderVariant('.' + classHash, style)}
|
|
135
|
+
${(styleVariants ?? [])
|
|
136
|
+
.map((variant) => {
|
|
137
|
+
const renderedVariant = renderVariant(`.${classHash}${variantSelector(variant)}`, variant.style, {
|
|
138
|
+
startingStyle: variant.startingStyle,
|
|
139
|
+
});
|
|
140
|
+
if (variant.mediaQuery) {
|
|
141
|
+
return `
|
|
142
|
+
@media (${Object.entries(variant.mediaQuery)
|
|
143
|
+
.map(([key, value]) => `${key}: ${value}`)
|
|
144
|
+
.filter(Boolean)
|
|
145
|
+
.join(') and (')}) {
|
|
146
|
+
${renderedVariant}
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
if (variant.breakpoint) {
|
|
151
|
+
return `
|
|
152
|
+
@media (min-width: ${LEGACY_BREAKPOINTS[variant.breakpoint]}px) {
|
|
153
|
+
${renderedVariant}
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
return renderedVariant;
|
|
158
|
+
})
|
|
159
|
+
.join('\n')}
|
|
160
|
+
${node.animations
|
|
161
|
+
? Object.entries(node.animations)
|
|
162
|
+
.map(([animationName, keyframes]) => {
|
|
163
|
+
return `
|
|
164
|
+
@keyframes ${animationName} {
|
|
165
|
+
${Object.values(keyframes)
|
|
166
|
+
.sort((a, b) => a.position - b.position)
|
|
167
|
+
.map(({ key, position, value }) => {
|
|
168
|
+
return `
|
|
169
|
+
${position * 100}% {
|
|
170
|
+
${key}: ${value};
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
})
|
|
174
|
+
.join('\n')}
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
})
|
|
178
|
+
.join('\n')
|
|
179
|
+
: ''}
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.error(e);
|
|
185
|
+
return '';
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
// Make sure that CSS for dependencies are rendered first so that instance styles can override
|
|
189
|
+
const visitedComponents = new Set();
|
|
190
|
+
function insertComponentStyles(component, package_name) {
|
|
191
|
+
if (visitedComponents.has(component.name)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
visitedComponents.add(component.name);
|
|
195
|
+
if (!component.nodes) {
|
|
196
|
+
// eslint-disable-next-line no-console
|
|
197
|
+
console.warn('Unable to find nodes for component', component.name);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
Object.entries(component.nodes).forEach(([id, node]) => {
|
|
201
|
+
if (node.type === 'component') {
|
|
202
|
+
const childComponent = components.find((c) => c.name ===
|
|
203
|
+
[node.package ?? package_name, node.name]
|
|
204
|
+
.filter((c) => c)
|
|
205
|
+
.join('/'));
|
|
206
|
+
if (childComponent) {
|
|
207
|
+
insertComponentStyles(childComponent, node.package ?? package_name);
|
|
208
|
+
stylesheet += getNodeStyles(node, toValidClassName(`${component.name}:${id}`, true));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (node.type !== 'element') {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const classHash = getClassName([node.style, node.variants]);
|
|
216
|
+
if (hashes.has(classHash)) {
|
|
217
|
+
return '';
|
|
218
|
+
}
|
|
219
|
+
hashes.add(classHash);
|
|
220
|
+
stylesheet += getNodeStyles(node, classHash);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
insertComponentStyles(root);
|
|
224
|
+
return stylesheet;
|
|
225
|
+
};
|
|
226
|
+
export const getAllFonts = (components) => {
|
|
227
|
+
return new Set(components
|
|
228
|
+
.flatMap((component) => {
|
|
229
|
+
return Object.values(component.nodes).flatMap((node) => {
|
|
230
|
+
if (node.type === 'element') {
|
|
231
|
+
return [
|
|
232
|
+
node.style.fontFamily,
|
|
233
|
+
node.style['font-family'],
|
|
234
|
+
...(node.variants?.map((v) => v.style.fontFamily ?? v.style['font-family']) ?? []),
|
|
235
|
+
].filter(isDefined);
|
|
236
|
+
}
|
|
237
|
+
return [];
|
|
238
|
+
});
|
|
239
|
+
})
|
|
240
|
+
.map((f) => f.replace('var(', '').replace(')', '').replace(/'/g, '')));
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=style.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../src/styling/style.css.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAMrC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,kBAAkB,GAAG;IACzB,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;CACZ,CAAA;AAED,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,MAAM;SACV,KAAK,CAAC,EAAE,CAAC;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,OAAO,4BAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC;YAChD,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,iBAAiB,EAAE;YAChC,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAA;AACb,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,OAAO;IACP,WAAW;IACX,WAAW;IACX,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,eAAe;IACf,cAAc;IACd,SAAS;IACT,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,KAAK;IACL,OAAO;IACP,OAAO;IACP,eAAe;IACf,2BAA2B;IAC3B,4BAA4B;IAC5B,wBAAwB;IACxB,yBAAyB;IACzB,cAAc;I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C,CAAC,SAAS,EAAE,EAAE;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC5B,OAAO;oBACL,IAAI,CAAC,KAAK,CAAC,UAAU;oBACrB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;oBACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CACpB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CACpD,IAAI,EAAE,CAAC;iBACT,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YACrB,CAAC;YACD,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CACxE,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { OldTheme } from './theme';
|
|
2
|
+
export declare const RESET_STYLES = "\n@layer reset {\n html {\n height:100%;\n }\n\n #App {\n height:100%;\n display:flex;\n flex-direction:column;\n }\n\n body {\n height:100%;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n margin:0;\n }\n\n [data-node-id]:not([data-unset-toddle-styles],[data-node-type=\"text\"],noscript,br,script,style,math,math *,link,template,meta,title,base), [data-node-id]:not([data-unset-toddle-styles],noscript)::before, [data-node-id]:not([data-unset-toddle-styles],noscript)::after {\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n flex-shrink: 0;\n\n position: relative;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n\n font-size: var(--text-base);\n font-family: var(--font-sans);\n font-weight: var(--font-weight-normal);\n\n background: transparent;\n color: inherit;\n border: none;\n box-shadow: none;\n }\n\n [data-node-id]:not([data-unset-toddle-styles]):is(p, h1, h2, h3, h4, h5, h6, label, span, strong, b, i, address, caption, code, cite, dt, dd, em, figcaption, legend, blockquote, abbr, pre, bdo, bdi) {\n display: inline-block;\n overflow-wrap: break-word;\n color: inherit;\n }\n\n [data-node-id]:not([data-unset-toddle-styles]):is(input, button, textarea, select) {\n outline: none;\n }\n\n [data-node-id]:not([data-unset-toddle-styles]):is(a) {\n color: inherit;\n text-decoration: none;\n }\n\n [data-node-id]:not([data-unset-toddle-styles]):is(ul, ol, li) {\n list-style: none;\n }\n\n [data-node-id]:not([data-unset-toddle-styles]):is(span[data-node-type=\"text\"]) {\n font: inherit;\n display: inline;\n flex-direction: column;\n flex-grow: 0;\n flex-shrink: 0;\n box-sizing: border-box;\n }\n\n [popover]:not(:popover-open):not(dialog[open]) {\n display: revert;\n }\n}";
|
|
3
|
+
export declare const theme: OldTheme;
|