@nordcraft/core 1.0.55 → 1.0.57
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/dist/component/ToddleComponent.d.ts +7 -7
- package/dist/component/component.types.d.ts +28 -46
- package/dist/component/component.types.js.map +1 -1
- package/dist/formula/formula.d.ts +2 -0
- package/dist/formula/formula.js +35 -26
- package/dist/formula/formula.js.map +1 -1
- package/dist/formula/formulaTypes.d.ts +0 -1
- package/dist/formula/formulaTypes.js +1 -3
- package/dist/formula/formulaTypes.js.map +1 -1
- package/dist/formula/formulaUtils.js +1 -2
- package/dist/formula/formulaUtils.js.map +1 -1
- package/dist/styling/style.css.js +4 -1
- package/dist/styling/style.css.js.map +1 -1
- package/dist/styling/variantSelector.d.ts +5 -76
- package/dist/styling/variantSelector.js.map +1 -1
- package/dist/utils/getNodeSelector.d.ts +1 -1
- package/dist/utils/getNodeSelector.js.map +1 -1
- package/package.json +1 -4
- package/src/component/component.types.ts +28 -47
- package/src/formula/formula.ts +47 -35
- package/src/formula/formulaTypes.ts +0 -7
- package/src/formula/formulaUtils.ts +1 -2
- package/src/styling/style.css.ts +14 -10
- package/src/styling/variantSelector.ts +5 -90
- package/src/utils/getNodeSelector.ts +1 -2
|
@@ -31,20 +31,20 @@ export declare class ToddleComponent<Handler> {
|
|
|
31
31
|
* @returns An iterable that yields the path and action.
|
|
32
32
|
*/
|
|
33
33
|
actionModelsInComponent(): Generator<[(string | number)[], ActionModel]>;
|
|
34
|
-
get formulas(): Record<string, import("./component.types").ComponentFormula> | undefined;
|
|
34
|
+
get formulas(): Record<string, import("./component.types").ComponentFormula> | null | undefined;
|
|
35
35
|
get name(): string;
|
|
36
36
|
get route(): import("./component.types").PageRoute | null | undefined;
|
|
37
37
|
get attributes(): Record<string, import("./component.types").ComponentAttribute>;
|
|
38
38
|
get variables(): Record<string, import("./component.types").ComponentVariable>;
|
|
39
|
-
get workflows(): Record<string, import("./component.types").ComponentWorkflow> | undefined;
|
|
39
|
+
get workflows(): Record<string, import("./component.types").ComponentWorkflow> | null | undefined;
|
|
40
40
|
get apis(): {
|
|
41
41
|
[k: string]: LegacyToddleApi<Handler> | ToddleApiV2<Handler>;
|
|
42
42
|
};
|
|
43
43
|
get nodes(): Record<string, NodeModel>;
|
|
44
|
-
get events(): import("./component.types").ComponentEvent[] | undefined;
|
|
45
|
-
get onLoad(): import("./component.types").EventModel | undefined;
|
|
46
|
-
get onAttributeChange(): import("./component.types").EventModel | undefined;
|
|
44
|
+
get events(): import("./component.types").ComponentEvent[] | null | undefined;
|
|
45
|
+
get onLoad(): import("./component.types").EventModel | null | undefined;
|
|
46
|
+
get onAttributeChange(): import("./component.types").EventModel | null | undefined;
|
|
47
47
|
get isPage(): boolean;
|
|
48
|
-
get contexts(): Record<string, import("./component.types").ComponentContext> | undefined;
|
|
49
|
-
get exported(): boolean | undefined;
|
|
48
|
+
get contexts(): Record<string, import("./component.types").ComponentContext> | null | undefined;
|
|
49
|
+
get exported(): boolean | null | undefined;
|
|
50
50
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiStatus, ComponentAPI, LegacyApiStatus } from '../api/apiTypes';
|
|
2
2
|
import type { Formula } from '../formula/formula';
|
|
3
3
|
import type { StyleTokenCategory } from '../styling/theme';
|
|
4
|
+
import type { StyleVariant } from '../styling/variantSelector';
|
|
4
5
|
import type { NordcraftMetadata, RequireFields } from '../types';
|
|
5
6
|
interface ListItem {
|
|
6
7
|
Item: unknown;
|
|
@@ -37,33 +38,14 @@ export interface AnimationKeyframe {
|
|
|
37
38
|
value: string;
|
|
38
39
|
easing?: never;
|
|
39
40
|
}
|
|
40
|
-
export interface StyleVariant {
|
|
41
|
-
id?: string;
|
|
42
|
-
className?: string;
|
|
43
|
-
hover?: boolean;
|
|
44
|
-
focus?: boolean;
|
|
45
|
-
focusWithin?: boolean;
|
|
46
|
-
active?: boolean;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
firstChild?: boolean;
|
|
49
|
-
lastChild?: boolean;
|
|
50
|
-
evenChild?: boolean;
|
|
51
|
-
empty?: boolean;
|
|
52
|
-
mediaQuery?: MediaQuery;
|
|
53
|
-
breakpoint: 'small' | 'medium' | 'large';
|
|
54
|
-
startingStyle?: boolean;
|
|
55
|
-
pseudoElement?: string;
|
|
56
|
-
style: NodeStyleModel;
|
|
57
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>;
|
|
58
|
-
}
|
|
59
41
|
export type NodeStyleModel = Record<string, string>;
|
|
60
42
|
export interface TextNodeModel {
|
|
61
|
-
id?: string;
|
|
43
|
+
id?: string | null;
|
|
62
44
|
type: 'text';
|
|
63
|
-
condition?: Formula;
|
|
64
|
-
repeat?: Formula;
|
|
65
|
-
slot?: string;
|
|
66
|
-
repeatKey?: Formula;
|
|
45
|
+
condition?: Formula | null;
|
|
46
|
+
repeat?: Formula | null;
|
|
47
|
+
slot?: string | null;
|
|
48
|
+
repeatKey?: Formula | null;
|
|
67
49
|
value: Formula;
|
|
68
50
|
children?: undefined;
|
|
69
51
|
}
|
|
@@ -84,13 +66,13 @@ export interface ElementNodeModel {
|
|
|
84
66
|
id?: string;
|
|
85
67
|
type: 'element';
|
|
86
68
|
slot?: string;
|
|
87
|
-
condition?: Formula;
|
|
88
|
-
repeat?: Formula;
|
|
89
|
-
repeatKey?: Formula;
|
|
69
|
+
condition?: Formula | null;
|
|
70
|
+
repeat?: Formula | null;
|
|
71
|
+
repeatKey?: Formula | null;
|
|
90
72
|
tag: string;
|
|
91
73
|
attrs: Partial<Record<string, Formula>>;
|
|
92
74
|
style: NodeStyleModel;
|
|
93
|
-
variants?: StyleVariant[];
|
|
75
|
+
variants?: StyleVariant[] | null;
|
|
94
76
|
animations?: Record<string, Record<string, AnimationKeyframe>>;
|
|
95
77
|
children: string[];
|
|
96
78
|
events: Partial<Record<string, EventModel | null>>;
|
|
@@ -107,11 +89,11 @@ export interface ComponentNodeModel {
|
|
|
107
89
|
path?: string;
|
|
108
90
|
name: string;
|
|
109
91
|
package?: string;
|
|
110
|
-
condition?: Formula;
|
|
111
|
-
repeat?: Formula;
|
|
112
|
-
repeatKey?: Formula;
|
|
92
|
+
condition?: Formula | null;
|
|
93
|
+
repeat?: Formula | null;
|
|
94
|
+
repeatKey?: Formula | null;
|
|
113
95
|
style?: NodeStyleModel;
|
|
114
|
-
variants?: StyleVariant[];
|
|
96
|
+
variants?: StyleVariant[] | null;
|
|
115
97
|
animations?: Record<string, Record<string, AnimationKeyframe>>;
|
|
116
98
|
attrs: Record<string, Formula>;
|
|
117
99
|
children: string[];
|
|
@@ -122,17 +104,17 @@ export interface SlotNodeModel {
|
|
|
122
104
|
type: 'slot';
|
|
123
105
|
slot?: string;
|
|
124
106
|
name?: string;
|
|
125
|
-
condition?: Formula;
|
|
126
|
-
repeat?: undefined;
|
|
127
|
-
repeatKey?: undefined;
|
|
107
|
+
condition?: Formula | null;
|
|
108
|
+
repeat?: undefined | null;
|
|
109
|
+
repeatKey?: undefined | null;
|
|
128
110
|
children: string[];
|
|
129
111
|
}
|
|
130
112
|
export type NodeModel = TextNodeModel | SlotNodeModel | ComponentNodeModel | ElementNodeModel;
|
|
131
113
|
export interface MetaEntry {
|
|
132
114
|
tag: HeadTagTypes;
|
|
133
115
|
attrs: Record<string, Formula>;
|
|
134
|
-
content
|
|
135
|
-
index?: number;
|
|
116
|
+
content?: Formula | null;
|
|
117
|
+
index?: number | null;
|
|
136
118
|
}
|
|
137
119
|
export interface StaticPathSegment {
|
|
138
120
|
type: 'static';
|
|
@@ -160,20 +142,20 @@ export interface Component {
|
|
|
160
142
|
* @default undefined (version 1)
|
|
161
143
|
* @deprecated - we are no longer using version 2 components, but we are keeping this field for backwards compatibility
|
|
162
144
|
*/
|
|
163
|
-
version?: 2;
|
|
164
|
-
page?: string;
|
|
145
|
+
version?: 2 | null;
|
|
146
|
+
page?: string | null;
|
|
165
147
|
route?: PageRoute | null;
|
|
166
148
|
attributes: Record<string, ComponentAttribute>;
|
|
167
149
|
variables: Record<string, ComponentVariable>;
|
|
168
|
-
formulas?: Record<string, ComponentFormula
|
|
169
|
-
contexts?: Record<string, ComponentContext
|
|
170
|
-
workflows?: Record<string, ComponentWorkflow
|
|
150
|
+
formulas?: Record<string, ComponentFormula> | null;
|
|
151
|
+
contexts?: Record<string, ComponentContext> | null;
|
|
152
|
+
workflows?: Record<string, ComponentWorkflow> | null;
|
|
171
153
|
apis: Record<string, ComponentAPI>;
|
|
172
154
|
nodes: Record<string, NodeModel>;
|
|
173
|
-
events?: ComponentEvent[];
|
|
174
|
-
onLoad?: EventModel;
|
|
175
|
-
onAttributeChange?: EventModel;
|
|
176
|
-
exported?: boolean;
|
|
155
|
+
events?: ComponentEvent[] | null;
|
|
156
|
+
onLoad?: EventModel | null;
|
|
157
|
+
onAttributeChange?: EventModel | null;
|
|
158
|
+
exported?: boolean | null;
|
|
177
159
|
}
|
|
178
160
|
export interface ComponentFormula extends NordcraftMetadata {
|
|
179
161
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.types.js","sourceRoot":"","sources":["../../src/component/component.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.types.js","sourceRoot":"","sources":["../../src/component/component.types.ts"],"names":[],"mappings":"AAmQA,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,6BAAa,CAAA;IACb,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,+BAAe,CAAA;AACjB,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Component, ComponentData } from '../component/component.types';
|
|
2
2
|
import type { CustomFormulaHandler, FormulaLookup, NordcraftMetadata, Runtime } from '../types';
|
|
3
|
+
import { type PluginFormula, type ToddleFormula } from './formulaTypes';
|
|
3
4
|
type ShadowRoot = DocumentFragment;
|
|
4
5
|
interface BaseOperation extends NordcraftMetadata {
|
|
5
6
|
label?: string;
|
|
@@ -104,5 +105,6 @@ export type ToddleEnv = ToddleServerEnv | {
|
|
|
104
105
|
};
|
|
105
106
|
export declare function isFormula(f: any): f is Formula;
|
|
106
107
|
export declare function isFormulaApplyOperation(formula: Formula): formula is ApplyOperation;
|
|
108
|
+
export declare const isToddleFormula: <Handler>(formula: PluginFormula<Handler>) => formula is ToddleFormula;
|
|
107
109
|
export declare function applyFormula(formula: Formula | string | number | undefined | null | boolean, ctx: FormulaContext): any;
|
|
108
110
|
export {};
|
package/dist/formula/formula.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDefined, toBoolean } from '../utils/util';
|
|
2
|
-
import {
|
|
2
|
+
import {} from './formulaTypes';
|
|
3
3
|
export function isFormula(f) {
|
|
4
4
|
return (f &&
|
|
5
5
|
typeof f === 'object' &&
|
|
@@ -20,6 +20,8 @@ export function isFormula(f) {
|
|
|
20
20
|
export function isFormulaApplyOperation(formula) {
|
|
21
21
|
return formula.type === 'apply';
|
|
22
22
|
}
|
|
23
|
+
export const isToddleFormula = (formula) => Object.hasOwn(formula, 'formula') &&
|
|
24
|
+
isDefined(formula.formula);
|
|
23
25
|
export function applyFormula(formula, ctx) {
|
|
24
26
|
if (!isFormula(formula)) {
|
|
25
27
|
return formula;
|
|
@@ -68,7 +70,6 @@ export function applyFormula(formula, ctx) {
|
|
|
68
70
|
const packageName = formula.package ?? ctx.package;
|
|
69
71
|
const newFunc = (ctx.toddle ??
|
|
70
72
|
globalThis.toddle)?.getCustomFormula(formula.name, packageName);
|
|
71
|
-
const legacyFunc = (ctx.toddle ?? globalThis.toddle).getFormula(formula.name);
|
|
72
73
|
if (isDefined(newFunc)) {
|
|
73
74
|
ctx.package = packageName;
|
|
74
75
|
const args = formula.arguments.reduce((args, arg, i) => ({
|
|
@@ -86,15 +87,18 @@ export function applyFormula(formula, ctx) {
|
|
|
86
87
|
: applyFormula(arg.formula, ctx),
|
|
87
88
|
}), {});
|
|
88
89
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (isToddleFormula(newFunc)) {
|
|
91
|
+
return applyFormula(newFunc.formula, {
|
|
91
92
|
...ctx,
|
|
92
93
|
data: { ...ctx.data, Args: args },
|
|
93
|
-
})
|
|
94
|
-
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return newFunc.handler(args, {
|
|
95
98
|
root: ctx.root ?? document,
|
|
96
99
|
env: ctx.env,
|
|
97
100
|
});
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
catch (e) {
|
|
100
104
|
ctx.toddle.errors.push(e);
|
|
@@ -104,27 +108,32 @@ export function applyFormula(formula, ctx) {
|
|
|
104
108
|
return null;
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
|
-
else
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
else {
|
|
112
|
+
// Lookup legacy formula
|
|
113
|
+
const legacyFunc = (ctx.toddle ??
|
|
114
|
+
globalThis.toddle).getFormula(formula.name);
|
|
115
|
+
if (typeof legacyFunc === 'function') {
|
|
116
|
+
const args = (formula.arguments ?? []).map((arg) => arg.isFunction
|
|
117
|
+
? (Args) => applyFormula(arg.formula, {
|
|
118
|
+
...ctx,
|
|
119
|
+
data: {
|
|
120
|
+
...ctx.data,
|
|
121
|
+
Args: ctx.data.Args
|
|
122
|
+
? { ...Args, '@toddle.parent': ctx.data.Args }
|
|
123
|
+
: Args,
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
: applyFormula(arg.formula, ctx));
|
|
127
|
+
try {
|
|
128
|
+
return legacyFunc(args, ctx);
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
ctx.toddle.errors.push(e);
|
|
132
|
+
if (ctx.env?.logErrors) {
|
|
133
|
+
console.error(e);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
126
136
|
}
|
|
127
|
-
return null;
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
139
|
if (ctx.env?.logErrors) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula.js","sourceRoot":"","sources":["../../src/formula/formula.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"formula.js","sourceRoot":"","sources":["../../src/formula/formula.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAA0C,MAAM,gBAAgB,CAAA;AAuIvE,MAAM,UAAU,SAAS,CAAC,CAAM;IAC9B,OAAO,CACL,CAAC;QACD,OAAO,CAAC,KAAK,QAAQ;QACrB,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;QAExB;YACE,MAAM;YACN,UAAU;YACV,QAAQ;YACR,QAAQ;YACR,OAAO;YACP,IAAI;YACJ,KAAK;YACL,OAAO;YACP,OAAO;YACP,QAAQ;SAEX,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CACnB,CAAA;AACH,CAAC;AACD,MAAM,UAAU,uBAAuB,CACrC,OAAgB;IAEhB,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,CAAA;AACjC,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAA+B,EACL,EAAE,CAC5B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC;IACjC,SAAS,CAAE,OAAyB,CAAC,OAAO,CAAC,CAAA;AAE/C,MAAM,UAAU,YAAY,CAC1B,OAA+D,EAC/D,GAAmB;IAEnB,IAAI,CAAC,SAAS,CAAC,OAAO,CAA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CAAC,IAAI;oBACX,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;wBACjB,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE;wBAC/C,CAAC,CAAC,KAAK;iBACV,CAAA;gBACD,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;gBAEzD,IAAI,KAAK,EAAE,GAAG,EAAE,CAAC;oBACf,OAAO,KAAK,CAAC,IAAI,CAAA;gBACnB,CAAC;qBAAM,CAAC;oBACN,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE;wBACpD,GAAG,GAAG;wBACN,IAAI;qBACL,CAAC,CAAA;oBACF,GAAG,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;oBACnD,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;YAED;gBACE,IAAI,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;oBACvB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAA;gBACvD,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -21,7 +21,6 @@ export interface CodeFormula<Handler = string | Function> extends BaseFormula {
|
|
|
21
21
|
handler: Handler;
|
|
22
22
|
}
|
|
23
23
|
export type PluginFormula<Handler = string | Function> = ToddleFormula | CodeFormula<Handler>;
|
|
24
|
-
export declare const isToddleFormula: <Handler>(formula: PluginFormula<Handler>) => formula is ToddleFormula;
|
|
25
24
|
export interface GlobalFormulas<Handler = string | Function> {
|
|
26
25
|
formulas?: Record<string, PluginFormula<Handler>>;
|
|
27
26
|
packages?: Partial<Record<string, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formulaTypes.js","sourceRoot":"","sources":["../../src/formula/formulaTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formulaTypes.js","sourceRoot":"","sources":["../../src/formula/formulaTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formulaUtils.js","sourceRoot":"","sources":["../../src/formula/formulaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzC,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"formulaUtils.js","sourceRoot":"","sources":["../../src/formula/formulaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAGtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAgD,EAChC,EAAE,CAAC,CAAC;IACpB,IAAI,EAAE,OAAO;IACb,KAAK;CACN,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAiB,EAAE,CAAC,CAAC;IAC7D,IAAI,EAAE,MAAM;IACZ,IAAI;CACL,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,IAAY,EACZ,OAA2D,EACxC,EAAE,CAAC,CAAC;IACvB,IAAI,EAAE,UAAU;IAChB,IAAI;IACJ,OAAO,EAAE,OAAO,EAAE,OAAO;IACzB,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE;IACnC,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;CAC9C,CAAC,CAAA;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AC,CAAC,mBAAmB,CAAC;wBACzB,MAAM,EAAE,CAAC;wBACT,cAAc;wBACd,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC;wBACnD,eAAe;wBACf,WAAW;qBACZ,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;YACD,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpE,KAAK,CAAC,CAAC,mBAAmB,CAAC;oBACzB,MAAM,EAAE,CAAC;oBACT,cAAc;oBACd,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;oBAChD,eAAe;oBACf,WAAW;iBACZ,CAAC,CAAA;YACJ,CAAC;YACD,MAAK;IACT,CAAC;AACH,CAAC"}
|
|
@@ -100,7 +100,10 @@ export const createStylesheet = (root, components, themes, options) => {
|
|
|
100
100
|
'breakpoints',
|
|
101
101
|
'shadows',
|
|
102
102
|
]);
|
|
103
|
-
const styleVariants = node.variants ??
|
|
103
|
+
const styleVariants = node.variants ??
|
|
104
|
+
// Support for old style variants stored inside style object
|
|
105
|
+
// Once we have better versioning options, this should be removed
|
|
106
|
+
node.style?.variants;
|
|
104
107
|
const renderVariant = (selector, style, options) => {
|
|
105
108
|
const scrollbarStyles = Object.entries(style).filter(([key]) => key === 'scrollbar-width');
|
|
106
109
|
// If selectorCss is empty, we don't need to render the selector
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../src/styling/style.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../src/styling/style.css.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,SAAS,E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AAA;IAE3B,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAuB,EAAE,EAAE;IACrD,OAAO,IAAI,GAAG,CACZ,UAAU;SACP,OAAO,CAAC,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"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AnimationKeyframe, CustomProperty, CustomPropertyName, EventModel, StyleVariable } from '../component/component.types';
|
|
3
|
-
import type { Formula } from '../formula/formula';
|
|
1
|
+
import type { CustomProperty, CustomPropertyName, NodeStyleModel } from '../component/component.types';
|
|
4
2
|
export type Shadow = {
|
|
5
3
|
x: number;
|
|
6
4
|
y: number;
|
|
@@ -16,10 +14,6 @@ export type Filter = {
|
|
|
16
14
|
name: 'Opacity';
|
|
17
15
|
percent: number;
|
|
18
16
|
};
|
|
19
|
-
export interface StyleDeclarationBlock extends CSSProperties {
|
|
20
|
-
filters?: Filter[];
|
|
21
|
-
shadows?: Shadow[];
|
|
22
|
-
}
|
|
23
17
|
type MediaQuery = {
|
|
24
18
|
'min-width'?: string;
|
|
25
19
|
'max-width'?: string;
|
|
@@ -27,8 +21,6 @@ type MediaQuery = {
|
|
|
27
21
|
'max-height'?: string;
|
|
28
22
|
};
|
|
29
23
|
export interface StyleVariant {
|
|
30
|
-
autofill?: boolean;
|
|
31
|
-
'nth-child(even)'?: boolean;
|
|
32
24
|
'even-child'?: boolean;
|
|
33
25
|
'first-child'?: boolean;
|
|
34
26
|
'first-of-type'?: boolean;
|
|
@@ -36,12 +28,15 @@ export interface StyleVariant {
|
|
|
36
28
|
'focus-within'?: boolean;
|
|
37
29
|
'last-child'?: boolean;
|
|
38
30
|
'last-of-type'?: boolean;
|
|
31
|
+
'nth-child(even)'?: boolean;
|
|
39
32
|
'popover-open'?: boolean;
|
|
40
33
|
active?: boolean;
|
|
34
|
+
autofill?: boolean;
|
|
41
35
|
breakpoint: 'small' | 'medium' | 'large';
|
|
42
36
|
checked?: boolean;
|
|
43
37
|
class?: string;
|
|
44
38
|
className?: string;
|
|
39
|
+
customProperties?: Record<CustomPropertyName, CustomProperty>;
|
|
45
40
|
disabled?: boolean;
|
|
46
41
|
empty?: boolean;
|
|
47
42
|
evenChild?: boolean;
|
|
@@ -56,74 +51,8 @@ export interface StyleVariant {
|
|
|
56
51
|
mediaQuery?: MediaQuery;
|
|
57
52
|
pseudoElement?: string;
|
|
58
53
|
startingStyle?: boolean;
|
|
59
|
-
style:
|
|
54
|
+
style: NodeStyleModel;
|
|
60
55
|
visited?: boolean;
|
|
61
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>;
|
|
62
|
-
}
|
|
63
|
-
export interface NodeStyleModel extends StyleDeclarationBlock {
|
|
64
|
-
variants?: StyleVariant[];
|
|
65
|
-
breakpoints?: {
|
|
66
|
-
small?: NodeStyleModel;
|
|
67
|
-
medium?: NodeStyleModel;
|
|
68
|
-
large?: NodeStyleModel;
|
|
69
|
-
};
|
|
70
|
-
mediaQuery?: MediaQuery;
|
|
71
56
|
}
|
|
72
|
-
export type NodeClass = {
|
|
73
|
-
name: string;
|
|
74
|
-
formula?: Formula;
|
|
75
|
-
};
|
|
76
|
-
export type NodeModel = ElementNodeModel | TextNodeModel | ComponentNodeModel | SlotNodeModel;
|
|
77
|
-
export type ElementNodeModel = {
|
|
78
|
-
id: string;
|
|
79
|
-
type: 'element';
|
|
80
|
-
condition?: Formula;
|
|
81
|
-
repeat?: Formula;
|
|
82
|
-
repeatKey?: Formula;
|
|
83
|
-
tag: string;
|
|
84
|
-
classList: NodeClass[];
|
|
85
|
-
attrs: Record<string, Formula>;
|
|
86
|
-
style: NodeStyleModel;
|
|
87
|
-
variants?: StyleVariant[];
|
|
88
|
-
animations?: Record<string, Record<string, AnimationKeyframe>>;
|
|
89
|
-
children: NodeModel[];
|
|
90
|
-
events: EventModel[];
|
|
91
|
-
'style-variables'?: Array<StyleVariable>;
|
|
92
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>;
|
|
93
|
-
};
|
|
94
|
-
export type ComponentNodeModel = {
|
|
95
|
-
id: string;
|
|
96
|
-
type: 'component';
|
|
97
|
-
path?: string;
|
|
98
|
-
name: string;
|
|
99
|
-
condition?: Formula;
|
|
100
|
-
repeat?: Formula;
|
|
101
|
-
repeatKey?: Formula;
|
|
102
|
-
style?: NodeStyleModel;
|
|
103
|
-
variants?: StyleVariant[];
|
|
104
|
-
animations?: Record<string, Record<string, AnimationKeyframe>>;
|
|
105
|
-
attrs: Record<string, Formula>;
|
|
106
|
-
children: NodeModel[];
|
|
107
|
-
events: EventModel[];
|
|
108
|
-
'style-variables'?: Array<StyleVariable>;
|
|
109
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>;
|
|
110
|
-
};
|
|
111
|
-
export type TextNodeModel = {
|
|
112
|
-
id: string;
|
|
113
|
-
type: 'text';
|
|
114
|
-
condition?: Formula;
|
|
115
|
-
repeat?: Formula;
|
|
116
|
-
repeatKey?: Formula;
|
|
117
|
-
value: Formula;
|
|
118
|
-
children?: undefined;
|
|
119
|
-
};
|
|
120
|
-
export type SlotNodeModel = {
|
|
121
|
-
id: string;
|
|
122
|
-
type: 'slot';
|
|
123
|
-
condition?: Formula;
|
|
124
|
-
repeat?: undefined;
|
|
125
|
-
repeatKey?: Formula;
|
|
126
|
-
children: NodeModel[];
|
|
127
|
-
};
|
|
128
57
|
export declare const variantSelector: (variant: StyleVariant) => string;
|
|
129
58
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variantSelector.js","sourceRoot":"","sources":["../../src/styling/variantSelector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variantSelector.js","sourceRoot":"","sources":["../../src/styling/variantSelector.ts"],"names":[],"mappings":"AAmEA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAqB,EAAE,EAAE,CACvD;IACE,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE;IAClE,CAAC,OAAO,CAAC,SAAS;QAChB,OAAO,CAAC,YAAY,CAAC;QACrB,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC3B,kBAAkB;IACpB,CAAC,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,cAAc;IAChE,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,eAAe;IACnE,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,aAAa;IAC7D,OAAO,CAAC,MAAM,IAAI,SAAS;IAC3B,OAAO,CAAC,QAAQ,IAAI,mCAAmC;IACvD,OAAO,CAAC,OAAO,IAAI,UAAU;IAC7B,OAAO,CAAC,QAAQ,IAAI,WAAW;IAC/B,OAAO,CAAC,KAAK,IAAI,QAAQ;IACzB,OAAO,CAAC,KAAK,IAAI,QAAQ;IACzB,OAAO,CAAC,KAAK,IAAI,QAAQ;IACzB,OAAO,CAAC,OAAO,IAAI,UAAU;IAC7B,OAAO,CAAC,IAAI,IAAI,OAAO;IACvB,OAAO,CAAC,OAAO,IAAI,UAAU;IAC7B,OAAO,CAAC,eAAe,CAAC,IAAI,gBAAgB;IAC5C,OAAO,CAAC,eAAe,CAAC,IAAI,gBAAgB;IAC5C,OAAO,CAAC,cAAc,CAAC,IAAI,eAAe;IAC1C,OAAO,CAAC,cAAc,CAAC,IAAI,eAAe;IAC1C,OAAO,CAAC,aAAa,IAAI,KAAK,OAAO,CAAC,aAAa,EAAE;CACtD;KACE,MAAM,CAAC,OAAO,CAAC;KACf,IAAI,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNodeSelector.js","sourceRoot":"","sources":["../../src/utils/getNodeSelector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getNodeSelector.js","sourceRoot":"","sources":["../../src/utils/getNodeSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAA;AAc/E,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,KAA0B,EAAE;IAE5D,IAAI,QAAQ,GAAG,aAAa,IAAI,IAAI,CAAA;IACpC,IAAI,aAAa,EAAE,CAAC;QAClB,QAAQ,IAAI,IAAI,aAAa,EAAE,CAAA;IACjC,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,QAAQ,IAAI,MAAM,MAAM,EAAE,CAAA;IAC5B,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,QAAQ,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://github.com/nordcraftengine/nordcraft",
|
|
6
|
-
"devDependencies": {
|
|
7
|
-
"@types/react": "19.1.8"
|
|
8
|
-
},
|
|
9
6
|
"scripts": {
|
|
10
7
|
"build": "tsc",
|
|
11
8
|
"npm-publish": "bun run build && bun publish --access public",
|
|
@@ -14,5 +11,5 @@
|
|
|
14
11
|
},
|
|
15
12
|
"files": ["dist", "src"],
|
|
16
13
|
"main": "dist/index.js",
|
|
17
|
-
"version": "1.0.
|
|
14
|
+
"version": "1.0.57"
|
|
18
15
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiStatus, ComponentAPI, LegacyApiStatus } from '../api/apiTypes'
|
|
2
2
|
import type { Formula } from '../formula/formula'
|
|
3
3
|
import type { StyleTokenCategory } from '../styling/theme'
|
|
4
|
+
import type { StyleVariant } from '../styling/variantSelector'
|
|
4
5
|
import type { NordcraftMetadata, RequireFields } from '../types'
|
|
5
6
|
|
|
6
7
|
interface ListItem {
|
|
@@ -44,35 +45,15 @@ export interface AnimationKeyframe {
|
|
|
44
45
|
easing?: never
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
export interface StyleVariant {
|
|
48
|
-
id?: string
|
|
49
|
-
className?: string
|
|
50
|
-
hover?: boolean
|
|
51
|
-
focus?: boolean
|
|
52
|
-
focusWithin?: boolean
|
|
53
|
-
active?: boolean
|
|
54
|
-
disabled?: boolean
|
|
55
|
-
firstChild?: boolean
|
|
56
|
-
lastChild?: boolean
|
|
57
|
-
evenChild?: boolean
|
|
58
|
-
empty?: boolean
|
|
59
|
-
mediaQuery?: MediaQuery
|
|
60
|
-
breakpoint: 'small' | 'medium' | 'large'
|
|
61
|
-
startingStyle?: boolean
|
|
62
|
-
pseudoElement?: string
|
|
63
|
-
style: NodeStyleModel
|
|
64
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
48
|
export type NodeStyleModel = Record<string, string>
|
|
68
49
|
|
|
69
50
|
export interface TextNodeModel {
|
|
70
|
-
id?: string
|
|
51
|
+
id?: string | null
|
|
71
52
|
type: 'text'
|
|
72
|
-
condition?: Formula
|
|
73
|
-
repeat?: Formula
|
|
74
|
-
slot?: string
|
|
75
|
-
repeatKey?: Formula
|
|
53
|
+
condition?: Formula | null
|
|
54
|
+
repeat?: Formula | null
|
|
55
|
+
slot?: string | null
|
|
56
|
+
repeatKey?: Formula | null
|
|
76
57
|
value: Formula
|
|
77
58
|
children?: undefined
|
|
78
59
|
}
|
|
@@ -97,13 +78,13 @@ export interface ElementNodeModel {
|
|
|
97
78
|
id?: string
|
|
98
79
|
type: 'element'
|
|
99
80
|
slot?: string
|
|
100
|
-
condition?: Formula
|
|
101
|
-
repeat?: Formula
|
|
102
|
-
repeatKey?: Formula
|
|
81
|
+
condition?: Formula | null
|
|
82
|
+
repeat?: Formula | null
|
|
83
|
+
repeatKey?: Formula | null
|
|
103
84
|
tag: string
|
|
104
85
|
attrs: Partial<Record<string, Formula>>
|
|
105
86
|
style: NodeStyleModel
|
|
106
|
-
variants?: StyleVariant[]
|
|
87
|
+
variants?: StyleVariant[] | null
|
|
107
88
|
animations?: Record<string, Record<string, AnimationKeyframe>>
|
|
108
89
|
children: string[]
|
|
109
90
|
events: Partial<Record<string, EventModel | null>>
|
|
@@ -119,11 +100,11 @@ export interface ComponentNodeModel {
|
|
|
119
100
|
path?: string
|
|
120
101
|
name: string
|
|
121
102
|
package?: string
|
|
122
|
-
condition?: Formula
|
|
123
|
-
repeat?: Formula
|
|
124
|
-
repeatKey?: Formula
|
|
103
|
+
condition?: Formula | null
|
|
104
|
+
repeat?: Formula | null
|
|
105
|
+
repeatKey?: Formula | null
|
|
125
106
|
style?: NodeStyleModel
|
|
126
|
-
variants?: StyleVariant[]
|
|
107
|
+
variants?: StyleVariant[] | null
|
|
127
108
|
animations?: Record<string, Record<string, AnimationKeyframe>>
|
|
128
109
|
attrs: Record<string, Formula>
|
|
129
110
|
children: string[]
|
|
@@ -135,9 +116,9 @@ export interface SlotNodeModel {
|
|
|
135
116
|
type: 'slot'
|
|
136
117
|
slot?: string
|
|
137
118
|
name?: string
|
|
138
|
-
condition?: Formula
|
|
139
|
-
repeat?: undefined
|
|
140
|
-
repeatKey?: undefined
|
|
119
|
+
condition?: Formula | null
|
|
120
|
+
repeat?: undefined | null
|
|
121
|
+
repeatKey?: undefined | null
|
|
141
122
|
children: string[]
|
|
142
123
|
}
|
|
143
124
|
export type NodeModel =
|
|
@@ -149,8 +130,8 @@ export type NodeModel =
|
|
|
149
130
|
export interface MetaEntry {
|
|
150
131
|
tag: HeadTagTypes
|
|
151
132
|
attrs: Record<string, Formula>
|
|
152
|
-
content
|
|
153
|
-
index?: number
|
|
133
|
+
content?: Formula | null
|
|
134
|
+
index?: number | null
|
|
154
135
|
}
|
|
155
136
|
|
|
156
137
|
export interface StaticPathSegment {
|
|
@@ -182,26 +163,26 @@ export interface Component {
|
|
|
182
163
|
* @default undefined (version 1)
|
|
183
164
|
* @deprecated - we are no longer using version 2 components, but we are keeping this field for backwards compatibility
|
|
184
165
|
*/
|
|
185
|
-
version?: 2
|
|
166
|
+
version?: 2 | null
|
|
186
167
|
// @deprecated - use route->path instead
|
|
187
|
-
page?: string // page url /projects/:id - only for pages
|
|
168
|
+
page?: string | null // page url /projects/:id - only for pages
|
|
188
169
|
route?: PageRoute | null
|
|
189
170
|
attributes: Record<string, ComponentAttribute>
|
|
190
171
|
variables: Record<string, ComponentVariable>
|
|
191
|
-
formulas?: Record<string, ComponentFormula>
|
|
172
|
+
formulas?: Record<string, ComponentFormula> | null
|
|
192
173
|
contexts?: Record<
|
|
193
174
|
// `componentName` or `packageName/componentName` if the context comes from a different package than the component itself
|
|
194
175
|
string,
|
|
195
176
|
ComponentContext
|
|
196
|
-
>
|
|
197
|
-
workflows?: Record<string, ComponentWorkflow>
|
|
177
|
+
> | null
|
|
178
|
+
workflows?: Record<string, ComponentWorkflow> | null
|
|
198
179
|
apis: Record<string, ComponentAPI>
|
|
199
180
|
nodes: Record<string, NodeModel>
|
|
200
|
-
events?: ComponentEvent[]
|
|
201
|
-
onLoad?: EventModel
|
|
202
|
-
onAttributeChange?: EventModel
|
|
181
|
+
events?: ComponentEvent[] | null
|
|
182
|
+
onLoad?: EventModel | null
|
|
183
|
+
onAttributeChange?: EventModel | null
|
|
203
184
|
// exported indicates that a component is exported in a package
|
|
204
|
-
exported?: boolean
|
|
185
|
+
exported?: boolean | null
|
|
205
186
|
}
|
|
206
187
|
|
|
207
188
|
export interface ComponentFormula extends NordcraftMetadata {
|
package/src/formula/formula.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
Toddle,
|
|
10
10
|
} from '../types'
|
|
11
11
|
import { isDefined, toBoolean } from '../utils/util'
|
|
12
|
-
import {
|
|
12
|
+
import { type PluginFormula, type ToddleFormula } from './formulaTypes'
|
|
13
13
|
|
|
14
14
|
// Define the some objects types as union of ServerSide and ClientSide runtime types as applyFormula is used in both
|
|
15
15
|
declare const document: Document | undefined
|
|
@@ -171,6 +171,12 @@ export function isFormulaApplyOperation(
|
|
|
171
171
|
return formula.type === 'apply'
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
export const isToddleFormula = <Handler>(
|
|
175
|
+
formula: PluginFormula<Handler>,
|
|
176
|
+
): formula is ToddleFormula =>
|
|
177
|
+
Object.hasOwn(formula, 'formula') &&
|
|
178
|
+
isDefined((formula as ToddleFormula).formula)
|
|
179
|
+
|
|
174
180
|
export function applyFormula(
|
|
175
181
|
formula: Formula | string | number | undefined | null | boolean,
|
|
176
182
|
ctx: FormulaContext,
|
|
@@ -224,9 +230,6 @@ export function applyFormula(
|
|
|
224
230
|
ctx.toddle ??
|
|
225
231
|
((globalThis as any).toddle as Toddle<unknown, unknown> | undefined)
|
|
226
232
|
)?.getCustomFormula(formula.name, packageName)
|
|
227
|
-
const legacyFunc: FormulaHandler | undefined = (
|
|
228
|
-
ctx.toddle ?? ((globalThis as any).toddle as Toddle<unknown, unknown>)
|
|
229
|
-
).getFormula(formula.name)
|
|
230
233
|
if (isDefined(newFunc)) {
|
|
231
234
|
ctx.package = packageName
|
|
232
235
|
const args = formula.arguments.reduce<Record<string, unknown>>(
|
|
@@ -248,15 +251,17 @@ export function applyFormula(
|
|
|
248
251
|
{},
|
|
249
252
|
)
|
|
250
253
|
try {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
if (isToddleFormula(newFunc)) {
|
|
255
|
+
return applyFormula(newFunc.formula, {
|
|
256
|
+
...ctx,
|
|
257
|
+
data: { ...ctx.data, Args: args },
|
|
258
|
+
})
|
|
259
|
+
} else {
|
|
260
|
+
return newFunc.handler(args, {
|
|
261
|
+
root: ctx.root ?? document,
|
|
262
|
+
env: ctx.env,
|
|
263
|
+
} as any)
|
|
264
|
+
}
|
|
260
265
|
} catch (e) {
|
|
261
266
|
ctx.toddle.errors.push(e as Error)
|
|
262
267
|
if (ctx.env?.logErrors) {
|
|
@@ -264,29 +269,36 @@ export function applyFormula(
|
|
|
264
269
|
}
|
|
265
270
|
return null
|
|
266
271
|
}
|
|
267
|
-
} else
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
272
|
+
} else {
|
|
273
|
+
// Lookup legacy formula
|
|
274
|
+
const legacyFunc: FormulaHandler | undefined = (
|
|
275
|
+
ctx.toddle ??
|
|
276
|
+
((globalThis as any).toddle as Toddle<unknown, unknown>)
|
|
277
|
+
).getFormula(formula.name)
|
|
278
|
+
if (typeof legacyFunc === 'function') {
|
|
279
|
+
const args = (formula.arguments ?? []).map((arg) =>
|
|
280
|
+
arg.isFunction
|
|
281
|
+
? (Args: any) =>
|
|
282
|
+
applyFormula(arg.formula, {
|
|
283
|
+
...ctx,
|
|
284
|
+
data: {
|
|
285
|
+
...ctx.data,
|
|
286
|
+
Args: ctx.data.Args
|
|
287
|
+
? { ...Args, '@toddle.parent': ctx.data.Args }
|
|
288
|
+
: Args,
|
|
289
|
+
},
|
|
290
|
+
})
|
|
291
|
+
: applyFormula(arg.formula, ctx),
|
|
292
|
+
)
|
|
293
|
+
try {
|
|
294
|
+
return legacyFunc(args, ctx as any)
|
|
295
|
+
} catch (e) {
|
|
296
|
+
ctx.toddle.errors.push(e as Error)
|
|
297
|
+
if (ctx.env?.logErrors) {
|
|
298
|
+
console.error(e)
|
|
299
|
+
}
|
|
300
|
+
return null
|
|
288
301
|
}
|
|
289
|
-
return null
|
|
290
302
|
}
|
|
291
303
|
}
|
|
292
304
|
if (ctx.env?.logErrors) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isDefined } from '../utils/util'
|
|
2
1
|
import type { Formula } from './formula'
|
|
3
2
|
|
|
4
3
|
export interface BaseFormula {
|
|
@@ -30,12 +29,6 @@ export type PluginFormula<Handler = string | Function> =
|
|
|
30
29
|
| ToddleFormula
|
|
31
30
|
| CodeFormula<Handler>
|
|
32
31
|
|
|
33
|
-
export const isToddleFormula = <Handler>(
|
|
34
|
-
formula: PluginFormula<Handler>,
|
|
35
|
-
): formula is ToddleFormula =>
|
|
36
|
-
Object.hasOwn(formula, 'formula') &&
|
|
37
|
-
isDefined((formula as ToddleFormula).formula)
|
|
38
|
-
|
|
39
32
|
export interface GlobalFormulas<Handler = string | Function> {
|
|
40
33
|
formulas?: Record<string, PluginFormula<Handler>>
|
|
41
34
|
packages?: Partial<
|
|
@@ -6,9 +6,8 @@ import type {
|
|
|
6
6
|
PathOperation,
|
|
7
7
|
ValueOperation,
|
|
8
8
|
} from './formula'
|
|
9
|
-
import { isFormula } from './formula'
|
|
9
|
+
import { isFormula, isToddleFormula } from './formula'
|
|
10
10
|
import type { GlobalFormulas } from './formulaTypes'
|
|
11
|
-
import { isToddleFormula } from './formulaTypes'
|
|
12
11
|
|
|
13
12
|
export const valueFormula = (
|
|
14
13
|
value: string | number | boolean | null | object,
|
package/src/styling/style.css.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// cSpell:ignore thinn, ABCDEFGHIJKLMNOPQRSTYVWXYZ
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Component,
|
|
4
|
+
ComponentNodeModel,
|
|
5
|
+
ElementNodeModel,
|
|
6
|
+
NodeStyleModel,
|
|
7
|
+
} from '../component/component.types'
|
|
3
8
|
import { omitKeys } from '../utils/collections'
|
|
4
9
|
import { isDefined } from '../utils/util'
|
|
5
10
|
import { getClassName, toValidClassName } from './className'
|
|
6
11
|
import type { OldTheme, Theme, ThemeOptions } from './theme'
|
|
7
12
|
import { getThemeCss } from './theme'
|
|
8
|
-
import type
|
|
9
|
-
ComponentNodeModel,
|
|
10
|
-
ElementNodeModel,
|
|
11
|
-
StyleDeclarationBlock,
|
|
12
|
-
} from './variantSelector'
|
|
13
|
-
import { variantSelector } from './variantSelector'
|
|
13
|
+
import { variantSelector, type StyleVariant } from './variantSelector'
|
|
14
14
|
|
|
15
15
|
const LEGACY_BREAKPOINTS = {
|
|
16
16
|
large: 1440,
|
|
@@ -108,7 +108,7 @@ export const createStylesheet = (
|
|
|
108
108
|
),
|
|
109
109
|
options,
|
|
110
110
|
)
|
|
111
|
-
const styleToCss = (style:
|
|
111
|
+
const styleToCss = (style: NodeStyleModel) => {
|
|
112
112
|
return Object.entries(style)
|
|
113
113
|
.map(([property, value]) => {
|
|
114
114
|
if (!isDefined(value)) {
|
|
@@ -136,10 +136,14 @@ export const createStylesheet = (
|
|
|
136
136
|
'breakpoints',
|
|
137
137
|
'shadows',
|
|
138
138
|
])
|
|
139
|
-
const styleVariants =
|
|
139
|
+
const styleVariants =
|
|
140
|
+
node.variants ??
|
|
141
|
+
// Support for old style variants stored inside style object
|
|
142
|
+
// Once we have better versioning options, this should be removed
|
|
143
|
+
(node.style?.variants as any as StyleVariant[])
|
|
140
144
|
const renderVariant = (
|
|
141
145
|
selector: string,
|
|
142
|
-
style:
|
|
146
|
+
style: NodeStyleModel,
|
|
143
147
|
options?: { startingStyle?: boolean },
|
|
144
148
|
) => {
|
|
145
149
|
const scrollbarStyles = Object.entries(style).filter(
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react'
|
|
2
1
|
import type {
|
|
3
|
-
AnimationKeyframe,
|
|
4
2
|
CustomProperty,
|
|
5
3
|
CustomPropertyName,
|
|
6
|
-
|
|
7
|
-
StyleVariable,
|
|
4
|
+
NodeStyleModel,
|
|
8
5
|
} from '../component/component.types'
|
|
9
|
-
import type { Formula } from '../formula/formula'
|
|
10
6
|
|
|
11
7
|
export type Shadow = {
|
|
12
8
|
x: number
|
|
@@ -27,11 +23,6 @@ export type Filter =
|
|
|
27
23
|
percent: number
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
export interface StyleDeclarationBlock extends CSSProperties {
|
|
31
|
-
filters?: Filter[]
|
|
32
|
-
shadows?: Shadow[]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
type MediaQuery = {
|
|
36
27
|
'min-width'?: string
|
|
37
28
|
'max-width'?: string
|
|
@@ -40,8 +31,6 @@ type MediaQuery = {
|
|
|
40
31
|
}
|
|
41
32
|
|
|
42
33
|
export interface StyleVariant {
|
|
43
|
-
autofill?: boolean
|
|
44
|
-
'nth-child(even)'?: boolean
|
|
45
34
|
'even-child'?: boolean
|
|
46
35
|
'first-child'?: boolean
|
|
47
36
|
'first-of-type'?: boolean
|
|
@@ -49,12 +38,15 @@ export interface StyleVariant {
|
|
|
49
38
|
'focus-within'?: boolean
|
|
50
39
|
'last-child'?: boolean
|
|
51
40
|
'last-of-type'?: boolean
|
|
41
|
+
'nth-child(even)'?: boolean
|
|
52
42
|
'popover-open'?: boolean
|
|
53
43
|
active?: boolean
|
|
44
|
+
autofill?: boolean
|
|
54
45
|
breakpoint: 'small' | 'medium' | 'large'
|
|
55
46
|
checked?: boolean
|
|
56
47
|
class?: string
|
|
57
48
|
className?: string
|
|
49
|
+
customProperties?: Record<CustomPropertyName, CustomProperty>
|
|
58
50
|
disabled?: boolean
|
|
59
51
|
empty?: boolean
|
|
60
52
|
evenChild?: boolean
|
|
@@ -69,85 +61,8 @@ export interface StyleVariant {
|
|
|
69
61
|
mediaQuery?: MediaQuery
|
|
70
62
|
pseudoElement?: string
|
|
71
63
|
startingStyle?: boolean
|
|
72
|
-
style: StyleDeclarationBlock
|
|
73
|
-
visited?: boolean
|
|
74
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface NodeStyleModel extends StyleDeclarationBlock {
|
|
78
|
-
variants?: StyleVariant[]
|
|
79
|
-
breakpoints?: {
|
|
80
|
-
small?: NodeStyleModel
|
|
81
|
-
medium?: NodeStyleModel
|
|
82
|
-
large?: NodeStyleModel
|
|
83
|
-
}
|
|
84
|
-
mediaQuery?: MediaQuery
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export type NodeClass = {
|
|
88
|
-
name: string
|
|
89
|
-
formula?: Formula
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type NodeModel =
|
|
93
|
-
| ElementNodeModel
|
|
94
|
-
| TextNodeModel
|
|
95
|
-
| ComponentNodeModel
|
|
96
|
-
| SlotNodeModel
|
|
97
|
-
|
|
98
|
-
export type ElementNodeModel = {
|
|
99
|
-
id: string
|
|
100
|
-
type: 'element'
|
|
101
|
-
condition?: Formula
|
|
102
|
-
repeat?: Formula
|
|
103
|
-
repeatKey?: Formula
|
|
104
|
-
tag: string
|
|
105
|
-
classList: NodeClass[]
|
|
106
|
-
attrs: Record<string, Formula>
|
|
107
64
|
style: NodeStyleModel
|
|
108
|
-
|
|
109
|
-
animations?: Record<string, Record<string, AnimationKeyframe>>
|
|
110
|
-
children: NodeModel[]
|
|
111
|
-
events: EventModel[]
|
|
112
|
-
'style-variables'?: Array<StyleVariable>
|
|
113
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export type ComponentNodeModel = {
|
|
117
|
-
id: string
|
|
118
|
-
type: 'component'
|
|
119
|
-
path?: string
|
|
120
|
-
name: string
|
|
121
|
-
condition?: Formula
|
|
122
|
-
repeat?: Formula
|
|
123
|
-
repeatKey?: Formula
|
|
124
|
-
style?: NodeStyleModel
|
|
125
|
-
variants?: StyleVariant[]
|
|
126
|
-
animations?: Record<string, Record<string, AnimationKeyframe>>
|
|
127
|
-
attrs: Record<string, Formula>
|
|
128
|
-
children: NodeModel[]
|
|
129
|
-
events: EventModel[]
|
|
130
|
-
'style-variables'?: Array<StyleVariable>
|
|
131
|
-
customProperties?: Record<CustomPropertyName, CustomProperty>
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export type TextNodeModel = {
|
|
135
|
-
id: string
|
|
136
|
-
type: 'text'
|
|
137
|
-
condition?: Formula
|
|
138
|
-
repeat?: Formula
|
|
139
|
-
repeatKey?: Formula
|
|
140
|
-
value: Formula
|
|
141
|
-
children?: undefined
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export type SlotNodeModel = {
|
|
145
|
-
id: string
|
|
146
|
-
type: 'slot'
|
|
147
|
-
condition?: Formula
|
|
148
|
-
repeat?: undefined
|
|
149
|
-
repeatKey?: Formula
|
|
150
|
-
children: NodeModel[]
|
|
65
|
+
visited?: boolean
|
|
151
66
|
}
|
|
152
67
|
|
|
153
68
|
export const variantSelector = (variant: StyleVariant) =>
|