carbon-preprocess-svelte 0.10.0 → 0.11.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.
Files changed (48) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +162 -348
  3. package/dist/component-index.d.ts +4 -0
  4. package/dist/component-index.js +1924 -0
  5. package/dist/constants.d.ts +8 -14
  6. package/dist/constants.js +7 -0
  7. package/dist/index.d.ts +3 -4
  8. package/dist/index.js +12 -83167
  9. package/dist/plugins/OptimizeCssPlugin.d.ts +8 -0
  10. package/dist/plugins/OptimizeCssPlugin.js +49 -0
  11. package/dist/plugins/compare-diff.d.ts +6 -0
  12. package/dist/plugins/compare-diff.js +36 -0
  13. package/dist/plugins/create-optimized-css.d.ts +25 -0
  14. package/dist/plugins/create-optimized-css.js +89 -0
  15. package/dist/plugins/optimize-css.d.ts +3 -10
  16. package/dist/plugins/optimize-css.js +49 -0
  17. package/dist/preprocessors/optimize-imports.d.ts +3 -3
  18. package/dist/preprocessors/optimize-imports.js +65 -0
  19. package/dist/utils.d.ts +3 -11
  20. package/dist/utils.js +16 -0
  21. package/package.json +21 -49
  22. package/CHANGELOG.md +0 -136
  23. package/dist/build/build-components.d.ts +0 -9
  24. package/dist/build/build-elements.d.ts +0 -10
  25. package/dist/build/build-icons.d.ts +0 -15
  26. package/dist/build/build-pictograms.d.ts +0 -54
  27. package/dist/build/index.d.ts +0 -19
  28. package/dist/build/type.d.ts +0 -11
  29. package/dist/carbon-components-svelte.d.ts +0 -681
  30. package/dist/carbon-elements.d.ts +0 -833
  31. package/dist/carbon-icons.d.ts +0 -84420
  32. package/dist/carbon-pictograms.d.ts +0 -8839
  33. package/dist/extractors/extract-selectors.d.ts +0 -14
  34. package/dist/extractors/index.d.ts +0 -1
  35. package/dist/index.cjs.d.ts +0 -4
  36. package/dist/index.mjs +0 -83182
  37. package/dist/plugins/index.d.ts +0 -1
  38. package/dist/plugins/optimize-css.cjs.d.ts +0 -10
  39. package/dist/preprocessors/collect-headings.d.ts +0 -27
  40. package/dist/preprocessors/elements.d.ts +0 -22
  41. package/dist/preprocessors/icons.d.ts +0 -2
  42. package/dist/preprocessors/include.d.ts +0 -49
  43. package/dist/preprocessors/index.d.ts +0 -6
  44. package/dist/preprocessors/pictograms.d.ts +0 -2
  45. package/dist/presets/index.d.ts +0 -1
  46. package/dist/presets/preset-carbon.d.ts +0 -7
  47. package/dist/walk-and-replace.d.ts +0 -117
  48. package/src/carbon-components-svelte.js +0 -513
