@bookklik/senangstart-css 0.1.7 → 0.2.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.
- package/README.md +38 -0
- package/dist/senangstart-css.js +2269 -1955
- package/dist/senangstart-css.min.js +141 -1479
- package/docs/.vitepress/config.js +5 -3
- package/docs/.vitepress/theme/custom.css +0 -1
- package/docs/guide/responsive.md +25 -0
- package/docs/index.md +9 -21
- package/docs/ms/guide/responsive.md +25 -0
- package/docs/ms/index.md +9 -21
- package/docs/ms/reference/breakpoints.md +23 -0
- package/docs/ms/reference/layout/align-content.md +57 -4
- package/docs/ms/reference/layout/align-items.md +81 -4
- package/docs/ms/reference/layout/align-self.md +25 -4
- package/docs/ms/reference/layout/aspect-ratio.md +27 -8
- package/docs/ms/reference/layout/border-collapse.md +81 -4
- package/docs/ms/reference/layout/border-spacing.md +43 -8
- package/docs/ms/reference/layout/box-sizing.md +21 -4
- package/docs/ms/reference/layout/caption-side.md +69 -4
- package/docs/ms/reference/layout/columns.md +21 -4
- package/docs/ms/reference/layout/container.md +21 -4
- package/docs/ms/reference/layout/display.md +39 -7
- package/docs/ms/reference/layout/flex-basis.md +29 -8
- package/docs/ms/reference/layout/flex-direction.md +81 -4
- package/docs/ms/reference/layout/flex-items.md +51 -4
- package/docs/ms/reference/layout/flex-wrap.md +55 -4
- package/docs/ms/reference/layout/flex.md +54 -7
- package/docs/ms/reference/layout/float-clear.md +23 -4
- package/docs/ms/reference/layout/grid-auto-flow.md +57 -4
- package/docs/ms/reference/layout/grid-auto-sizing.md +25 -4
- package/docs/ms/reference/layout/grid-column-span.md +59 -4
- package/docs/ms/reference/layout/grid-columns.md +61 -4
- package/docs/ms/reference/layout/grid-row-span.md +29 -4
- package/docs/ms/reference/layout/grid-rows.md +31 -4
- package/docs/ms/reference/layout/inset.md +56 -7
- package/docs/ms/reference/layout/isolation.md +21 -4
- package/docs/ms/reference/layout/justify-content.md +81 -4
- package/docs/ms/reference/layout/justify-items.md +25 -4
- package/docs/ms/reference/layout/justify-self.md +25 -4
- package/docs/ms/reference/layout/object-fit.md +57 -4
- package/docs/ms/reference/layout/object-position.md +29 -8
- package/docs/ms/reference/layout/order.md +53 -4
- package/docs/ms/reference/layout/overflow.md +45 -4
- package/docs/ms/reference/layout/overscroll.md +21 -4
- package/docs/ms/reference/layout/place-content.md +23 -4
- package/docs/ms/reference/layout/place-items.md +25 -4
- package/docs/ms/reference/layout/place-self.md +25 -4
- package/docs/ms/reference/layout/position.md +47 -4
- package/docs/ms/reference/layout/shorthand-alignment.md +47 -4
- package/docs/ms/reference/layout/table-layout.md +69 -4
- package/docs/ms/reference/layout/visibility.md +25 -4
- package/docs/ms/reference/layout/z-index.md +27 -4
- package/docs/ms/reference/space/gap.md +71 -7
- package/docs/ms/reference/space/height.md +61 -7
- package/docs/ms/reference/space/margin.md +61 -7
- package/docs/ms/reference/space/padding.md +65 -7
- package/docs/ms/reference/space/width.md +61 -7
- package/docs/ms/reference/visual/accent-color.md +29 -8
- package/docs/ms/reference/visual/animation-builtin.md +29 -8
- package/docs/ms/reference/visual/animation-delay.md +25 -8
- package/docs/ms/reference/visual/animation-direction.md +25 -4
- package/docs/ms/reference/visual/animation-duration.md +27 -8
- package/docs/ms/reference/visual/animation-fill.md +25 -4
- package/docs/ms/reference/visual/animation-iteration.md +23 -4
- package/docs/ms/reference/visual/animation-play.md +23 -4
- package/docs/ms/reference/visual/appearance.md +23 -4
- package/docs/ms/reference/visual/backdrop-blur.md +29 -8
- package/docs/ms/reference/visual/backdrop-brightness.md +29 -8
- package/docs/ms/reference/visual/backdrop-contrast.md +29 -8
- package/docs/ms/reference/visual/backdrop-grayscale.md +27 -8
- package/docs/ms/reference/visual/backdrop-hue-rotate.md +29 -8
- package/docs/ms/reference/visual/backdrop-invert.md +27 -8
- package/docs/ms/reference/visual/backdrop-opacity.md +29 -8
- package/docs/ms/reference/visual/backdrop-saturate.md +29 -8
- package/docs/ms/reference/visual/backdrop-sepia.md +27 -8
- package/docs/ms/reference/visual/background-attachment.md +23 -4
- package/docs/ms/reference/visual/background-blend-mode.md +25 -4
- package/docs/ms/reference/visual/background-clip.md +21 -4
- package/docs/ms/reference/visual/background-color.md +33 -8
- package/docs/ms/reference/visual/background-image.md +27 -8
- package/docs/ms/reference/visual/background-origin.md +25 -4
- package/docs/ms/reference/visual/background-position.md +29 -8
- package/docs/ms/reference/visual/background-repeat.md +25 -4
- package/docs/ms/reference/visual/background-size.md +29 -8
- package/docs/ms/reference/visual/blend-modes.md +23 -4
- package/docs/ms/reference/visual/border-radius.md +36 -4
- package/docs/ms/reference/visual/border-style.md +25 -4
- package/docs/ms/reference/visual/border-width.md +29 -8
- package/docs/ms/reference/visual/border.md +56 -7
- package/docs/ms/reference/visual/box-shadow.md +34 -4
- package/docs/ms/reference/visual/caret-color.md +25 -8
- package/docs/ms/reference/visual/color-scheme.md +23 -4
- package/docs/ms/reference/visual/cursor.md +25 -4
- package/docs/ms/reference/visual/field-sizing.md +23 -4
- package/docs/ms/reference/visual/fill.md +29 -8
- package/docs/ms/reference/visual/filter-blur.md +29 -8
- package/docs/ms/reference/visual/filter-brightness.md +29 -8
- package/docs/ms/reference/visual/filter-contrast.md +29 -8
- package/docs/ms/reference/visual/filter-drop-shadow.md +29 -8
- package/docs/ms/reference/visual/filter-grayscale.md +29 -8
- package/docs/ms/reference/visual/filter-hue-rotate.md +29 -8
- package/docs/ms/reference/visual/filter-invert.md +27 -8
- package/docs/ms/reference/visual/filter-saturate.md +29 -8
- package/docs/ms/reference/visual/filter-sepia.md +29 -8
- package/docs/ms/reference/visual/font-family.md +25 -4
- package/docs/ms/reference/visual/font-smoothing.md +23 -4
- package/docs/ms/reference/visual/font-style.md +23 -4
- package/docs/ms/reference/visual/font-variant-numeric.md +23 -4
- package/docs/ms/reference/visual/font-weight.md +35 -4
- package/docs/ms/reference/visual/forced-color-adjust.md +23 -4
- package/docs/ms/reference/visual/hyphens.md +25 -4
- package/docs/ms/reference/visual/letter-spacing.md +29 -8
- package/docs/ms/reference/visual/line-clamp.md +29 -8
- package/docs/ms/reference/visual/line-height.md +29 -8
- package/docs/ms/reference/visual/list-style.md +25 -4
- package/docs/ms/reference/visual/mask.md +25 -8
- package/docs/ms/reference/visual/opacity.md +27 -4
- package/docs/ms/reference/visual/outline.md +25 -8
- package/docs/ms/reference/visual/pointer-events.md +23 -4
- package/docs/ms/reference/visual/resize.md +27 -4
- package/docs/ms/reference/visual/scroll-behavior.md +23 -4
- package/docs/ms/reference/visual/scroll-margin.md +25 -8
- package/docs/ms/reference/visual/scroll-padding.md +25 -8
- package/docs/ms/reference/visual/scroll-snap-align.md +25 -4
- package/docs/ms/reference/visual/scroll-snap-stop.md +23 -4
- package/docs/ms/reference/visual/scroll-snap-type.md +25 -4
- package/docs/ms/reference/visual/state-prefixes.md +21 -4
- package/docs/ms/reference/visual/stroke-width.md +29 -8
- package/docs/ms/reference/visual/stroke.md +27 -8
- package/docs/ms/reference/visual/text-alignment.md +25 -4
- package/docs/ms/reference/visual/text-color.md +31 -8
- package/docs/ms/reference/visual/text-decoration.md +23 -4
- package/docs/ms/reference/visual/text-indent.md +25 -8
- package/docs/ms/reference/visual/text-overflow.md +21 -4
- package/docs/ms/reference/visual/text-shadow.md +25 -8
- package/docs/ms/reference/visual/text-size.md +41 -7
- package/docs/ms/reference/visual/text-transform.md +25 -4
- package/docs/ms/reference/visual/text-wrap.md +25 -4
- package/docs/ms/reference/visual/touch-action.md +25 -4
- package/docs/ms/reference/visual/transform-backface.md +23 -4
- package/docs/ms/reference/visual/transform-origin.md +27 -8
- package/docs/ms/reference/visual/transform-perspective-origin.md +25 -8
- package/docs/ms/reference/visual/transform-perspective.md +25 -8
- package/docs/ms/reference/visual/transform-rotate.md +29 -8
- package/docs/ms/reference/visual/transform-scale.md +29 -8
- package/docs/ms/reference/visual/transform-skew.md +29 -8
- package/docs/ms/reference/visual/transform-style.md +23 -4
- package/docs/ms/reference/visual/transform-translate.md +29 -8
- package/docs/ms/reference/visual/transition-delay.md +25 -8
- package/docs/ms/reference/visual/transition-duration.md +27 -8
- package/docs/ms/reference/visual/transition-property.md +21 -4
- package/docs/ms/reference/visual/transition-timing.md +29 -8
- package/docs/ms/reference/visual/typography-keywords.md +27 -4
- package/docs/ms/reference/visual/user-select.md +23 -4
- package/docs/ms/reference/visual/vertical-align.md +25 -4
- package/docs/ms/reference/visual/whitespace.md +25 -4
- package/docs/ms/reference/visual/will-change.md +23 -4
- package/docs/ms/reference/visual/word-break.md +25 -4
- package/docs/public/assets/senangstart-css-logo.svg +1 -0
- package/docs/reference/breakpoints.md +23 -0
- package/docs/reference/layout/align-content.md +57 -4
- package/docs/reference/layout/align-items.md +81 -4
- package/docs/reference/layout/align-self.md +25 -4
- package/docs/reference/layout/aspect-ratio.md +27 -8
- package/docs/reference/layout/border-collapse.md +81 -4
- package/docs/reference/layout/border-spacing.md +43 -8
- package/docs/reference/layout/box-sizing.md +21 -4
- package/docs/reference/layout/caption-side.md +69 -4
- package/docs/reference/layout/columns.md +21 -4
- package/docs/reference/layout/container.md +21 -4
- package/docs/reference/layout/display.md +39 -7
- package/docs/reference/layout/flex-basis.md +29 -8
- package/docs/reference/layout/flex-direction.md +81 -4
- package/docs/reference/layout/flex-items.md +51 -4
- package/docs/reference/layout/flex-wrap.md +55 -4
- package/docs/reference/layout/flex.md +54 -7
- package/docs/reference/layout/float-clear.md +23 -4
- package/docs/reference/layout/grid-auto-flow.md +57 -4
- package/docs/reference/layout/grid-auto-sizing.md +25 -4
- package/docs/reference/layout/grid-column-span.md +59 -4
- package/docs/reference/layout/grid-columns.md +61 -4
- package/docs/reference/layout/grid-row-span.md +29 -4
- package/docs/reference/layout/grid-rows.md +31 -4
- package/docs/reference/layout/inset.md +56 -7
- package/docs/reference/layout/isolation.md +21 -4
- package/docs/reference/layout/justify-content.md +81 -4
- package/docs/reference/layout/justify-items.md +25 -4
- package/docs/reference/layout/justify-self.md +25 -4
- package/docs/reference/layout/object-fit.md +57 -4
- package/docs/reference/layout/object-position.md +29 -8
- package/docs/reference/layout/order.md +53 -4
- package/docs/reference/layout/overflow.md +45 -4
- package/docs/reference/layout/overscroll.md +21 -4
- package/docs/reference/layout/place-content.md +23 -4
- package/docs/reference/layout/place-items.md +25 -4
- package/docs/reference/layout/place-self.md +25 -4
- package/docs/reference/layout/position.md +47 -4
- package/docs/reference/layout/shorthand-alignment.md +47 -4
- package/docs/reference/layout/table-layout.md +69 -4
- package/docs/reference/layout/visibility.md +25 -4
- package/docs/reference/layout/z-index.md +27 -4
- package/docs/reference/space/gap.md +71 -7
- package/docs/reference/space/height.md +61 -7
- package/docs/reference/space/margin.md +61 -7
- package/docs/reference/space/padding.md +65 -7
- package/docs/reference/space/width.md +61 -7
- package/docs/reference/visual/accent-color.md +29 -8
- package/docs/reference/visual/animation-builtin.md +29 -8
- package/docs/reference/visual/animation-delay.md +25 -8
- package/docs/reference/visual/animation-direction.md +25 -4
- package/docs/reference/visual/animation-duration.md +27 -8
- package/docs/reference/visual/animation-fill.md +25 -4
- package/docs/reference/visual/animation-iteration.md +23 -4
- package/docs/reference/visual/animation-play.md +23 -4
- package/docs/reference/visual/appearance.md +23 -4
- package/docs/reference/visual/backdrop-blur.md +29 -8
- package/docs/reference/visual/backdrop-brightness.md +29 -8
- package/docs/reference/visual/backdrop-contrast.md +29 -8
- package/docs/reference/visual/backdrop-grayscale.md +27 -8
- package/docs/reference/visual/backdrop-hue-rotate.md +29 -8
- package/docs/reference/visual/backdrop-invert.md +27 -8
- package/docs/reference/visual/backdrop-opacity.md +29 -8
- package/docs/reference/visual/backdrop-saturate.md +29 -8
- package/docs/reference/visual/backdrop-sepia.md +27 -8
- package/docs/reference/visual/background-attachment.md +23 -4
- package/docs/reference/visual/background-blend-mode.md +25 -4
- package/docs/reference/visual/background-clip.md +21 -4
- package/docs/reference/visual/background-color.md +33 -8
- package/docs/reference/visual/background-image.md +27 -8
- package/docs/reference/visual/background-origin.md +25 -4
- package/docs/reference/visual/background-position.md +29 -8
- package/docs/reference/visual/background-repeat.md +25 -4
- package/docs/reference/visual/background-size.md +29 -8
- package/docs/reference/visual/blend-modes.md +23 -4
- package/docs/reference/visual/border-radius.md +36 -4
- package/docs/reference/visual/border-style.md +25 -4
- package/docs/reference/visual/border-width.md +29 -8
- package/docs/reference/visual/border.md +56 -7
- package/docs/reference/visual/box-shadow.md +34 -4
- package/docs/reference/visual/caret-color.md +25 -8
- package/docs/reference/visual/color-scheme.md +23 -4
- package/docs/reference/visual/cursor.md +25 -4
- package/docs/reference/visual/field-sizing.md +23 -4
- package/docs/reference/visual/fill.md +29 -8
- package/docs/reference/visual/filter-blur.md +29 -8
- package/docs/reference/visual/filter-brightness.md +29 -8
- package/docs/reference/visual/filter-contrast.md +29 -8
- package/docs/reference/visual/filter-drop-shadow.md +29 -8
- package/docs/reference/visual/filter-grayscale.md +29 -8
- package/docs/reference/visual/filter-hue-rotate.md +29 -8
- package/docs/reference/visual/filter-invert.md +27 -8
- package/docs/reference/visual/filter-saturate.md +29 -8
- package/docs/reference/visual/filter-sepia.md +29 -8
- package/docs/reference/visual/font-family.md +25 -4
- package/docs/reference/visual/font-smoothing.md +23 -4
- package/docs/reference/visual/font-style.md +23 -4
- package/docs/reference/visual/font-variant-numeric.md +23 -4
- package/docs/reference/visual/font-weight.md +35 -4
- package/docs/reference/visual/forced-color-adjust.md +23 -4
- package/docs/reference/visual/hyphens.md +25 -4
- package/docs/reference/visual/letter-spacing.md +29 -8
- package/docs/reference/visual/line-clamp.md +29 -8
- package/docs/reference/visual/line-height.md +29 -8
- package/docs/reference/visual/list-style.md +25 -4
- package/docs/reference/visual/mask.md +25 -8
- package/docs/reference/visual/opacity.md +27 -4
- package/docs/reference/visual/outline.md +25 -8
- package/docs/reference/visual/pointer-events.md +23 -4
- package/docs/reference/visual/resize.md +27 -4
- package/docs/reference/visual/scroll-behavior.md +23 -4
- package/docs/reference/visual/scroll-margin.md +25 -8
- package/docs/reference/visual/scroll-padding.md +25 -8
- package/docs/reference/visual/scroll-snap-align.md +25 -4
- package/docs/reference/visual/scroll-snap-stop.md +23 -4
- package/docs/reference/visual/scroll-snap-type.md +25 -4
- package/docs/reference/visual/state-prefixes.md +21 -4
- package/docs/reference/visual/stroke-width.md +29 -8
- package/docs/reference/visual/stroke.md +27 -8
- package/docs/reference/visual/text-alignment.md +25 -4
- package/docs/reference/visual/text-color.md +31 -8
- package/docs/reference/visual/text-decoration.md +23 -4
- package/docs/reference/visual/text-indent.md +25 -8
- package/docs/reference/visual/text-overflow.md +21 -4
- package/docs/reference/visual/text-shadow.md +25 -8
- package/docs/reference/visual/text-size.md +41 -7
- package/docs/reference/visual/text-transform.md +25 -4
- package/docs/reference/visual/text-wrap.md +25 -4
- package/docs/reference/visual/touch-action.md +25 -4
- package/docs/reference/visual/transform-backface.md +23 -4
- package/docs/reference/visual/transform-origin.md +27 -8
- package/docs/reference/visual/transform-perspective-origin.md +25 -8
- package/docs/reference/visual/transform-perspective.md +25 -8
- package/docs/reference/visual/transform-rotate.md +29 -8
- package/docs/reference/visual/transform-scale.md +29 -8
- package/docs/reference/visual/transform-skew.md +29 -8
- package/docs/reference/visual/transform-style.md +23 -4
- package/docs/reference/visual/transform-translate.md +29 -8
- package/docs/reference/visual/transition-delay.md +25 -8
- package/docs/reference/visual/transition-duration.md +27 -8
- package/docs/reference/visual/transition-property.md +21 -4
- package/docs/reference/visual/transition-timing.md +29 -8
- package/docs/reference/visual/typography-keywords.md +27 -4
- package/docs/reference/visual/user-select.md +23 -4
- package/docs/reference/visual/vertical-align.md +25 -4
- package/docs/reference/visual/whitespace.md +25 -4
- package/docs/reference/visual/will-change.md +23 -4
- package/docs/reference/visual/word-break.md +25 -4
- package/package.json +4 -3
- package/playground/jit-tw-mix-test.html +238 -0
- package/playground/tw-convertor.html +696 -0
- package/scripts/build-dist.js +34 -29
- package/scripts/bundle-jit.js +45 -0
- package/scripts/convert-tailwind.js +759 -0
- package/scripts/generate-docs.js +65 -16
- package/src/cdn/jit.js +313 -102
- package/src/cli/commands/build.js +14 -6
- package/src/cli/commands/dev.js +28 -10
- package/src/compiler/generators/css.js +187 -28
- package/src/compiler/parser.js +23 -10
- package/src/compiler/tokenizer.js +19 -137
- package/src/config/defaults.js +45 -18
- package/src/core/constants.js +427 -0
- package/src/core/tokenizer-core.js +233 -0
- package/src/definitions/layout-alignment.js +210 -0
- package/src/definitions/layout-flex.js +155 -0
- package/src/definitions/layout-grid.js +134 -0
- package/src/definitions/layout-positioning.js +64 -0
- package/src/definitions/layout-table.js +129 -0
- package/src/definitions/layout-utilities.js +164 -0
- package/src/definitions/space.js +172 -0
- package/src/definitions/visual-backgrounds.js +231 -0
- package/src/definitions/visual-borders.js +66 -0
- package/src/definitions/visual-filters.js +111 -0
- package/src/definitions/visual-interactivity.js +159 -0
- package/src/definitions/visual-svg.js +41 -0
- package/src/definitions/visual-transform3d.js +74 -0
- package/src/definitions/visual-transforms.js +69 -0
- package/src/definitions/visual-transitions.js +144 -0
- package/src/definitions/visual-typography.js +214 -0
- package/src/definitions/visual.js +306 -1
- package/tests/integration/compiler.test.js +63 -2
- package/tests/unit/convert-tailwind.test.js +324 -0
- package/tests/unit/security.test.js +206 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SenangStart CSS - Core Tokenizer
|
|
3
|
+
* Pure tokenizer functions shared by JIT runtime and build-time compiler
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BREAKPOINTS, STATES, LAYOUT_KEYWORDS } from './constants.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sanitize token value to prevent CSS injection
|
|
10
|
+
* @param {string} value - Value to sanitize
|
|
11
|
+
* @returns {string} - Sanitized value
|
|
12
|
+
*/
|
|
13
|
+
export function sanitizeValue(value) {
|
|
14
|
+
if (typeof value !== 'string') {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
// Only remove semicolons which can terminate CSS rules
|
|
18
|
+
// Allow braces for legitimate use cases like content:["{icon}"]
|
|
19
|
+
return value.replace(/;/g, '_');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Validate token structure
|
|
24
|
+
* @param {Object} token - Token to validate
|
|
25
|
+
* @returns {boolean} - True if valid
|
|
26
|
+
*/
|
|
27
|
+
export function isValidToken(token) {
|
|
28
|
+
if (!token.property || typeof token.property !== 'string') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (token.property.length > 100) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (token.value !== null && typeof token.value !== 'string') {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (token.value && token.value.length > 500) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (token.breakpoint && !BREAKPOINTS.includes(token.breakpoint)) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (token.state && !STATES.includes(token.state)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Lightweight token parser (no validation, used for internal processing)
|
|
51
|
+
* @param {string} raw - Raw token string
|
|
52
|
+
* @returns {Object} - Parsed token object
|
|
53
|
+
*/
|
|
54
|
+
export function parseToken(raw) {
|
|
55
|
+
const token = {
|
|
56
|
+
raw,
|
|
57
|
+
breakpoint: null,
|
|
58
|
+
state: null,
|
|
59
|
+
property: null,
|
|
60
|
+
value: null,
|
|
61
|
+
isArbitrary: false
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const parts = raw.split(':');
|
|
65
|
+
let idx = 0;
|
|
66
|
+
|
|
67
|
+
// Check for breakpoint
|
|
68
|
+
if (BREAKPOINTS.includes(parts[0])) {
|
|
69
|
+
token.breakpoint = parts[0];
|
|
70
|
+
idx++;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Check for state
|
|
74
|
+
if (STATES.includes(parts[idx])) {
|
|
75
|
+
token.state = parts[idx];
|
|
76
|
+
idx++;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Property
|
|
80
|
+
if (idx < parts.length) {
|
|
81
|
+
token.property = parts[idx];
|
|
82
|
+
idx++;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Value
|
|
86
|
+
if (idx < parts.length) {
|
|
87
|
+
let value = parts.slice(idx).join(':');
|
|
88
|
+
const arbitraryMatch = value.match(/^\[(.+)\]$/);
|
|
89
|
+
if (arbitraryMatch) {
|
|
90
|
+
token.value = arbitraryMatch[1].replace(/_/g, ' ');
|
|
91
|
+
token.isArbitrary = true;
|
|
92
|
+
} else {
|
|
93
|
+
token.value = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return token;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Tokenize a single attribute value string
|
|
102
|
+
* @param {string} raw - Raw token string (e.g., "tab:p:big")
|
|
103
|
+
* @param {string} attrType - Attribute type: 'layout', 'space', or 'visual'
|
|
104
|
+
* @returns {Object} - Parsed token object
|
|
105
|
+
*/
|
|
106
|
+
export function tokenize(raw, attrType) {
|
|
107
|
+
// Validate input
|
|
108
|
+
if (typeof raw !== 'string' || raw.length === 0 || raw.length > 200) {
|
|
109
|
+
return {
|
|
110
|
+
raw,
|
|
111
|
+
breakpoint: null,
|
|
112
|
+
state: null,
|
|
113
|
+
property: null,
|
|
114
|
+
value: null,
|
|
115
|
+
isArbitrary: false,
|
|
116
|
+
attrType,
|
|
117
|
+
error: 'Invalid token format'
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const token = {
|
|
122
|
+
raw,
|
|
123
|
+
breakpoint: null,
|
|
124
|
+
state: null,
|
|
125
|
+
property: null,
|
|
126
|
+
value: null,
|
|
127
|
+
isArbitrary: false,
|
|
128
|
+
attrType
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// Handle layout keywords (simple words like 'flex', 'center')
|
|
132
|
+
if (attrType === 'layout') {
|
|
133
|
+
// Check for z-index syntax (z:top, z:base)
|
|
134
|
+
if (raw.startsWith('z:')) {
|
|
135
|
+
token.property = 'z';
|
|
136
|
+
token.value = raw.substring(2);
|
|
137
|
+
return token;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Check for overflow syntax
|
|
141
|
+
if (raw.startsWith('overflow:')) {
|
|
142
|
+
token.property = 'overflow';
|
|
143
|
+
token.value = raw.substring(9);
|
|
144
|
+
return token;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Simple layout keyword
|
|
148
|
+
if (LAYOUT_KEYWORDS.includes(raw)) {
|
|
149
|
+
token.property = raw;
|
|
150
|
+
token.value = raw;
|
|
151
|
+
return token;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Check for responsive layout (e.g., tab:row)
|
|
155
|
+
const parts = raw.split(':');
|
|
156
|
+
if (parts.length === 2 && BREAKPOINTS.includes(parts[0])) {
|
|
157
|
+
token.breakpoint = parts[0];
|
|
158
|
+
token.property = parts[1];
|
|
159
|
+
token.value = parts[1];
|
|
160
|
+
return token;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Handle space and visual attributes with colon syntax
|
|
165
|
+
const parts = raw.split(':');
|
|
166
|
+
|
|
167
|
+
if (parts.length === 1) {
|
|
168
|
+
// Single value (shouldn't happen for space/visual, but handle it)
|
|
169
|
+
token.property = raw;
|
|
170
|
+
token.value = raw;
|
|
171
|
+
return token;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
let idx = 0;
|
|
175
|
+
|
|
176
|
+
// Check for breakpoint prefix
|
|
177
|
+
if (BREAKPOINTS.includes(parts[0])) {
|
|
178
|
+
token.breakpoint = parts[0];
|
|
179
|
+
idx++;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Check for state prefix
|
|
183
|
+
if (STATES.includes(parts[idx])) {
|
|
184
|
+
token.state = parts[idx];
|
|
185
|
+
idx++;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Property
|
|
189
|
+
if (idx < parts.length) {
|
|
190
|
+
token.property = parts[idx];
|
|
191
|
+
idx++;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Value
|
|
195
|
+
if (idx < parts.length) {
|
|
196
|
+
let value = parts.slice(idx).join(':');
|
|
197
|
+
|
|
198
|
+
// Check for arbitrary value in brackets
|
|
199
|
+
const arbitraryMatch = value.match(/^\[(.+)\]$/);
|
|
200
|
+
if (arbitraryMatch) {
|
|
201
|
+
token.value = sanitizeValue(arbitraryMatch[1].replace(/_/g, ' '));
|
|
202
|
+
token.isArbitrary = true;
|
|
203
|
+
} else {
|
|
204
|
+
token.value = sanitizeValue(value);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Validate the token structure
|
|
209
|
+
if (!isValidToken(token)) {
|
|
210
|
+
token.error = 'Invalid token structure';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return token;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Tokenize all values from parsed attributes
|
|
218
|
+
* @param {Object} parsed - Output from parser { layout: Set, space: Set, visual: Set }
|
|
219
|
+
* @returns {Array} - Array of token objects
|
|
220
|
+
*/
|
|
221
|
+
export function tokenizeAll(parsed) {
|
|
222
|
+
const tokens = [];
|
|
223
|
+
|
|
224
|
+
for (const [attrType, values] of Object.entries(parsed)) {
|
|
225
|
+
for (const raw of values) {
|
|
226
|
+
tokens.push(tokenize(raw, attrType));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return tokens;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export default { tokenize, tokenizeAll, parseToken, sanitizeValue, isValidToken };
|
|
@@ -26,6 +26,44 @@ export const justifyContent = {
|
|
|
26
26
|
examples: [
|
|
27
27
|
{ code: '<div layout="flex justify:center">Centered</div>', description: 'Center items' },
|
|
28
28
|
{ code: '<div layout="flex justify:between">Spaced</div>', description: 'Space between' }
|
|
29
|
+
],
|
|
30
|
+
preview: [
|
|
31
|
+
{
|
|
32
|
+
title: 'Justify Start',
|
|
33
|
+
titleMs: 'Jajar Permulaan',
|
|
34
|
+
description: 'Items aligned to the start of container',
|
|
35
|
+
descriptionMs: 'Item dijajarkan ke permulaan bekas',
|
|
36
|
+
html: `<div layout="flex justify:start" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
37
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
38
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
39
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
40
|
+
</div>`,
|
|
41
|
+
highlightValue: 'justify:start'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: 'Justify Center',
|
|
45
|
+
titleMs: 'Jajar Tengah',
|
|
46
|
+
description: 'Items centered along the main axis',
|
|
47
|
+
descriptionMs: 'Item berpusat sepanjang paksi utama',
|
|
48
|
+
html: `<div layout="flex justify:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
49
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
50
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
51
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
52
|
+
</div>`,
|
|
53
|
+
highlightValue: 'justify:center'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: 'Justify Between',
|
|
57
|
+
titleMs: 'Jajar Antara',
|
|
58
|
+
description: 'Items with equal space between them',
|
|
59
|
+
descriptionMs: 'Item dengan ruang sama antara mereka',
|
|
60
|
+
html: `<div layout="flex justify:between" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
61
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
62
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
63
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
64
|
+
</div>`,
|
|
65
|
+
highlightValue: 'justify:between'
|
|
66
|
+
}
|
|
29
67
|
]
|
|
30
68
|
};
|
|
31
69
|
|
|
@@ -49,6 +87,44 @@ export const alignItems = {
|
|
|
49
87
|
],
|
|
50
88
|
examples: [
|
|
51
89
|
{ code: '<div layout="flex items:center">Centered</div>', description: 'Center vertically' }
|
|
90
|
+
],
|
|
91
|
+
preview: [
|
|
92
|
+
{
|
|
93
|
+
title: 'Items Center',
|
|
94
|
+
titleMs: 'Item Tengah',
|
|
95
|
+
description: 'Items centered along cross axis',
|
|
96
|
+
descriptionMs: 'Item berpusat sepanjang paksi silang',
|
|
97
|
+
html: `<div layout="flex items:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
98
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Short</span>
|
|
99
|
+
<span space="p:large" visual="bg:primary text:white rounded:small">Tall</span>
|
|
100
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Short</span>
|
|
101
|
+
</div>`,
|
|
102
|
+
highlightValue: 'items:center'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Items Start',
|
|
106
|
+
titleMs: 'Item Permulaan',
|
|
107
|
+
description: 'Items aligned to the start of cross axis',
|
|
108
|
+
descriptionMs: 'Item dijajarkan ke permulaan paksi silang',
|
|
109
|
+
html: `<div layout="flex items:start" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
110
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Short</span>
|
|
111
|
+
<span space="p:large" visual="bg:primary text:white rounded:small">Tall</span>
|
|
112
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Short</span>
|
|
113
|
+
</div>`,
|
|
114
|
+
highlightValue: 'items:start'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
title: 'Items Stretch',
|
|
118
|
+
titleMs: 'Item Regang',
|
|
119
|
+
description: 'Items stretched to fill container height',
|
|
120
|
+
descriptionMs: 'Item diregangkan untuk mengisi ketinggian bekas',
|
|
121
|
+
html: `<div layout="flex items:stretch" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
122
|
+
<span layout="flex center" space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
123
|
+
<span layout="flex center" space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
124
|
+
<span layout="flex center" space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
125
|
+
</div>`,
|
|
126
|
+
highlightValue: 'items:stretch'
|
|
127
|
+
}
|
|
52
128
|
]
|
|
53
129
|
};
|
|
54
130
|
|
|
@@ -73,6 +149,20 @@ export const alignSelf = {
|
|
|
73
149
|
],
|
|
74
150
|
examples: [
|
|
75
151
|
{ code: '<div layout="self:center">Centered item</div>', description: 'Center single item' }
|
|
152
|
+
],
|
|
153
|
+
preview: [
|
|
154
|
+
{
|
|
155
|
+
title: 'Align Self',
|
|
156
|
+
titleMs: 'Jajar Kendiri',
|
|
157
|
+
description: 'Override parent alignment for one item',
|
|
158
|
+
descriptionMs: 'Ganti penjajaran induk untuk satu item',
|
|
159
|
+
html: `<div layout="flex items:start" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
160
|
+
<span space="p:small" visual="bg:neutral-300 dark:bg:neutral-700 text:neutral-800 dark:text:neutral-200 rounded:small">Start</span>
|
|
161
|
+
<span layout="self:center" space="p:small" visual="bg:primary text:white rounded:small">self:center</span>
|
|
162
|
+
<span space="p:small" visual="bg:neutral-300 dark:bg:neutral-700 text:neutral-800 dark:text:neutral-200 rounded:small">Start</span>
|
|
163
|
+
</div>`,
|
|
164
|
+
highlightValue: 'self:center'
|
|
165
|
+
}
|
|
76
166
|
]
|
|
77
167
|
};
|
|
78
168
|
|
|
@@ -98,6 +188,34 @@ export const alignContent = {
|
|
|
98
188
|
],
|
|
99
189
|
examples: [
|
|
100
190
|
{ code: '<div layout="flex wrap content:center">Centered rows</div>', description: 'Center wrapped rows' }
|
|
191
|
+
],
|
|
192
|
+
preview: [
|
|
193
|
+
{
|
|
194
|
+
title: 'Content Center',
|
|
195
|
+
titleMs: 'Kandungan Tengah',
|
|
196
|
+
description: 'Center wrapped rows in multi-line container',
|
|
197
|
+
descriptionMs: 'Tengahkan baris bungkus dalam bekas berbilang baris',
|
|
198
|
+
html: `<div layout="flex wrap content:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 150px; max-width: 200px;">
|
|
199
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
200
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
201
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
202
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">4</span>
|
|
203
|
+
</div>`,
|
|
204
|
+
highlightValue: 'content:center'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
title: 'Content Between',
|
|
208
|
+
titleMs: 'Kandungan Antara',
|
|
209
|
+
description: 'Space between wrapped rows',
|
|
210
|
+
descriptionMs: 'Ruang antara baris bungkus',
|
|
211
|
+
html: `<div layout="flex wrap content:between" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 150px; max-width: 200px;">
|
|
212
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
213
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
214
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
215
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">4</span>
|
|
216
|
+
</div>`,
|
|
217
|
+
highlightValue: 'content:between'
|
|
218
|
+
}
|
|
101
219
|
]
|
|
102
220
|
};
|
|
103
221
|
|
|
@@ -122,6 +240,29 @@ export const shorthandAlignment = {
|
|
|
122
240
|
],
|
|
123
241
|
examples: [
|
|
124
242
|
{ code: '<div layout="flex center">Centered content</div>', description: 'Center on both axes' }
|
|
243
|
+
],
|
|
244
|
+
preview: [
|
|
245
|
+
{
|
|
246
|
+
title: 'Center Shorthand',
|
|
247
|
+
titleMs: 'Pintasan Tengah',
|
|
248
|
+
description: 'Center items on both axes at once',
|
|
249
|
+
descriptionMs: 'Tengahkan item pada kedua-dua paksi sekaligus',
|
|
250
|
+
html: `<div layout="flex center" space="p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
251
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Centered</span>
|
|
252
|
+
</div>`,
|
|
253
|
+
highlightValue: 'center'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
title: 'Between Shorthand',
|
|
257
|
+
titleMs: 'Pintasan Antara',
|
|
258
|
+
description: 'Quick space-between layout',
|
|
259
|
+
descriptionMs: 'Susun atur space-between pantas',
|
|
260
|
+
html: `<div layout="flex between" space="p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
261
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Left</span>
|
|
262
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">Right</span>
|
|
263
|
+
</div>`,
|
|
264
|
+
highlightValue: 'between'
|
|
265
|
+
}
|
|
125
266
|
]
|
|
126
267
|
};
|
|
127
268
|
|
|
@@ -144,6 +285,20 @@ export const justifyItems = {
|
|
|
144
285
|
],
|
|
145
286
|
examples: [
|
|
146
287
|
{ code: '<div layout="grid justify-items:center">Centered items</div>', description: 'Center grid items' }
|
|
288
|
+
],
|
|
289
|
+
preview: [
|
|
290
|
+
{
|
|
291
|
+
title: 'Justify Items Center',
|
|
292
|
+
titleMs: 'Jajar Item Tengah',
|
|
293
|
+
description: 'Center all grid items horizontally within their cells',
|
|
294
|
+
descriptionMs: 'Tengahkan semua item grid secara mendatar dalam sel mereka',
|
|
295
|
+
html: `<div layout="grid grid-cols:3 justify-items:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
296
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
297
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
298
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
299
|
+
</div>`,
|
|
300
|
+
highlightValue: 'justify-items:center'
|
|
301
|
+
}
|
|
147
302
|
]
|
|
148
303
|
};
|
|
149
304
|
|
|
@@ -167,6 +322,20 @@ export const justifySelf = {
|
|
|
167
322
|
],
|
|
168
323
|
examples: [
|
|
169
324
|
{ code: '<div layout="justify-self:end">End aligned</div>', description: 'Align item to end' }
|
|
325
|
+
],
|
|
326
|
+
preview: [
|
|
327
|
+
{
|
|
328
|
+
title: 'Justify Self',
|
|
329
|
+
titleMs: 'Jajar Kendiri',
|
|
330
|
+
description: 'Override horizontal alignment for one grid item',
|
|
331
|
+
descriptionMs: 'Ganti penjajaran mendatar untuk satu item grid',
|
|
332
|
+
html: `<div layout="grid grid-cols:3" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium">
|
|
333
|
+
<span space="p:small" visual="bg:neutral-300 dark:bg:neutral-700 text:neutral-800 dark:text:neutral-200 rounded:small">Default</span>
|
|
334
|
+
<span layout="justify-self:center" space="p:small" visual="bg:primary text:white rounded:small">center</span>
|
|
335
|
+
<span layout="justify-self:end" space="p:small" visual="bg:primary text:white rounded:small">end</span>
|
|
336
|
+
</div>`,
|
|
337
|
+
highlightValue: 'justify-self:center'
|
|
338
|
+
}
|
|
170
339
|
]
|
|
171
340
|
};
|
|
172
341
|
|
|
@@ -192,6 +361,19 @@ export const placeContent = {
|
|
|
192
361
|
],
|
|
193
362
|
examples: [
|
|
194
363
|
{ code: '<div layout="grid place-content:center">Centered content</div>', description: 'Center both axes' }
|
|
364
|
+
],
|
|
365
|
+
preview: [
|
|
366
|
+
{
|
|
367
|
+
title: 'Place Content Center',
|
|
368
|
+
titleMs: 'Letakkan Kandungan Tengah',
|
|
369
|
+
description: 'Center entire grid content in both directions',
|
|
370
|
+
descriptionMs: 'Tengahkan keseluruhan kandungan grid dalam kedua-dua arah',
|
|
371
|
+
html: `<div layout="grid grid-cols:2 place-content:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 120px;">
|
|
372
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
373
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
374
|
+
</div>`,
|
|
375
|
+
highlightValue: 'place-content:center'
|
|
376
|
+
}
|
|
195
377
|
]
|
|
196
378
|
};
|
|
197
379
|
|
|
@@ -214,6 +396,20 @@ export const placeItems = {
|
|
|
214
396
|
],
|
|
215
397
|
examples: [
|
|
216
398
|
{ code: '<div layout="grid place-items:center">Centered items</div>', description: 'Center all items' }
|
|
399
|
+
],
|
|
400
|
+
preview: [
|
|
401
|
+
{
|
|
402
|
+
title: 'Place Items Center',
|
|
403
|
+
titleMs: 'Letakkan Item Tengah',
|
|
404
|
+
description: 'Center all items within their grid cells',
|
|
405
|
+
descriptionMs: 'Tengahkan semua item dalam sel grid mereka',
|
|
406
|
+
html: `<div layout="grid grid-cols:3 place-items:center" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
407
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">1</span>
|
|
408
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">2</span>
|
|
409
|
+
<span space="p:small" visual="bg:primary text:white rounded:small">3</span>
|
|
410
|
+
</div>`,
|
|
411
|
+
highlightValue: 'place-items:center'
|
|
412
|
+
}
|
|
217
413
|
]
|
|
218
414
|
};
|
|
219
415
|
|
|
@@ -237,6 +433,20 @@ export const placeSelf = {
|
|
|
237
433
|
],
|
|
238
434
|
examples: [
|
|
239
435
|
{ code: '<div layout="place-self:center">Centered item</div>', description: 'Center single item' }
|
|
436
|
+
],
|
|
437
|
+
preview: [
|
|
438
|
+
{
|
|
439
|
+
title: 'Place Self Center',
|
|
440
|
+
titleMs: 'Letakkan Kendiri Tengah',
|
|
441
|
+
description: 'Center one item in both directions within its cell',
|
|
442
|
+
descriptionMs: 'Tengahkan satu item dalam kedua-dua arah dalam selnya',
|
|
443
|
+
html: `<div layout="grid grid-cols:3" space="g:small p:medium" visual="bg:neutral-100 dark:bg:neutral-900 rounded:medium" style="height: 100px;">
|
|
444
|
+
<span space="p:small" visual="bg:neutral-300 dark:bg:neutral-700 text:neutral-800 dark:text:neutral-200 rounded:small">Default</span>
|
|
445
|
+
<span layout="place-self:center" space="p:small" visual="bg:primary text:white rounded:small">center</span>
|
|
446
|
+
<span space="p:small" visual="bg:neutral-300 dark:bg:neutral-700 text:neutral-800 dark:text:neutral-200 rounded:small">Default</span>
|
|
447
|
+
</div>`,
|
|
448
|
+
highlightValue: 'place-self:center'
|
|
449
|
+
}
|
|
240
450
|
]
|
|
241
451
|
};
|
|
242
452
|
|