@mrts/soltw 0.3.12 → 0.3.13
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/Block.d.ts +13 -0
- package/dist/Block.js +33 -0
- package/dist/Block.jsx +24 -0
- package/dist/index.d.ts +10 -125
- package/dist/index.js +10 -3689
- package/dist/index.jsx +10 -3604
- package/dist/items/IdLabel.d.ts +15 -0
- package/dist/items/IdLabel.js +19 -0
- package/dist/items/IdLabel.jsx +19 -0
- package/dist/items/Item.d.ts +25 -0
- package/dist/items/Item.js +75 -0
- package/dist/items/Item.jsx +60 -0
- package/dist/items/ItemGroup.d.ts +24 -0
- package/dist/items/ItemGroup.js +86 -0
- package/dist/items/ItemGroup.jsx +63 -0
- package/dist/node_modules/solid-js/dist/solid.js +677 -0
- package/dist/node_modules/solid-js/dist/solid.jsx +654 -0
- package/dist/node_modules/solid-js/web/dist/web.js +694 -0
- package/dist/node_modules/solid-js/web/dist/web.jsx +678 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.jsx +1893 -0
- package/dist/packages/common/dist/index.js +4 -0
- package/dist/packages/common/dist/index.jsx +4 -0
- package/dist/packages/common/dist/messages/index.js +1 -0
- package/dist/packages/common/dist/messages/index.jsx +1 -0
- package/dist/packages/common/dist/messages/logMessages.js +14 -0
- package/dist/packages/common/dist/messages/logMessages.jsx +14 -0
- package/dist/packages/common/dist/strings/index.js +1 -0
- package/dist/packages/common/dist/strings/index.jsx +1 -0
- package/dist/packages/common/dist/strings/tokenize.js +47 -0
- package/dist/packages/common/dist/strings/tokenize.jsx +47 -0
- package/dist/soltw.d.ts +7 -0
- package/dist/soltw.js +10 -0
- package/dist/soltw.jsx +7 -0
- package/dist/stylers/SVTStyler.d.ts +32 -0
- package/dist/stylers/SVTStyler.js +65 -0
- package/dist/stylers/SVTStyler.jsx +65 -0
- package/dist/stylers/Stylers.d.ts +12 -0
- package/dist/stylers/Stylers.js +23 -0
- package/dist/stylers/Stylers.jsx +23 -0
- package/dist/stylers/base.styler.d.ts +6 -0
- package/dist/stylers/base.styler.js +71 -0
- package/dist/stylers/base.styler.jsx +71 -0
- package/dist/stylers/index.js +4 -0
- package/dist/stylers/index.jsx +4 -0
- package/dist/stylers/normalizers.d.ts +6 -0
- package/dist/stylers/normalizers.js +32 -0
- package/dist/stylers/normalizers.jsx +32 -0
- package/dist/stylers/types.d.ts +14 -0
- package/package.json +2 -2
package/dist/Block.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ISVTStyler, TagListArgument } from "./stylers/types.js";
|
|
2
|
+
import { Component, ParentProps } from "solid-js";
|
|
3
|
+
|
|
4
|
+
//#region src/Block.d.ts
|
|
5
|
+
type TProps = ParentProps & {
|
|
6
|
+
vtags?: TagListArgument;
|
|
7
|
+
styler?: ISVTStyler;
|
|
8
|
+
class?: string;
|
|
9
|
+
element?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const Block: Component<TProps>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Block };
|
package/dist/Block.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createComponent } from "./node_modules/solid-js/dist/solid.js";
|
|
2
|
+
import { Dynamic } from "./node_modules/solid-js/web/dist/web.js";
|
|
3
|
+
import { twMerge } from "./node_modules/tailwind-merge/dist/bundle-mjs.js";
|
|
4
|
+
import { Stylers } from "./stylers/Stylers.js";
|
|
5
|
+
import "./stylers/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/Block.tsx
|
|
8
|
+
const Block = (props) => {
|
|
9
|
+
const elementTag = () => props.element ?? "div";
|
|
10
|
+
const currentStyler = () => {
|
|
11
|
+
if (props.styler) return props.styler;
|
|
12
|
+
else return Stylers.base;
|
|
13
|
+
};
|
|
14
|
+
function blockClasses() {
|
|
15
|
+
const classes = currentStyler().classes("block", props.vtags) ?? [];
|
|
16
|
+
if (props.class) classes.push(props.class);
|
|
17
|
+
return twMerge(classes);
|
|
18
|
+
}
|
|
19
|
+
return createComponent(Dynamic, {
|
|
20
|
+
get component() {
|
|
21
|
+
return elementTag();
|
|
22
|
+
},
|
|
23
|
+
get ["class"]() {
|
|
24
|
+
return blockClasses();
|
|
25
|
+
},
|
|
26
|
+
get children() {
|
|
27
|
+
return props.children;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Block };
|
package/dist/Block.jsx
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { twMerge } from "./node_modules/tailwind-merge/dist/bundle-mjs.jsx";
|
|
2
|
+
import { Stylers } from "./stylers/Stylers.jsx";
|
|
3
|
+
import { Dynamic } from "./node_modules/solid-js/web/dist/web.jsx";
|
|
4
|
+
import "./stylers/index.jsx";
|
|
5
|
+
|
|
6
|
+
//#region src/Block.tsx
|
|
7
|
+
const Block = (props) => {
|
|
8
|
+
const elementTag = () => props.element ?? "div";
|
|
9
|
+
const currentStyler = () => {
|
|
10
|
+
if (props.styler) return props.styler;
|
|
11
|
+
else return Stylers.base;
|
|
12
|
+
};
|
|
13
|
+
function blockClasses() {
|
|
14
|
+
const classes = currentStyler().classes("block", props.vtags) ?? [];
|
|
15
|
+
if (props.class) classes.push(props.class);
|
|
16
|
+
return twMerge(classes);
|
|
17
|
+
}
|
|
18
|
+
return <Dynamic component={elementTag()} class={blockClasses()}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</Dynamic>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Block };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,126 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
id: string;
|
|
12
|
-
label?: string;
|
|
13
|
-
[x: string | symbol]: unknown;
|
|
14
|
-
};
|
|
15
|
-
type IdLabelArg = IdLabelDef | [string, string] | string;
|
|
16
|
-
declare function buildIdLabel(arg: IdLabelArg): IdLabel;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/stylers/types.d.ts
|
|
19
|
-
type TagListArgument = TokenizeArg;
|
|
20
|
-
interface ISVTStyler {
|
|
21
|
-
classes(stags: TagListArgument, vtags: TagListArgument): string[] | undefined;
|
|
22
|
-
}
|
|
23
|
-
type TagRuleMode = "or" | "and" | "any";
|
|
24
|
-
type TagRule = {
|
|
25
|
-
mode: TagRuleMode;
|
|
26
|
-
tags: string[];
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/stylers/Stylers.d.ts
|
|
30
|
-
declare class Stylers {
|
|
31
|
-
private static _base;
|
|
32
|
-
private static _stylersMap;
|
|
33
|
-
static get base(): ISVTStyler | undefined;
|
|
34
|
-
static setBase(base: ISVTStyler | undefined): ISVTStyler | undefined;
|
|
35
|
-
static get(name: string): ISVTStyler | undefined;
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/stylers/normalizers.d.ts
|
|
39
|
-
declare function twMergeNormalize(raw: string[]): string[];
|
|
40
|
-
declare function mainTagNormalize(rawTags: string[], defaultTag?: string): string[];
|
|
41
|
-
declare function exclusiveTagsNormalize(rawTags: string[], tagSet: Set<String> | ((tag: string) => boolean), defaultTag?: string): string[];
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/stylers/SVTStyler.d.ts
|
|
44
|
-
type SVTRule = {
|
|
45
|
-
stagRule: TagRule;
|
|
46
|
-
vtagRule: TagRule;
|
|
47
|
-
classes: string[];
|
|
48
|
-
};
|
|
49
|
-
type SVTRuleDef = {
|
|
50
|
-
stagMode?: TagRuleMode;
|
|
51
|
-
vtagMode?: TagRuleMode;
|
|
52
|
-
stags?: TagListArgument;
|
|
53
|
-
vtags?: TagListArgument;
|
|
54
|
-
classes?: TagListArgument;
|
|
55
|
-
};
|
|
56
|
-
type SVTStylerOptions = {
|
|
57
|
-
normalizer?: (rawClasses: string[]) => string[];
|
|
58
|
-
stagsNormaliser?: (rawTags: string[]) => string[];
|
|
59
|
-
vtagsNormaliser?: (rawTags: string[]) => string[];
|
|
60
|
-
};
|
|
61
|
-
declare class SVTStyler implements ISVTStyler {
|
|
62
|
-
readonly _rules: SVTRule[];
|
|
63
|
-
readonly options: SVTStylerOptions;
|
|
64
|
-
constructor(rules: SVTRuleDef[], options?: SVTStylerOptions);
|
|
65
|
-
with(rules: SVTRuleDef[], options?: SVTStylerOptions): SVTStyler;
|
|
66
|
-
classes(stags: TagListArgument, vtags: TagListArgument): string[];
|
|
67
|
-
static normalizeRule(rule: SVTRuleDef): SVTRule;
|
|
68
|
-
ruleMatches(rule: SVTRule, stags: string[], vtags: string[]): boolean;
|
|
69
|
-
}
|
|
70
|
-
declare function tagRuleMatches(rule: TagRule, candidateTags: string[]): boolean;
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/stylers/base.styler.d.ts
|
|
73
|
-
declare const baseStyler: SVTStyler;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/items/Item.d.ts
|
|
76
|
-
type TItemClass = {
|
|
77
|
-
item?: string;
|
|
78
|
-
selected?: string;
|
|
79
|
-
disabled?: string;
|
|
80
|
-
disabler?: string;
|
|
81
|
-
};
|
|
82
|
-
type TItemClassArg = TItemClass | string;
|
|
83
|
-
type TItemProps = {
|
|
84
|
-
idLabel: IdLabelArg;
|
|
85
|
-
callback?: (item: IdLabel) => void;
|
|
86
|
-
selected?: boolean;
|
|
87
|
-
disabled?: boolean;
|
|
88
|
-
clickableWhendisabled?: boolean;
|
|
89
|
-
styler?: ISVTStyler;
|
|
90
|
-
vtags?: TagListArgument;
|
|
91
|
-
class?: TItemClassArg;
|
|
92
|
-
};
|
|
93
|
-
declare const Item: Component<TItemProps>;
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/Block.d.ts
|
|
96
|
-
type TProps$2 = ParentProps & {
|
|
97
|
-
vtags?: TagListArgument;
|
|
98
|
-
styler?: ISVTStyler;
|
|
99
|
-
class?: string;
|
|
100
|
-
element?: string;
|
|
101
|
-
};
|
|
102
|
-
declare const Block: Component<TProps$2>;
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/items/ItemGroup.d.ts
|
|
105
|
-
type TProps$1 = {
|
|
106
|
-
items: IdLabelArg[];
|
|
107
|
-
callback?: (item: IdLabel) => void;
|
|
108
|
-
class?: string | {
|
|
109
|
-
group?: string;
|
|
110
|
-
item?: TItemClassArg;
|
|
111
|
-
};
|
|
112
|
-
selection?: string | {
|
|
113
|
-
[id: string]: boolean;
|
|
114
|
-
};
|
|
115
|
-
vtags?: TagListArgument | {
|
|
116
|
-
group?: TagListArgument;
|
|
117
|
-
item?: TagListArgument;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
declare const ItemGroup: Component<TProps$1>;
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/soltw.d.ts
|
|
123
|
-
type TProps = {};
|
|
124
|
-
declare const SolTw: Component<TProps>;
|
|
125
|
-
//#endregion
|
|
1
|
+
import { IdLabel, IdLabelArg, IdLabelDef, buildIdLabel } from "./items/IdLabel.js";
|
|
2
|
+
import { ISVTStyler, TagListArgument, TagRule, TagRuleMode } from "./stylers/types.js";
|
|
3
|
+
import { Stylers } from "./stylers/Stylers.js";
|
|
4
|
+
import { exclusiveTagsNormalize, mainTagNormalize, twMergeNormalize } from "./stylers/normalizers.js";
|
|
5
|
+
import { SVTRule, SVTRuleDef, SVTStyler, tagRuleMatches } from "./stylers/SVTStyler.js";
|
|
6
|
+
import { baseStyler } from "./stylers/base.styler.js";
|
|
7
|
+
import { Item, TItemClass, TItemClassArg, TItemProps } from "./items/Item.js";
|
|
8
|
+
import { Block } from "./Block.js";
|
|
9
|
+
import { ItemGroup } from "./items/ItemGroup.js";
|
|
10
|
+
import { SolTw } from "./soltw.js";
|
|
126
11
|
export { Block, ISVTStyler, IdLabel, IdLabelArg, IdLabelDef, Item, ItemGroup, SVTRule, SVTRuleDef, SVTStyler, SolTw, Stylers, TItemClass, TItemClassArg, TItemProps, TagListArgument, TagRule, TagRuleMode, baseStyler, buildIdLabel, exclusiveTagsNormalize, mainTagNormalize, tagRuleMatches, twMergeNormalize };
|