@@ -1 +0,0 @@
1
- export * from "./optimize-css";
@@ -1,10 +0,0 @@
1
- import Rollup from "rollup";
2
- interface OptimizeCssOptions {
3
- safelist: {
4
- standard?: Array<RegExp | string>;
5
- deep?: RegExp[];
6
- greedy?: RegExp[];
7
- };
8
- }
9
- export declare function optimizeCss(options?: Partial<OptimizeCssOptions>): Rollup.Plugin;
10
- export {};
@@ -1,27 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- /**
3
- * Corresponds to the semantic heading element number
4
- * @example
5
- * <h1 /> --> 1
6
- * <h2 /> --> 2
7
- */
8
- declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
9
- declare type Headings = Array<{
10
- id?: string;
11
- text: string;
12
- level: HeadingLevel;
13
- }>;
14
- interface CollectHeadingsOptions {
15
- /**
16
- * Specify the filename pattern to process
17
- * Defaults to files ending with ".svelte"
18
- * @default /\.(svelte)$/
19
- */
20
- test: RegExp;
21
- /**
22
- * Optional callback to transform the content after extracting all headings
23
- */
24
- afterCollect: (headings: Headings, content: string) => string;
25
- }
26
- export declare function collectHeadings(options?: Partial<CollectHeadingsOptions>): Pick<PreprocessorGroup, "markup">;
27
- export {};
@@ -1,22 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- import { v10_theme } from "../build/build-elements";
3
- interface PreprocessElementsOptions {
4
- /**
5
- * Specify the Carbon theme
6
- * Setting to "all" will also enable `cssVars`
7
- * @default "white"
8
- */
9
- theme: v10_theme | "all";
10
- /**
11
- * Set to `true` for tokens to be re-written as CSS variables
12
- * Automatically set to `true` if theme is "all"
13
- * @example
14
- * "spacing-05" --> var(--cds-spacing-05)
15
- * "ui-01" --> var(--cds-ui-01)
16
- * @default false
17
- */
18
- cssVars: boolean;
19
- }
20
- export declare type ElementsOptions = Partial<PreprocessElementsOptions>;
21
- export declare function elements(options?: ElementsOptions): Pick<PreprocessorGroup, "style">;
22
- export {};
@@ -1,2 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- export declare function icons(): Pick<PreprocessorGroup, "markup">;
@@ -1,49 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- interface PreprocessIncludeOptions {
3
- /**
4
- * Specify the filename pattern to process
5
- * Defaults to files ending with ".svelte"
6
- * @default /\.(svelte)$/
7
- */
8
- test?: RegExp;
9
- script: Array<{
10
- /**
11
- * Specify the content the prepend or append
12
- * @example
13
- * import { CodeSnippet } from "carbon-components-svelte";
14
- */
15
- content: string;
16
- /**
17
- * Specify the filename pattern to process
18
- * Defaults to files ending with ".svelte"
19
- * @default /\.(svelte)$/
20
- */
21
- test?: RegExp;
22
- /**
23
- * Specify whether the content should be prepended or appended
24
- * @default "prepend"
25
- */
26
- behavior?: "prepend" | "append";
27
- }>;
28
- markup: Array<{
29
- /**
30
- * Specify the content the prepend or append
31
- * @example
32
- * <ul>Table of Contents</ul>
33
- */
34
- content: string;
35
- /**
36
- * Specify the filename pattern to process
37
- * Defaults to files ending with ".svelte"
38
- * @default /\.(svelte)$/
39
- */
40
- test?: RegExp;
41
- /**
42
- * Specify whether the content should be prepended or appended
43
- * @default "prepend"
44
- */
45
- behavior?: "prepend" | "append";
46
- }>;
47
- }
48
- export declare function include(options?: Partial<PreprocessIncludeOptions>): Pick<PreprocessorGroup, "markup" | "script">;
49
- export {};
@@ -1,6 +0,0 @@
1
- export * from "./elements";
2
- export * from "./optimize-imports";
3
- export * from "./collect-headings";
4
- export * from "./icons";
5
- export * from "./pictograms";
6
- export * from "./include";
@@ -1,2 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- export declare function pictograms(): Pick<PreprocessorGroup, "markup">;
@@ -1 +0,0 @@
1
- export * from "./preset-carbon";
@@ -1,7 +0,0 @@
1
- import { PreprocessorGroup } from "svelte/types/compiler/preprocess";
2
- import { ElementsOptions } from "../preprocessors";
3
- interface PresetOptions {
4
- elements: ElementsOptions;
5
- }
6
- export declare function presetCarbon(options?: Partial<PresetOptions>): PreprocessorGroup[];
7
- export {};
@@ -1,117 +0,0 @@
1
- import { BreakpointName } from "@carbon/elements";
2
- declare type ContentType = "script" | "style" | "markup";
3
- interface WalkAndReplaceOptions {
4
- type: ContentType;
5
- content: string;
6
- filename: string;
7
- }
8
- interface NodeMeta {
9
- start: number;
10
- end: number;
11
- }
12
- interface NodeElement extends NodeMeta {
13
- type: "Element";
14
- name: string;
15
- attributes: Array<NodeMeta & {
16
- type: "Attribute";
17
- name: string;
18
- value: true | [{
19
- type?: "Text";
20
- raw: string;
21
- }];
22
- }>;
23
- children: Array<NodeText | NodeElement>;
24
- }
25
- export interface NodeText {
26
- type?: "Text";
27
- raw: string;
28
- }
29
- interface NodeImportDeclaration extends NodeMeta {
30
- type: "ImportDeclaration";
31
- source: {
32
- value: string;
33
- };
34
- specifiers: Array<{
35
- local: {
36
- name: string;
37
- };
38
- imported: {
39
- name: string;
40
- };
41
- }>;
42
- }
43
- interface NodeIdentifier extends NodeMeta {
44
- type: "Identifier";
45
- name: string;
46
- }
47
- interface NodeDeclaration extends NodeMeta {
48
- type: "Declaration";
49
- property: string;
50
- value: NodeMeta & {
51
- children: NodeChildString[];
52
- };
53
- }
54
- interface NodeRule extends NodeMeta {
55
- type: "Rule";
56
- prelude: NodeMeta & {
57
- type: "SelectorList";
58
- children: Array<NodeMeta & {
59
- type: "Selector";
60
- name: "div";
61
- }>;
62
- };
63
- block: NodeMeta & {
64
- children: NodeDeclaration[];
65
- };
66
- }
67
- export interface MediaFeature {
68
- type: "MediaFeature";
69
- name: "down" | "up" | "bp" | "between" | BreakpointName;
70
- value: null | {
71
- name: BreakpointName;
72
- } | {
73
- type: "Dimension";
74
- value: string;
75
- unit: string;
76
- };
77
- }
78
- interface NodeAtRule extends NodeMeta {
79
- type: "Atrule";
80
- name: string;
81
- prelude: NodeMeta & {
82
- type: string;
83
- children: Array<{
84
- type: "MediaQueryList";
85
- children: Array<{
86
- type: "MediaQuery";
87
- children: Array<MediaFeature | {
88
- type: "WhiteSpace";
89
- } | {
90
- type: "Identifier";
91
- name: string;
92
- }>;
93
- }>;
94
- }>;
95
- };
96
- block: NodeMeta & {
97
- type: "Block";
98
- };
99
- }
100
- interface NodeFunction extends NodeMeta {
101
- type: "Function";
102
- name: string;
103
- children: Array<{
104
- type: "HexColor" | "Operator" | "Number" | "Dimension";
105
- value: string;
106
- }>;
107
- }
108
- export interface NodeChildString extends NodeMeta {
109
- type?: string;
110
- value: string;
111
- }
112
- export declare type Node = NodeElement | NodeImportDeclaration | NodeIdentifier | NodeDeclaration | NodeRule | NodeAtRule | NodeFunction;
113
- export declare function walkAndReplace(options: WalkAndReplaceOptions, replaceWith: (enter: {
114
- node: Node;
115
- parentNode: Node;
116
- }, replaceContent: (node: Node, replaceWith: string, replacee?: string) => void, getContent: (node: NodeMeta) => string) => void): string;
117
- export {};