@workday/canvas-kit-docs 13.2.1 → 13.2.3
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/es6/lib/docs.js
CHANGED
|
@@ -391423,12 +391423,12 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
391423
391423
|
},
|
|
391424
391424
|
{
|
|
391425
391425
|
"name": "createConfig",
|
|
391426
|
-
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
391426
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts",
|
|
391427
391427
|
"description": "",
|
|
391428
391428
|
"declarations": [
|
|
391429
391429
|
{
|
|
391430
391430
|
"name": "createConfig",
|
|
391431
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
391431
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts"
|
|
391432
391432
|
}
|
|
391433
391433
|
],
|
|
391434
391434
|
"tags": {},
|
|
@@ -391449,7 +391449,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
391449
391449
|
"declarations": [
|
|
391450
391450
|
{
|
|
391451
391451
|
"name": "config",
|
|
391452
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
391452
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts"
|
|
391453
391453
|
}
|
|
391454
391454
|
],
|
|
391455
391455
|
"tags": {}
|
|
@@ -391547,6 +391547,214 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
391547
391547
|
}
|
|
391548
391548
|
}
|
|
391549
391549
|
},
|
|
391550
|
+
{
|
|
391551
|
+
"name": "getTSConfigFile",
|
|
391552
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
391553
|
+
"description": "Get the contents of the tsconfig in the system",
|
|
391554
|
+
"declarations": [
|
|
391555
|
+
{
|
|
391556
|
+
"name": "getTSConfigFile",
|
|
391557
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391558
|
+
}
|
|
391559
|
+
],
|
|
391560
|
+
"tags": {},
|
|
391561
|
+
"type": {
|
|
391562
|
+
"kind": "function",
|
|
391563
|
+
"parameters": [
|
|
391564
|
+
{
|
|
391565
|
+
"kind": "parameter",
|
|
391566
|
+
"name": "tsconfigPath",
|
|
391567
|
+
"type": {
|
|
391568
|
+
"kind": "primitive",
|
|
391569
|
+
"value": "string"
|
|
391570
|
+
},
|
|
391571
|
+
"required": true,
|
|
391572
|
+
"rest": false,
|
|
391573
|
+
"description": "",
|
|
391574
|
+
"declarations": [
|
|
391575
|
+
{
|
|
391576
|
+
"name": "tsconfigPath",
|
|
391577
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391578
|
+
}
|
|
391579
|
+
],
|
|
391580
|
+
"tags": {}
|
|
391581
|
+
}
|
|
391582
|
+
],
|
|
391583
|
+
"members": [],
|
|
391584
|
+
"returnType": {
|
|
391585
|
+
"kind": "symbol",
|
|
391586
|
+
"name": "ParsedCommandLine",
|
|
391587
|
+
"value": "ParsedCommandLine"
|
|
391588
|
+
}
|
|
391589
|
+
}
|
|
391590
|
+
},
|
|
391591
|
+
{
|
|
391592
|
+
"name": "getCompilerOptions",
|
|
391593
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
391594
|
+
"description": "",
|
|
391595
|
+
"declarations": [
|
|
391596
|
+
{
|
|
391597
|
+
"name": "getCompilerOptions",
|
|
391598
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391599
|
+
}
|
|
391600
|
+
],
|
|
391601
|
+
"tags": {},
|
|
391602
|
+
"type": {
|
|
391603
|
+
"kind": "function",
|
|
391604
|
+
"parameters": [
|
|
391605
|
+
{
|
|
391606
|
+
"kind": "parameter",
|
|
391607
|
+
"name": "tsconfigPath",
|
|
391608
|
+
"type": {
|
|
391609
|
+
"kind": "primitive",
|
|
391610
|
+
"value": "string"
|
|
391611
|
+
},
|
|
391612
|
+
"required": true,
|
|
391613
|
+
"rest": false,
|
|
391614
|
+
"description": "",
|
|
391615
|
+
"declarations": [
|
|
391616
|
+
{
|
|
391617
|
+
"name": "tsconfigPath",
|
|
391618
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391619
|
+
}
|
|
391620
|
+
],
|
|
391621
|
+
"tags": {}
|
|
391622
|
+
}
|
|
391623
|
+
],
|
|
391624
|
+
"members": [],
|
|
391625
|
+
"returnType": {
|
|
391626
|
+
"kind": "symbol",
|
|
391627
|
+
"name": "CompilerOptions",
|
|
391628
|
+
"value": "CompilerOptions"
|
|
391629
|
+
}
|
|
391630
|
+
}
|
|
391631
|
+
},
|
|
391632
|
+
{
|
|
391633
|
+
"name": "startWatch",
|
|
391634
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
391635
|
+
"description": "Create a watch program for TypeScript with transformers. It watches the specified\ntsconfigPath for changes and updates the program when changes are detected.",
|
|
391636
|
+
"declarations": [
|
|
391637
|
+
{
|
|
391638
|
+
"name": "startWatch",
|
|
391639
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391640
|
+
}
|
|
391641
|
+
],
|
|
391642
|
+
"tags": {
|
|
391643
|
+
"param": "compilerOptions\n \n- The compiler options to use.\ntsconfigPath\n \n- The path to the tsconfig file.\nonProgramCreatedOrUpdated\n \n- A callback function\nthat is called when the program is created or updated.",
|
|
391644
|
+
"returns": ""
|
|
391645
|
+
},
|
|
391646
|
+
"type": {
|
|
391647
|
+
"kind": "function",
|
|
391648
|
+
"parameters": [
|
|
391649
|
+
{
|
|
391650
|
+
"kind": "parameter",
|
|
391651
|
+
"name": "compilerOptions",
|
|
391652
|
+
"type": {
|
|
391653
|
+
"kind": "symbol",
|
|
391654
|
+
"name": "ts.CompilerOptions",
|
|
391655
|
+
"value": "CompilerOptions"
|
|
391656
|
+
},
|
|
391657
|
+
"required": true,
|
|
391658
|
+
"rest": false,
|
|
391659
|
+
"description": "- The compiler options to use.",
|
|
391660
|
+
"declarations": [
|
|
391661
|
+
{
|
|
391662
|
+
"name": "compilerOptions",
|
|
391663
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391664
|
+
}
|
|
391665
|
+
],
|
|
391666
|
+
"tags": {
|
|
391667
|
+
"param": "compilerOptions\n \n- The compiler options to use."
|
|
391668
|
+
}
|
|
391669
|
+
},
|
|
391670
|
+
{
|
|
391671
|
+
"kind": "parameter",
|
|
391672
|
+
"name": "tsconfigPath",
|
|
391673
|
+
"type": {
|
|
391674
|
+
"kind": "primitive",
|
|
391675
|
+
"value": "string"
|
|
391676
|
+
},
|
|
391677
|
+
"required": true,
|
|
391678
|
+
"rest": false,
|
|
391679
|
+
"description": "- The path to the tsconfig file.",
|
|
391680
|
+
"declarations": [
|
|
391681
|
+
{
|
|
391682
|
+
"name": "tsconfigPath",
|
|
391683
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391684
|
+
}
|
|
391685
|
+
],
|
|
391686
|
+
"tags": {
|
|
391687
|
+
"param": "tsconfigPath\n \n- The path to the tsconfig file."
|
|
391688
|
+
}
|
|
391689
|
+
},
|
|
391690
|
+
{
|
|
391691
|
+
"kind": "parameter",
|
|
391692
|
+
"name": "onProgramCreatedOrUpdated",
|
|
391693
|
+
"type": {
|
|
391694
|
+
"kind": "function",
|
|
391695
|
+
"parameters": [
|
|
391696
|
+
{
|
|
391697
|
+
"kind": "parameter",
|
|
391698
|
+
"name": "program",
|
|
391699
|
+
"type": {
|
|
391700
|
+
"kind": "symbol",
|
|
391701
|
+
"name": "ts.BuilderProgram",
|
|
391702
|
+
"value": "BuilderProgram"
|
|
391703
|
+
},
|
|
391704
|
+
"required": true,
|
|
391705
|
+
"rest": false,
|
|
391706
|
+
"description": "",
|
|
391707
|
+
"declarations": [
|
|
391708
|
+
{
|
|
391709
|
+
"name": "program",
|
|
391710
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391711
|
+
}
|
|
391712
|
+
],
|
|
391713
|
+
"tags": {}
|
|
391714
|
+
}
|
|
391715
|
+
],
|
|
391716
|
+
"members": [],
|
|
391717
|
+
"returnType": {
|
|
391718
|
+
"kind": "primitive",
|
|
391719
|
+
"value": "void"
|
|
391720
|
+
}
|
|
391721
|
+
},
|
|
391722
|
+
"required": true,
|
|
391723
|
+
"rest": false,
|
|
391724
|
+
"description": "- A callback function\nthat is called when the program is created or updated.",
|
|
391725
|
+
"declarations": [
|
|
391726
|
+
{
|
|
391727
|
+
"name": "onProgramCreatedOrUpdated",
|
|
391728
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
391729
|
+
}
|
|
391730
|
+
],
|
|
391731
|
+
"tags": {
|
|
391732
|
+
"param": "onProgramCreatedOrUpdated\n \n- A callback function\nthat is called when the program is created or updated."
|
|
391733
|
+
}
|
|
391734
|
+
}
|
|
391735
|
+
],
|
|
391736
|
+
"members": [],
|
|
391737
|
+
"returnType": {
|
|
391738
|
+
"kind": "tuple",
|
|
391739
|
+
"value": [
|
|
391740
|
+
{
|
|
391741
|
+
"kind": "symbol",
|
|
391742
|
+
"name": "ts.BuilderProgram",
|
|
391743
|
+
"value": "BuilderProgram"
|
|
391744
|
+
},
|
|
391745
|
+
{
|
|
391746
|
+
"kind": "function",
|
|
391747
|
+
"parameters": [],
|
|
391748
|
+
"members": [],
|
|
391749
|
+
"returnType": {
|
|
391750
|
+
"kind": "primitive",
|
|
391751
|
+
"value": "void"
|
|
391752
|
+
}
|
|
391753
|
+
}
|
|
391754
|
+
]
|
|
391755
|
+
}
|
|
391756
|
+
}
|
|
391757
|
+
},
|
|
391550
391758
|
{
|
|
391551
391759
|
"name": "NestedStyleObject",
|
|
391552
391760
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts",
|
|
@@ -391969,6 +392177,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
391969
392177
|
}
|
|
391970
392178
|
],
|
|
391971
392179
|
"tags": {}
|
|
392180
|
+
},
|
|
392181
|
+
{
|
|
392182
|
+
"kind": "property",
|
|
392183
|
+
"name": "seed",
|
|
392184
|
+
"required": true,
|
|
392185
|
+
"type": {
|
|
392186
|
+
"kind": "primitive",
|
|
392187
|
+
"value": "string"
|
|
392188
|
+
},
|
|
392189
|
+
"description": "",
|
|
392190
|
+
"declarations": [
|
|
392191
|
+
{
|
|
392192
|
+
"name": "seed",
|
|
392193
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
392194
|
+
}
|
|
392195
|
+
],
|
|
392196
|
+
"tags": {}
|
|
391972
392197
|
}
|
|
391973
392198
|
]
|
|
391974
392199
|
}
|
|
@@ -391995,12 +392220,12 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
391995
392220
|
}
|
|
391996
392221
|
},
|
|
391997
392222
|
{
|
|
391998
|
-
"name": "
|
|
392223
|
+
"name": "styleTransformer",
|
|
391999
392224
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts",
|
|
392000
392225
|
"description": "",
|
|
392001
392226
|
"declarations": [
|
|
392002
392227
|
{
|
|
392003
|
-
"name": "
|
|
392228
|
+
"name": "styleTransformer",
|
|
392004
392229
|
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts"
|
|
392005
392230
|
}
|
|
392006
392231
|
],
|
|
@@ -392504,6 +392729,66 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
392504
392729
|
}
|
|
392505
392730
|
}
|
|
392506
392731
|
},
|
|
392732
|
+
{
|
|
392733
|
+
"name": "getHash",
|
|
392734
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts",
|
|
392735
|
+
"description": "Generate a deterministic hash that is unique to the seed +",
|
|
392736
|
+
"declarations": [
|
|
392737
|
+
{
|
|
392738
|
+
"name": "getHash",
|
|
392739
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
392740
|
+
}
|
|
392741
|
+
],
|
|
392742
|
+
"tags": {},
|
|
392743
|
+
"type": {
|
|
392744
|
+
"kind": "function",
|
|
392745
|
+
"parameters": [
|
|
392746
|
+
{
|
|
392747
|
+
"kind": "parameter",
|
|
392748
|
+
"name": "node",
|
|
392749
|
+
"type": {
|
|
392750
|
+
"kind": "symbol",
|
|
392751
|
+
"name": "ts.Node",
|
|
392752
|
+
"value": "Node"
|
|
392753
|
+
},
|
|
392754
|
+
"required": true,
|
|
392755
|
+
"rest": false,
|
|
392756
|
+
"description": "",
|
|
392757
|
+
"declarations": [
|
|
392758
|
+
{
|
|
392759
|
+
"name": "node",
|
|
392760
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
392761
|
+
}
|
|
392762
|
+
],
|
|
392763
|
+
"tags": {}
|
|
392764
|
+
},
|
|
392765
|
+
{
|
|
392766
|
+
"kind": "parameter",
|
|
392767
|
+
"name": "context",
|
|
392768
|
+
"type": {
|
|
392769
|
+
"kind": "symbol",
|
|
392770
|
+
"name": "TransformerContext",
|
|
392771
|
+
"value": "TransformerContext"
|
|
392772
|
+
},
|
|
392773
|
+
"required": true,
|
|
392774
|
+
"rest": false,
|
|
392775
|
+
"description": "",
|
|
392776
|
+
"declarations": [
|
|
392777
|
+
{
|
|
392778
|
+
"name": "context",
|
|
392779
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
392780
|
+
}
|
|
392781
|
+
],
|
|
392782
|
+
"tags": {}
|
|
392783
|
+
}
|
|
392784
|
+
],
|
|
392785
|
+
"members": [],
|
|
392786
|
+
"returnType": {
|
|
392787
|
+
"kind": "primitive",
|
|
392788
|
+
"value": "string"
|
|
392789
|
+
}
|
|
392790
|
+
}
|
|
392791
|
+
},
|
|
392507
392792
|
{
|
|
392508
392793
|
"name": "getVariablesFromFiles",
|
|
392509
392794
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/getCssVariables.ts",
|
|
@@ -394219,6 +394504,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
394219
394504
|
}
|
|
394220
394505
|
],
|
|
394221
394506
|
"tags": {}
|
|
394507
|
+
},
|
|
394508
|
+
{
|
|
394509
|
+
"kind": "property",
|
|
394510
|
+
"name": "seed",
|
|
394511
|
+
"required": true,
|
|
394512
|
+
"type": {
|
|
394513
|
+
"kind": "primitive",
|
|
394514
|
+
"value": "string"
|
|
394515
|
+
},
|
|
394516
|
+
"description": "",
|
|
394517
|
+
"declarations": [
|
|
394518
|
+
{
|
|
394519
|
+
"name": "seed",
|
|
394520
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
394521
|
+
}
|
|
394522
|
+
],
|
|
394523
|
+
"tags": {}
|
|
394222
394524
|
}
|
|
394223
394525
|
]
|
|
394224
394526
|
}
|
|
@@ -394585,6 +394887,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
394585
394887
|
}
|
|
394586
394888
|
],
|
|
394587
394889
|
"tags": {}
|
|
394890
|
+
},
|
|
394891
|
+
{
|
|
394892
|
+
"kind": "property",
|
|
394893
|
+
"name": "seed",
|
|
394894
|
+
"required": false,
|
|
394895
|
+
"type": {
|
|
394896
|
+
"kind": "primitive",
|
|
394897
|
+
"value": "string"
|
|
394898
|
+
},
|
|
394899
|
+
"description": "Optional seed for the hash. This can be useful if you want each build to have a different hash.\nIf you provide the same seed, the same hash will be generated for every style.",
|
|
394900
|
+
"declarations": [
|
|
394901
|
+
{
|
|
394902
|
+
"name": "seed",
|
|
394903
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
394904
|
+
}
|
|
394905
|
+
],
|
|
394906
|
+
"tags": {}
|
|
394588
394907
|
}
|
|
394589
394908
|
]
|
|
394590
394909
|
}
|
|
@@ -394736,6 +395055,289 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
394736
395055
|
}
|
|
394737
395056
|
}
|
|
394738
395057
|
},
|
|
395058
|
+
{
|
|
395059
|
+
"name": "default",
|
|
395060
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts",
|
|
395061
|
+
"description": "",
|
|
395062
|
+
"declarations": [
|
|
395063
|
+
{
|
|
395064
|
+
"name": "default",
|
|
395065
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts"
|
|
395066
|
+
}
|
|
395067
|
+
],
|
|
395068
|
+
"tags": {},
|
|
395069
|
+
"type": {
|
|
395070
|
+
"kind": "function",
|
|
395071
|
+
"parameters": [
|
|
395072
|
+
{
|
|
395073
|
+
"kind": "parameter",
|
|
395074
|
+
"name": "source",
|
|
395075
|
+
"type": {
|
|
395076
|
+
"kind": "primitive",
|
|
395077
|
+
"value": "string"
|
|
395078
|
+
},
|
|
395079
|
+
"required": true,
|
|
395080
|
+
"rest": false,
|
|
395081
|
+
"description": "",
|
|
395082
|
+
"declarations": [
|
|
395083
|
+
{
|
|
395084
|
+
"name": "source",
|
|
395085
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts"
|
|
395086
|
+
}
|
|
395087
|
+
],
|
|
395088
|
+
"tags": {}
|
|
395089
|
+
}
|
|
395090
|
+
],
|
|
395091
|
+
"members": [],
|
|
395092
|
+
"returnType": {
|
|
395093
|
+
"kind": "primitive",
|
|
395094
|
+
"value": "string"
|
|
395095
|
+
}
|
|
395096
|
+
}
|
|
395097
|
+
},
|
|
395098
|
+
{
|
|
395099
|
+
"name": "StylingWebpackPlugin",
|
|
395100
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts",
|
|
395101
|
+
"description": "",
|
|
395102
|
+
"declarations": [
|
|
395103
|
+
{
|
|
395104
|
+
"name": "StylingWebpackPlugin",
|
|
395105
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395106
|
+
}
|
|
395107
|
+
],
|
|
395108
|
+
"tags": {},
|
|
395109
|
+
"type": {
|
|
395110
|
+
"kind": "object",
|
|
395111
|
+
"properties": [
|
|
395112
|
+
{
|
|
395113
|
+
"kind": "property",
|
|
395114
|
+
"name": "compilerOptions",
|
|
395115
|
+
"type": {
|
|
395116
|
+
"kind": "symbol",
|
|
395117
|
+
"name": "CompilerOptions",
|
|
395118
|
+
"value": "CompilerOptions"
|
|
395119
|
+
},
|
|
395120
|
+
"description": "",
|
|
395121
|
+
"declarations": [
|
|
395122
|
+
{
|
|
395123
|
+
"name": "compilerOptions",
|
|
395124
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395125
|
+
}
|
|
395126
|
+
],
|
|
395127
|
+
"tags": {}
|
|
395128
|
+
},
|
|
395129
|
+
{
|
|
395130
|
+
"kind": "property",
|
|
395131
|
+
"name": "builderProgram",
|
|
395132
|
+
"type": {
|
|
395133
|
+
"kind": "symbol",
|
|
395134
|
+
"name": "BuilderProgram",
|
|
395135
|
+
"value": "BuilderProgram"
|
|
395136
|
+
},
|
|
395137
|
+
"description": "",
|
|
395138
|
+
"declarations": [
|
|
395139
|
+
{
|
|
395140
|
+
"name": "builderProgram",
|
|
395141
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395142
|
+
}
|
|
395143
|
+
],
|
|
395144
|
+
"tags": {}
|
|
395145
|
+
},
|
|
395146
|
+
{
|
|
395147
|
+
"kind": "property",
|
|
395148
|
+
"name": "transformers",
|
|
395149
|
+
"type": {
|
|
395150
|
+
"kind": "array",
|
|
395151
|
+
"value": {
|
|
395152
|
+
"kind": "symbol",
|
|
395153
|
+
"name": "TransformerFactory",
|
|
395154
|
+
"typeParameters": [
|
|
395155
|
+
{
|
|
395156
|
+
"kind": "symbol",
|
|
395157
|
+
"name": "SourceFile",
|
|
395158
|
+
"value": "any"
|
|
395159
|
+
}
|
|
395160
|
+
],
|
|
395161
|
+
"value": "any"
|
|
395162
|
+
}
|
|
395163
|
+
},
|
|
395164
|
+
"description": "",
|
|
395165
|
+
"declarations": [
|
|
395166
|
+
{
|
|
395167
|
+
"name": "transformers",
|
|
395168
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395169
|
+
}
|
|
395170
|
+
],
|
|
395171
|
+
"tags": {}
|
|
395172
|
+
},
|
|
395173
|
+
{
|
|
395174
|
+
"kind": "property",
|
|
395175
|
+
"name": "postTransform",
|
|
395176
|
+
"type": {
|
|
395177
|
+
"kind": "union",
|
|
395178
|
+
"value": [
|
|
395179
|
+
{
|
|
395180
|
+
"kind": "parenthesis",
|
|
395181
|
+
"value": {
|
|
395182
|
+
"kind": "function",
|
|
395183
|
+
"parameters": [
|
|
395184
|
+
{
|
|
395185
|
+
"kind": "parameter",
|
|
395186
|
+
"name": "code",
|
|
395187
|
+
"type": {
|
|
395188
|
+
"kind": "primitive",
|
|
395189
|
+
"value": "string"
|
|
395190
|
+
},
|
|
395191
|
+
"required": true,
|
|
395192
|
+
"rest": false,
|
|
395193
|
+
"description": "",
|
|
395194
|
+
"declarations": [
|
|
395195
|
+
{
|
|
395196
|
+
"name": "code",
|
|
395197
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395198
|
+
}
|
|
395199
|
+
],
|
|
395200
|
+
"tags": {}
|
|
395201
|
+
},
|
|
395202
|
+
{
|
|
395203
|
+
"kind": "parameter",
|
|
395204
|
+
"name": "id",
|
|
395205
|
+
"type": {
|
|
395206
|
+
"kind": "primitive",
|
|
395207
|
+
"value": "string"
|
|
395208
|
+
},
|
|
395209
|
+
"required": true,
|
|
395210
|
+
"rest": false,
|
|
395211
|
+
"description": "",
|
|
395212
|
+
"declarations": [
|
|
395213
|
+
{
|
|
395214
|
+
"name": "id",
|
|
395215
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395216
|
+
}
|
|
395217
|
+
],
|
|
395218
|
+
"tags": {}
|
|
395219
|
+
}
|
|
395220
|
+
],
|
|
395221
|
+
"members": [],
|
|
395222
|
+
"returnType": {
|
|
395223
|
+
"kind": "union",
|
|
395224
|
+
"value": [
|
|
395225
|
+
{
|
|
395226
|
+
"kind": "primitive",
|
|
395227
|
+
"value": "string"
|
|
395228
|
+
},
|
|
395229
|
+
{
|
|
395230
|
+
"kind": "primitive",
|
|
395231
|
+
"value": "undefined"
|
|
395232
|
+
}
|
|
395233
|
+
]
|
|
395234
|
+
}
|
|
395235
|
+
}
|
|
395236
|
+
},
|
|
395237
|
+
{
|
|
395238
|
+
"kind": "primitive",
|
|
395239
|
+
"value": "undefined"
|
|
395240
|
+
}
|
|
395241
|
+
]
|
|
395242
|
+
},
|
|
395243
|
+
"description": "",
|
|
395244
|
+
"declarations": [
|
|
395245
|
+
{
|
|
395246
|
+
"name": "postTransform",
|
|
395247
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395248
|
+
}
|
|
395249
|
+
],
|
|
395250
|
+
"tags": {}
|
|
395251
|
+
},
|
|
395252
|
+
{
|
|
395253
|
+
"kind": "property",
|
|
395254
|
+
"name": "close",
|
|
395255
|
+
"type": {
|
|
395256
|
+
"kind": "function",
|
|
395257
|
+
"parameters": [],
|
|
395258
|
+
"members": [],
|
|
395259
|
+
"returnType": {
|
|
395260
|
+
"kind": "primitive",
|
|
395261
|
+
"value": "void"
|
|
395262
|
+
}
|
|
395263
|
+
},
|
|
395264
|
+
"description": "",
|
|
395265
|
+
"declarations": [
|
|
395266
|
+
{
|
|
395267
|
+
"name": "close",
|
|
395268
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395269
|
+
}
|
|
395270
|
+
],
|
|
395271
|
+
"tags": {}
|
|
395272
|
+
},
|
|
395273
|
+
{
|
|
395274
|
+
"kind": "property",
|
|
395275
|
+
"name": "getLoaderOptions",
|
|
395276
|
+
"type": {
|
|
395277
|
+
"kind": "function",
|
|
395278
|
+
"parameters": [],
|
|
395279
|
+
"members": [],
|
|
395280
|
+
"returnType": {
|
|
395281
|
+
"kind": "unknown",
|
|
395282
|
+
"value": "unknown",
|
|
395283
|
+
"text": "SyntheticNode - ThisType"
|
|
395284
|
+
}
|
|
395285
|
+
},
|
|
395286
|
+
"required": true,
|
|
395287
|
+
"description": "",
|
|
395288
|
+
"declarations": [
|
|
395289
|
+
{
|
|
395290
|
+
"name": "getLoaderOptions",
|
|
395291
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395292
|
+
}
|
|
395293
|
+
],
|
|
395294
|
+
"tags": {}
|
|
395295
|
+
},
|
|
395296
|
+
{
|
|
395297
|
+
"kind": "property",
|
|
395298
|
+
"name": "apply",
|
|
395299
|
+
"type": {
|
|
395300
|
+
"kind": "function",
|
|
395301
|
+
"parameters": [
|
|
395302
|
+
{
|
|
395303
|
+
"kind": "parameter",
|
|
395304
|
+
"name": "compiler",
|
|
395305
|
+
"type": {
|
|
395306
|
+
"kind": "unknown",
|
|
395307
|
+
"value": "unknown",
|
|
395308
|
+
"text": "import('webpack').Compiler"
|
|
395309
|
+
},
|
|
395310
|
+
"required": true,
|
|
395311
|
+
"rest": false,
|
|
395312
|
+
"description": "",
|
|
395313
|
+
"declarations": [
|
|
395314
|
+
{
|
|
395315
|
+
"name": "compiler",
|
|
395316
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395317
|
+
}
|
|
395318
|
+
],
|
|
395319
|
+
"tags": {}
|
|
395320
|
+
}
|
|
395321
|
+
],
|
|
395322
|
+
"members": [],
|
|
395323
|
+
"returnType": {
|
|
395324
|
+
"kind": "primitive",
|
|
395325
|
+
"value": "void"
|
|
395326
|
+
}
|
|
395327
|
+
},
|
|
395328
|
+
"required": true,
|
|
395329
|
+
"description": "",
|
|
395330
|
+
"declarations": [
|
|
395331
|
+
{
|
|
395332
|
+
"name": "apply",
|
|
395333
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
395334
|
+
}
|
|
395335
|
+
],
|
|
395336
|
+
"tags": {}
|
|
395337
|
+
}
|
|
395338
|
+
]
|
|
395339
|
+
}
|
|
395340
|
+
},
|
|
394739
395341
|
{
|
|
394740
395342
|
"name": "calc",
|
|
394741
395343
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling/lib/calc.ts",
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.3",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.3",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.3",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.3",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.3",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.3",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.3",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.3",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.3",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.3",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
2
2
|
import {Hyperlink} from '@workday/canvas-kit-react/button';
|
|
3
|
-
import {system} from '@workday/canvas-tokens-web'
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
# Canvas Kit Styling
|
|
@@ -27,7 +27,8 @@ The Canvas Kit styling system consists of two main packages:
|
|
|
27
27
|
- `@workday/canvas-kit-styling` - Core styling utilities for runtime use
|
|
28
28
|
- `@workday/canvas-kit-styling-transform` - Build-time optimization tools
|
|
29
29
|
|
|
30
|
-
These packages work together to provide a CSS-in-JS experience during development while enabling
|
|
30
|
+
These packages work together to provide a CSS-in-JS experience during development while enabling
|
|
31
|
+
optimized static CSS in production.
|
|
31
32
|
|
|
32
33
|
## Installation
|
|
33
34
|
|
|
@@ -55,74 +56,219 @@ const root = createRoot(domNode);
|
|
|
55
56
|
root.render(<div className={myStyles}>Hello!</div>);
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
## Style Merging
|
|
60
|
+
|
|
61
|
+
The `@workday/canvas-kit-styling` package uses `@emotion/css` to inject styles during JavaScript
|
|
62
|
+
evaluation time rather than `@emotion/react` or `@emotion/styled` injecting when a component is
|
|
63
|
+
rendered. This means the Emotion cache needs to be known before any style is created. In order to
|
|
64
|
+
properly merge styles with components using either dynamic styling package, the Emotion cache must
|
|
65
|
+
be changed on any React application. Without this, styles will not be merged correctly when static
|
|
66
|
+
and dynamic styles are used on the same element.
|
|
67
|
+
|
|
68
|
+
If you're using Canvas Kit React, you should use the `<CanvasProvider>` which includes Emotion's
|
|
69
|
+
`<CacheProvider>` with the proper cache already set. If you're not using Canvas Kit React, you
|
|
70
|
+
should use the `<CacheProvider>`:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
// ONLY use if not using the <CanvasProvider>
|
|
74
|
+
import {getCache} from '@workday/canvas-kit-styling';
|
|
75
|
+
|
|
76
|
+
// in your application bootstrap
|
|
77
|
+
const root = React.createRoot(document.getElementById('root'));
|
|
78
|
+
|
|
79
|
+
root.render(
|
|
80
|
+
<CacheProvider value={getCache()}>
|
|
81
|
+
<App />
|
|
82
|
+
</CacheProvider>
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Known issues
|
|
87
|
+
|
|
88
|
+
### Hot Reloading
|
|
89
|
+
|
|
90
|
+
Style merging works by using CSS specificity rather than JavaScript runtime. This can cause problems
|
|
91
|
+
during hot reloading. If you specify all styles in the same file, hot reloading shouldn't result in
|
|
92
|
+
any style merging problems. But if you use `extends` in `createStencil` that references another
|
|
93
|
+
file, you may run into style merge issues.
|
|
94
|
+
|
|
95
|
+
For example:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// base.tsx file
|
|
99
|
+
export const baseStencil = createStencil({
|
|
100
|
+
base: {
|
|
101
|
+
color: 'red',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// extended.tsx file
|
|
106
|
+
import {baseStencil} from './base';
|
|
107
|
+
|
|
108
|
+
export const extendedStencil = createStencil({
|
|
109
|
+
extends: baseStencil,
|
|
110
|
+
base: {
|
|
111
|
+
color: 'blue',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This will render correctly until you change `color` in `base.tsx` and get a hot reload:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// base.tsx file
|
|
120
|
+
export const baseStencil = createStencil({
|
|
121
|
+
base: {
|
|
122
|
+
color: 'purple',
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The hot reload will evaluate this update and inject a new style.
|
|
128
|
+
|
|
58
129
|
## Development
|
|
59
130
|
|
|
60
|
-
Canvas Kit Styling comes with a runtime that doesn't need anything special for
|
|
61
|
-
runtime uses `@emotion/css` to include your styles on the page.
|
|
131
|
+
Canvas Kit Styling comes with a runtime that doesn't need anything special for development. The
|
|
132
|
+
runtime uses `@emotion/css` to include your styles on the page. If you plan to use static
|
|
133
|
+
compilation, we recommend enabling in production as well so you can fix static compilation errors as
|
|
134
|
+
you develop rather than get errors only in production builds.
|
|
62
135
|
|
|
63
|
-
##
|
|
136
|
+
## Static compilation
|
|
64
137
|
|
|
65
|
-
|
|
66
|
-
|
|
138
|
+
The `@workday/canvas-kit-styling-transform` package can to pre-build styles. This process takes
|
|
139
|
+
style objects and turns them into CSS strings. This process moves serialization and hashing to build
|
|
140
|
+
time rather than browser runtime when `@emotion/css` is processing styles. This will speed up
|
|
141
|
+
production builds at runtime.
|
|
67
142
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
143
|
+
Static compilation has stricter requirements than when doing runtime styling. The static compiler
|
|
144
|
+
uses the TypeScript type system to statically analyze style values and thus requires value types to
|
|
145
|
+
be known by TypeScript. See [Restrictions](#restrictions).
|
|
146
|
+
|
|
147
|
+
Static compilation may be required for server side rendering (SSR), especially when using React
|
|
148
|
+
Server Components.
|
|
149
|
+
|
|
150
|
+
### Hash generation
|
|
151
|
+
|
|
152
|
+
Emotion generates hashes based on the serialized style object. This means a style should always give
|
|
153
|
+
the same hash. Static styling hashes differently. Every `createStyles` or `createStencil` call will
|
|
154
|
+
generate a unique hash even if the style object is the same. This is required for proper style
|
|
155
|
+
merging because static styling doesn't give single class names, but rather merges styles using CSS
|
|
156
|
+
specificity.
|
|
157
|
+
|
|
158
|
+
For runtime development, the hash is always unique. For static compilation, the hash is based on the
|
|
159
|
+
start and end character count in the source file of the style block. This is required for SSR so
|
|
160
|
+
that the server and client agree on the same value during hydration. This means that while
|
|
161
|
+
debugging, the hash depends on any code before it. If you add a `console.log` for example, the
|
|
162
|
+
character index of a style block could shift which will generate a new hash.
|
|
163
|
+
|
|
164
|
+
### Restrictions
|
|
165
|
+
|
|
166
|
+
The static compiler uses the TypeScript type checker. The easiest way to think of these restrictions
|
|
167
|
+
is if TypeScript knows the exact value, the static compiler will also know. A simple example:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
// won't work - `value` is a type of `string` because `let` allows a value to be mutated
|
|
171
|
+
let value = 'absolute'; // `string`
|
|
172
|
+
|
|
173
|
+
const myStyles = createStyles({
|
|
174
|
+
position: value, // error - `string` isn't specific enough.
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// will work - `value` is a type of `'absolute'` because `const` restricts to a string literal
|
|
178
|
+
const value = 'absolute'; // `'absolute'`
|
|
179
|
+
|
|
180
|
+
const myStyles = createStyles({
|
|
181
|
+
position: value, // works. If you mouse over `value` in your editor, you'll see the type is `'absolute'`
|
|
182
|
+
});
|
|
81
183
|
```
|
|
82
184
|
|
|
83
|
-
|
|
84
|
-
[ts-patch](https://www.npmjs.com/package/ts-patch) projects uses the `plugins` when running
|
|
85
|
-
transforms.
|
|
185
|
+
More complex examples may be objects:
|
|
86
186
|
|
|
87
|
-
|
|
187
|
+
```ts
|
|
188
|
+
// won't work. TypeScript will not understand that the position will only be `'absolute'` and makes it a `string` instead
|
|
189
|
+
const reusableStyles = {
|
|
190
|
+
position: 'absolute',
|
|
191
|
+
}; // `{ position: string }`
|
|
88
192
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
to transform code during compilation.
|
|
193
|
+
const myStyles = createStyles({
|
|
194
|
+
...reusableStyles, // error - `position` is a `string` and not specific enough
|
|
195
|
+
});
|
|
93
196
|
|
|
94
|
-
|
|
197
|
+
// will work. Adding `as const` tells TypeScript the object is readonly and therefore no values can change
|
|
198
|
+
const reusableStyles = {
|
|
199
|
+
position: 'absolute',
|
|
200
|
+
} as const; // `{ readonly position: 'absolute' }`
|
|
201
|
+
|
|
202
|
+
const myStyles = createStyles({
|
|
203
|
+
...reusableStyles, // works. If you mouse over, the position is a string literal `'absolute'`
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Functions are a little more tricky and may require generics.
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
// generic makes the type be statically knowable
|
|
211
|
+
function getPosition<V extends 'relative' | 'absolute'>(value: V): {position: V} {
|
|
212
|
+
return {position: value};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// mouse over `position` in your editor an the type will be `{ position: 'absolute' }`
|
|
216
|
+
const position = getPosition('absolute'); // { position: 'absolute' }
|
|
217
|
+
|
|
218
|
+
const myStyles = createStyles({
|
|
219
|
+
...getPosition('absolute'), // works - `{ position: 'absolute' }`
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Webpack
|
|
224
|
+
|
|
225
|
+
The `@webpack/canvas-kit-styling-transform` package comes with a webpack loader that can be added to
|
|
226
|
+
development and/or production.
|
|
95
227
|
|
|
96
228
|
```js
|
|
229
|
+
// import the transform - CJS and ESM are supported
|
|
230
|
+
import {StylingWebpackPlugin} from '@workday/canvas-kit-styling-transform';
|
|
231
|
+
|
|
232
|
+
// somewhere only once. For static webpack config files, this can be near the top.
|
|
233
|
+
// If inside Storybook, Gatsby, Next.js, etc configs, put inside the function that is called that
|
|
234
|
+
// returns a webpack config
|
|
235
|
+
const tsPlugin = const tsPlugin = new StylingWebpackPlugin({
|
|
236
|
+
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'), // allows your TS config to be used
|
|
237
|
+
// A different tsconfig could be used if you want to use TS to transpile to something like ES2019 and
|
|
238
|
+
// also have Babel process the file.
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// However you need to define rules.
|
|
242
|
+
// This is different for using webpack directly or in Storybook/Gatsby/Next.js/etc
|
|
97
243
|
{
|
|
98
244
|
rules: [
|
|
99
245
|
//...
|
|
100
246
|
{
|
|
101
247
|
test: /.\.tsx?$/,
|
|
102
|
-
|
|
103
|
-
// ts-loader
|
|
248
|
+
use: [
|
|
104
249
|
{
|
|
105
|
-
loader: require.resolve('
|
|
106
|
-
options:
|
|
107
|
-
compiler: 'ts-patch/compiler',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
// OR awesome-typescript-loader
|
|
111
|
-
{
|
|
112
|
-
loader: require.resolve('awesome-typescript-loader'),
|
|
250
|
+
loader: require.resolve('@workday/canvas-kit-styling-transform/webpack-loader'),
|
|
251
|
+
options: tsPlugin.getLoaderOptions(),
|
|
113
252
|
},
|
|
114
253
|
],
|
|
254
|
+
enforce: 'pre'
|
|
115
255
|
},
|
|
116
256
|
];
|
|
257
|
+
// We need to pass the plugin to Webpack's plugin list. Failure to do this will result in a
|
|
258
|
+
// production build hanging
|
|
259
|
+
plugins: [tsPlugin]
|
|
117
260
|
}
|
|
118
261
|
```
|
|
119
262
|
|
|
120
263
|
## Core Styling Approaches for Static Styling
|
|
264
|
+
|
|
121
265
|
For proper static styling there's two methods that you can use to apply styles.
|
|
266
|
+
|
|
122
267
|
1. Using `createStyles` for simple object base styles.
|
|
123
268
|
2. Using `createStencil` for dynamic styles and reusable components.
|
|
124
269
|
|
|
125
|
-
Both approaches are intended to be used in tandem with the `cs` prop when applying styles to our
|
|
270
|
+
Both approaches are intended to be used in tandem with the `cs` prop when applying styles to our
|
|
271
|
+
components.
|
|
126
272
|
|
|
127
273
|
### `cs` Prop
|
|
128
274
|
|
|
@@ -132,7 +278,8 @@ everything together and applies `className` and `style` attributes to a React el
|
|
|
132
278
|
components extend the `cs` prop so that you can statically apply styles to them.
|
|
133
279
|
|
|
134
280
|
> **Important**: While the `cs` prop accepts a style object, **this will not** be considered
|
|
135
|
-
> statically styling an element and you will lose the performance benefits. We plan on providing a
|
|
281
|
+
> statically styling an element and you will lose the performance benefits. We plan on providing a
|
|
282
|
+
> babel plugin to extract these styles statically in a future version.
|
|
136
283
|
|
|
137
284
|
```tsx
|
|
138
285
|
import {system} from '@workday/canvas-tokens-webs';
|
|
@@ -172,15 +319,15 @@ function MyComponent() {
|
|
|
172
319
|
}
|
|
173
320
|
```
|
|
174
321
|
|
|
175
|
-
Most of our components support using the `cs` prop to apply the static styles. It merges
|
|
176
|
-
|
|
322
|
+
Most of our components support using the `cs` prop to apply the static styles. It merges everything
|
|
323
|
+
together and applies `className` and `style` attributes to a React element.
|
|
177
324
|
|
|
178
|
-
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
325
|
+
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4}}>
|
|
326
|
+
<InformationHighlight.Icon />
|
|
327
|
+
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
328
|
+
<InformationHighlight.Body>
|
|
329
|
+
For a more in depth overview, please view our <Hyperlink src="https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-create-styles--docs"> Create Styles </Hyperlink> docs.
|
|
330
|
+
</InformationHighlight.Body>
|
|
184
331
|
</InformationHighlight>
|
|
185
332
|
|
|
186
333
|
### `createStencil`
|
|
@@ -245,10 +392,10 @@ const ThemedCard = ({isDarkTheme, headerColor, elemProps}) => {
|
|
|
245
392
|
};
|
|
246
393
|
```
|
|
247
394
|
|
|
248
|
-
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
395
|
+
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4}}>
|
|
396
|
+
<InformationHighlight.Icon />
|
|
397
|
+
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
398
|
+
<InformationHighlight.Body>
|
|
399
|
+
For a more in depth overview, please view our <Hyperlink src="https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-stencils--docs">Create Stencil</Hyperlink> docs.
|
|
400
|
+
</InformationHighlight.Body>
|
|
254
401
|
</InformationHighlight>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "13.2.
|
|
3
|
+
"version": "13.2.3",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^13.2.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^13.2.
|
|
50
|
-
"@workday/canvas-kit-react": "^13.2.
|
|
51
|
-
"@workday/canvas-kit-styling": "^13.2.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^13.2.3",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^13.2.3",
|
|
50
|
+
"@workday/canvas-kit-react": "^13.2.3",
|
|
51
|
+
"@workday/canvas-kit-styling": "^13.2.3",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.35",
|
|
53
53
|
"@workday/canvas-tokens-web": "^2.1.1",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "4bf7deabfbac10c4b4ff7b706c54292c4bf79e35"
|
|
65
65
|
}
|