Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dash_table/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dash_table/demo.js

Large diffs are not rendered by default.

20,374 changes: 192 additions & 20,182 deletions dash_table/metadata.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3",
"webpack-dev-server": "^3.1.5",
"webpack-preprocessor": "^0.1.11"
"webpack-preprocessor": "^0.1.12"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous version of the preprocessor was having issues with very large files. This one does not..

},
"peerDependencies": {
"react": ">=0.14",
Expand Down
359 changes: 359 additions & 0 deletions generator/cssPropertiesGenerator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,359 @@
const props = [
'alignContent',
'alignItems',
'alignmentAdjust',
'alignmentBaseline',
'alignSelf',
'animationDelay',
'animationDirection',
'animationIterationCount',
'animationName',
'animationPlayState',
'appearance',
'backfaceVisibility',
'background',
'backgroundAttachment',
'backgroundBlendMode',
'backgroundColor',
'backgroundComposite',
'backgroundImage',
'backgroundOrigin',
'backgroundPosition',
'backgroundRepeat',
'baselineShift',
'behavior',
'border',
'borderBottom',
'borderBottomColor',
'borderBottomLeftRadius',
'borderBottomRightRadius',
'borderBottomStyle',
'borderBottomWidth',
'borderCollapse',
'borderColor',
'borderCornerShape',
'borderImageSource',
'borderImageWidth',
'borderLeft',
'borderLeftColor',
'borderLeftStyle',
'borderLeftWidth',
'borderRight',
'borderRightColor',
'borderRightStyle',
'borderRightWidth',
'borderSpacing',
'borderStyle',
'borderTop',
'borderTopColor',
'borderTopLeftRadius',
'borderTopRightRadius',
'borderTopStyle',
'borderTopWidth',
'borderWidth',
'bottom',
'boxAlign',
'boxDecorationBreak',
'boxDirection',
'boxFlex',
'boxFlexGroup',
'boxLineProgression',
'boxLines',
'boxOrdinalGroup',
'boxShadow',
'breakAfter',
'breakBefore',
'breakInside',
'clear',
'clip',
'clipRule',
'color',
'columnCount',
'columnFill',
'columnGap',
'columnRule',
'columnRuleColor',
'columnRuleWidth',
'columns',
'columnSpan',
'columnWidth',
'counterIncrement',
'counterReset',
'cue',
'cueAfter',
'cursor',
'direction',
'display',
'fill',
'fillOpacity',
'fillRule',
'filter',
'flex',
'flexAlign',
'flexBasis',
'flexDirection',
'flexFlow',
'flexGrow',
'flexItemAlign',
'flexLinePack',
'flexOrder',
'flexShrink',
'flexWrap',
'float',
'flowFrom',
'font',
'fontFamily',
'fontKerning',
'fontSize',
'fontSizeAdjust',
'fontStretch',
'fontStyle',
'fontSynthesis',
'fontVariant',
'fontVariantAlternates',
'fontWeight',
'gridArea',
'gridColumn',
'gridColumnEnd',
'gridColumnStart',
'gridRow',
'gridRowEnd',
'gridRowPosition',
'gridRowSpan',
'gridTemplateAreas',
'gridTemplateColumns',
'gridTemplateRows',
'height',
'hyphenateLimitChars',
'hyphenateLimitLines',
'hyphenateLimitZone',
'hyphens',
'imeMode',
'justifyContent',
'layoutGrid',
'layoutGridChar',
'layoutGridLine',
'layoutGridMode',
'layoutGridType',
'left',
'letterSpacing',
'lineBreak',
'lineClamp',
'lineHeight',
'listStyle',
'listStyleImage',
'listStylePosition',
'listStyleType',
'margin',
'marginBottom',
'marginLeft',
'marginRight',
'marginTop',
'marqueeDirection',
'marqueeStyle',
'mask',
'maskBorder',
'maskBorderRepeat',
'maskBorderSlice',
'maskBorderSource',
'maskBorderWidth',
'maskClip',
'maskOrigin',
'maxFontSize',
'maxHeight',
'maxWidth',
'minHeight',
'minWidth',
'opacity',
'order',
'orphans',
'outline',
'outlineColor',
'outlineOffset',
'overflow',
'overflowStyle',
'overflowX',
'overflowY',
'padding',
'paddingBottom',
'paddingLeft',
'paddingRight',
'paddingTop',
'pageBreakAfter',
'pageBreakBefore',
'pageBreakInside',
'pause',
'pauseAfter',
'pauseBefore',
'perspective',
'perspectiveOrigin',
'pointerEvents',
'position',
'punctuationTrim',
'quotes',
'regionFragment',
'restAfter',
'restBefore',
'right',
'rubyAlign',
'rubyPosition',
'shapeImageThreshold',
'shapeInside',
'shapeMargin',
'shapeOutside',
'speak',
'speakAs',
'strokeOpacity',
'strokeWidth',
'tableLayout',
'tabSize',
'textAlign',
'textAlignLast',
'textDecoration',
'textDecorationColor',
'textDecorationLine',
'textDecorationLineThrough',
'textDecorationNone',
'textDecorationOverline',
'textDecorationSkip',
'textDecorationStyle',
'textDecorationUnderline',
'textEmphasis',
'textEmphasisColor',
'textEmphasisStyle',
'textHeight',
'textIndent',
'textJustifyTrim',
'textKashidaSpace',
'textLineThrough',
'textLineThroughColor',
'textLineThroughMode',
'textLineThroughStyle',
'textLineThroughWidth',
'textOverflow',
'textOverline',
'textOverlineColor',
'textOverlineMode',
'textOverlineStyle',
'textOverlineWidth',
'textRendering',
'textScript',
'textShadow',
'textTransform',
'textUnderlinePosition',
'textUnderlineStyle',
'top',
'touchAction',
'transform',
'transformOrigin',
'transformOriginZ',
'transformStyle',
'transition',
'transitionDelay',
'transitionDuration',
'transitionProperty',
'transitionTimingFunction',
'unicodeBidi',
'unicodeRange',
'userFocus',
'userInput',
'verticalAlign',
'visibility',
'voiceBalance',
'voiceDuration',
'voiceFamily',
'voicePitch',
'voiceRange',
'voiceRate',
'voiceStress',
'voiceVolume',
'whiteSpace',
'whiteSpaceTreatment',
'widows',
'width',
'wordBreak',
'wordSpacing',
'wordWrap',
'wrapFlow',
'wrapMargin',
'wrapOption',
'writingMode',
'zIndex',
'zoom'
];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is not quite comprehensive but it's definitely more than the previous one..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file generates the various usages of the props -- just too easy to make a mistake modifying them manually


function toSnakeCase(name) {
return name.replace(/[A-Z]/g, v => `_${v.toLowerCase()}`);
}

function toKebabCase(name) {
return name.replace(/[A-Z]/g, v => `-${v.toLowerCase()}`);
}

const snakes = props.map(prop => [toSnakeCase(prop), prop]);
const kebabs = props.map(prop => [toKebabCase(prop), prop]);
const camels = props.map(prop => [prop, prop]);

const map = new Map();

snakes.forEach(([snake, camel]) => map.set(snake, camel));
kebabs.forEach(([kebab, camel]) => map.set(kebab, camel));
camels.forEach(([camel]) => map.set(camel, camel));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map the camel cased props above to kebab and snake


map.forEach((value, key) => console.log(value, key));
console.log(map.size);

const fs = require('fs');

var stream1 = fs.createWriteStream("src/dash-table/derived/style/py2jsCssProperties.ts");
stream1.once('open', () => {
stream1.write('export type StyleProperty = string | number;\n');
stream1.write('\n');
stream1.write('export default new Map<string, string>([\n');

let first = true;
map.forEach((value, key) => {
if (!first) {
stream1.write(',\n');
}

first = false;
stream1.write(` ['${key}', '${value}']`);
});
stream1.write('\n]);')

stream1.end();
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The camel/kebab/snake to camel mapping for react style


var stream2 = fs.createWriteStream("src/dash-table/derived/style/IStyle.ts");
stream2.once('open', () => {
stream2.write(`import { StyleProperty } from './ py2jsCssProperties';\n`);
stream2.write('\n');
stream2.write('export default interface IStyle {\n');
camels.forEach(([key]) => {
stream2.write(` ${key}: StyleProperty;\n`);
});
stream2.write('}')

stream2.end();
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The style interface for TS


var stream3 = fs.createWriteStream("proptypes.js");
stream3.once('open', () => {
let first = true;
map.forEach((value, key) => {
if (!first) {
stream3.write(',\n');
}

first = false;
if (key.indexOf('-') !== -1) {
stream3.write(` '${key}': PropTypes.oneOfType([PropTypes.string, PropTypes.number])`);
} else {
stream3.write(` ${key}: PropTypes.oneOfType([PropTypes.string, PropTypes.number])`);
}
});
stream3.write('\n')

stream3.end();
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proptypes fragment for table.js / props definition

Loading