musae 0.1.20 → 0.1.21

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.
@@ -0,0 +1,150 @@
1
+ import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { __exports as stylex } from '../../../../_virtual/stylex.js';
3
+ import { __exports as styleq } from '../../../../_virtual/styleq.js';
4
+ import '../../../styleq/dist/styleq.js';
5
+
6
+ Object.defineProperty(stylex, "__esModule", {
7
+ value: true
8
+ });
9
+ stylex.__monkey_patch__ = __monkey_patch__;
10
+ stylex.keyframes = stylex.include = stylex.firstThatWorks = stylex.defineVars = stylex["default"] = stylex.createTheme = stylex.create = void 0;
11
+ var props_1 = stylex.props = props;
12
+ stylex.types = stylex.stylex = void 0;
13
+ var _styleq = styleq;
14
+ function props() {
15
+ var options = this;
16
+ for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ styles[_key] = arguments[_key];
18
+ }
19
+ if (__implementations.props) {
20
+ return __implementations.props.call(options, styles);
21
+ }
22
+ var _ref = (0, _styleq.styleq)(styles),
23
+ _ref2 = _slicedToArray(_ref, 2),
24
+ className = _ref2[0],
25
+ style = _ref2[1];
26
+ var result = {};
27
+ if (className != null && className !== '') {
28
+ result.className = className;
29
+ }
30
+ if (style != null && Object.keys(style).length > 0) {
31
+ result.style = style;
32
+ }
33
+ return result;
34
+ }
35
+ function stylexCreate(styles) {
36
+ if (__implementations.create != null) {
37
+ var _create = __implementations.create;
38
+ return _create(styles);
39
+ }
40
+ throw new Error('stylex.create should never be called. It should be compiled away.');
41
+ }
42
+ function stylexDefineVars(styles) {
43
+ if (__implementations.defineVars) {
44
+ return __implementations.defineVars(styles);
45
+ }
46
+ throw new Error('stylex.defineVars should never be called. It should be compiled away.');
47
+ }
48
+ var stylexCreateTheme = function stylexCreateTheme(baseTokens, overrides) {
49
+ if (__implementations.createTheme) {
50
+ return __implementations.createTheme(baseTokens, overrides);
51
+ }
52
+ throw new Error('stylex.createTheme should never be called. It should be compiled away.');
53
+ };
54
+ var stylexInclude = function stylexInclude(styles) {
55
+ if (__implementations.include) {
56
+ return __implementations.include(styles);
57
+ }
58
+ throw new Error('stylex.extends should never be called. It should be compiled away.');
59
+ };
60
+ var create = stylex.create = stylexCreate;
61
+ var defineVars = stylex.defineVars = stylexDefineVars;
62
+ var createTheme = stylex.createTheme = stylexCreateTheme;
63
+ var include = stylex.include = stylexInclude;
64
+ var types = stylex.types = {
65
+ angle: function angle(_v) {
66
+ throw new Error(errorForType('angle'));
67
+ },
68
+ color: function color(_v) {
69
+ throw new Error(errorForType('color'));
70
+ },
71
+ url: function url(_v) {
72
+ throw new Error(errorForType('url'));
73
+ },
74
+ image: function image(_v) {
75
+ throw new Error(errorForType('image'));
76
+ },
77
+ integer: function integer(_v) {
78
+ throw new Error(errorForType('integer'));
79
+ },
80
+ lengthPercentage: function lengthPercentage(_v) {
81
+ throw new Error(errorForType('lengthPercentage'));
82
+ },
83
+ length: function length(_v) {
84
+ throw new Error(errorForType('length'));
85
+ },
86
+ percentage: function percentage(_v) {
87
+ throw new Error(errorForType('percentage'));
88
+ },
89
+ number: function number(_v) {
90
+ throw new Error(errorForType('number'));
91
+ },
92
+ resolution: function resolution(_v) {
93
+ throw new Error(errorForType('resolution'));
94
+ },
95
+ time: function time(_v) {
96
+ throw new Error(errorForType('time'));
97
+ },
98
+ transformFunction: function transformFunction(_v) {
99
+ throw new Error(errorForType('transformFunction'));
100
+ },
101
+ transformList: function transformList(_v) {
102
+ throw new Error(errorForType('transformList'));
103
+ }
104
+ };
105
+ var errorForType = function errorForType(type) {
106
+ return "stylex.types.".concat(type, " should be compiled away by @stylexjs/babel-plugin");
107
+ };
108
+ var keyframes = function keyframes(_keyframes) {
109
+ if (__implementations.keyframes) {
110
+ return __implementations.keyframes(_keyframes);
111
+ }
112
+ throw new Error('stylex.keyframes should never be called');
113
+ };
114
+ stylex.keyframes = keyframes;
115
+ var firstThatWorks = function firstThatWorks() {
116
+ if (__implementations.firstThatWorks) {
117
+ return __implementations.firstThatWorks.apply(__implementations, arguments);
118
+ }
119
+ throw new Error('stylex.firstThatWorks should never be called.');
120
+ };
121
+ stylex.firstThatWorks = firstThatWorks;
122
+ function _stylex() {
123
+ for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
124
+ styles[_key2] = arguments[_key2];
125
+ }
126
+ var _ref3 = (0, _styleq.styleq)(styles),
127
+ _ref4 = _slicedToArray(_ref3, 1),
128
+ className = _ref4[0];
129
+ return className;
130
+ }
131
+ _stylex.props = props;
132
+ _stylex.create = create;
133
+ _stylex.defineVars = defineVars;
134
+ _stylex.createTheme = createTheme;
135
+ _stylex.include = include;
136
+ _stylex.keyframes = keyframes;
137
+ _stylex.firstThatWorks = firstThatWorks;
138
+ _stylex.types = types;
139
+ var __implementations = {};
140
+ function __monkey_patch__(key, implementation) {
141
+ if (key === 'types') {
142
+ Object.assign(types, implementation);
143
+ } else {
144
+ __implementations[key] = implementation;
145
+ }
146
+ }
147
+ stylex.stylex = _stylex;
148
+ stylex["default"] = _stylex;
149
+
150
+ export { props_1 as props };
@@ -0,0 +1,149 @@
1
+ import { __exports as styleq$1 } from '../../../_virtual/styleq.js';
2
+
3
+ /**
4
+ * Copyright (c) Nicolas Gallagher
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ *
10
+ */
11
+ Object.defineProperty(styleq$1, "__esModule", {
12
+ value: true
13
+ });
14
+ styleq$1.styleq = void 0;
15
+ var cache = new WeakMap();
16
+ var compiledKey = '$$css';
17
+ function createStyleq(options) {
18
+ var disableCache;
19
+ var disableMix;
20
+ var transform;
21
+ if (options != null) {
22
+ disableCache = options.disableCache === true;
23
+ disableMix = options.disableMix === true;
24
+ transform = options.transform;
25
+ }
26
+ return function styleq() {
27
+ // Keep track of property commits to the className
28
+ var definedProperties = []; // The className and inline style to build up
29
+
30
+ var className = '';
31
+ var inlineStyle = null; // The current position in the cache graph
32
+
33
+ var nextCache = disableCache ? null : cache; // This way of creating an array from arguments is fastest
34
+
35
+ var styles = new Array(arguments.length);
36
+ for (var i = 0; i < arguments.length; i++) {
37
+ styles[i] = arguments[i];
38
+ } // Iterate over styles from last to first
39
+
40
+ while (styles.length > 0) {
41
+ var possibleStyle = styles.pop(); // Skip empty items
42
+
43
+ if (possibleStyle == null || possibleStyle === false) {
44
+ continue;
45
+ } // Push nested styles back onto the stack to be processed
46
+
47
+ if (Array.isArray(possibleStyle)) {
48
+ for (var _i = 0; _i < possibleStyle.length; _i++) {
49
+ styles.push(possibleStyle[_i]);
50
+ }
51
+ continue;
52
+ } // Process an individual style object
53
+
54
+ var style = transform != null ? transform(possibleStyle) : possibleStyle;
55
+ if (style.$$css) {
56
+ // Build up the class names defined by this object
57
+ var classNameChunk = ''; // Check the cache to see if we've already done this work
58
+
59
+ if (nextCache != null && nextCache.has(style)) {
60
+ // Cache: read
61
+ var cacheEntry = nextCache.get(style);
62
+ if (cacheEntry != null) {
63
+ classNameChunk = cacheEntry[0]; // $FlowIgnore
64
+
65
+ definedProperties.push.apply(definedProperties, cacheEntry[1]);
66
+ nextCache = cacheEntry[2];
67
+ }
68
+ } // Update the chunks with data from this object
69
+ else {
70
+ // The properties defined by this object
71
+ var definedPropertiesChunk = [];
72
+ for (var prop in style) {
73
+ var value = style[prop];
74
+ if (prop === compiledKey) continue; // Each property value is used as an HTML class name
75
+ // { 'debug.string': 'debug.string', opacity: 's-jskmnoqp' }
76
+
77
+ if (typeof value === 'string' || value === null) {
78
+ // Only add to chunks if this property hasn't already been seen
79
+ if (!definedProperties.includes(prop)) {
80
+ definedProperties.push(prop);
81
+ if (nextCache != null) {
82
+ definedPropertiesChunk.push(prop);
83
+ }
84
+ if (typeof value === 'string') {
85
+ classNameChunk += classNameChunk ? ' ' + value : value;
86
+ }
87
+ }
88
+ } // If we encounter a value that isn't a string or `null`
89
+ else {
90
+ console.error("styleq: ".concat(prop, " typeof ").concat(String(value), " is not \"string\" or \"null\"."));
91
+ }
92
+ } // Cache: write
93
+
94
+ if (nextCache != null) {
95
+ // Create the next WeakMap for this sequence of styles
96
+ var weakMap = new WeakMap();
97
+ nextCache.set(style, [classNameChunk, definedPropertiesChunk, weakMap]);
98
+ nextCache = weakMap;
99
+ }
100
+ } // Order of classes in chunks matches property-iteration order of style
101
+ // object. Order of chunks matches passed order of styles from first to
102
+ // last (which we iterate over in reverse).
103
+
104
+ if (classNameChunk) {
105
+ className = className ? classNameChunk + ' ' + className : classNameChunk;
106
+ }
107
+ } // ----- DYNAMIC: Process inline style object -----
108
+ else {
109
+ if (disableMix) {
110
+ if (inlineStyle == null) {
111
+ inlineStyle = {};
112
+ }
113
+ inlineStyle = Object.assign({}, style, inlineStyle);
114
+ } else {
115
+ var subStyle = null;
116
+ for (var _prop in style) {
117
+ var _value = style[_prop];
118
+ if (_value !== undefined) {
119
+ if (!definedProperties.includes(_prop)) {
120
+ if (_value != null) {
121
+ if (inlineStyle == null) {
122
+ inlineStyle = {};
123
+ }
124
+ if (subStyle == null) {
125
+ subStyle = {};
126
+ }
127
+ subStyle[_prop] = _value;
128
+ }
129
+ definedProperties.push(_prop); // Cache is unnecessary overhead if results can't be reused.
130
+
131
+ nextCache = null;
132
+ }
133
+ }
134
+ }
135
+ if (subStyle != null) {
136
+ inlineStyle = Object.assign(subStyle, inlineStyle);
137
+ }
138
+ }
139
+ }
140
+ }
141
+ var styleProps = [className, inlineStyle];
142
+ return styleProps;
143
+ };
144
+ }
145
+ var styleq = createStyleq();
146
+ styleq$1.styleq = styleq;
147
+ styleq.factory = createStyleq;
148
+
149
+ export { styleq$1 as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",